i am struggling to come up with a c program that is capable of picking up the Y, U and V parameters from a video stream and compare them with that of another stream to calculate the PSNR.
i was able to download existing programs from the net but unfortunately that are all part of a library, thus cannot operate on its own.
if i have the program below, how do i develop it to compile, for the purpose of calculating PSNR
At this stage i still find it difficult developing c programs to compile.
Any help will be welcomed
Kind regards
#include <stdio.h>
#include <math.h>
{
double FindPsnr (unsigned char *input1, unsigned char * input2, int count)
{
int c;
float sum = 0;
int square=0;
for (c=0 ;c<count; ++c)
{
square = *input1++ - *input2++;
square = square * square;
sum += square;
}
//sum = 65025.0*count/sum;
//if(sum>=0.000001)//not zero.
if(sum==0) sum=count; /* - make sure no infinity value */
sum = 10.0*log10(65025.0*count/sum);
//else sum = 0;
return sum;
//return 0;
}
int main(void)
{
int Area=0
int Width = 0
int Height = 0
Area = Width * Height; //image width , height;
// Area for Y = Width*Height, Area for U or V = Width*Height >>2;
psnr_y = FindPsnr ((unsigned char *) input_frame_buffer,
(unsigned char *)recon_frame_buffer, Area);
psnr_u = FindPsnr ((unsigned char *) input_frame_buffer+Area,
(unsigned char *)recon_frame_buffer+Area, Area>>2);
psnr_v = FindPsnr ((unsigned char *) input_frame_buffer+Area+(Area>>2),
(unsigned char *)recon_frame_buffer+Area+(Area>>2), Area>>
}
}
2 2500
What's wrong with the code you find online being in the form of a library? Certainly, you can learn from the code, and adapt it to to your own program. I mean, were you expecting a full blown program that conforms precisely to your specifications?
The code necessary is going to be more than 10 lines of uncompilable code. You have to go significantly further to achieve your task. Things like reading and decoding the video will be necessary.
From what we can tell, you don't really have a specific question. Instead, it's more along the lines of "I don't know what i'm doing". If this is above your level of programming knowledge, then there isn't much we can do.
Thanks for your prompt reply. Even though i have tried to remodel the programs i downloaded, i still think like you rightly said the problem is with my programming level. Knowing i can always get help for this forum, i will take your response like a challenge to improve my programing skills and i am certain you will be availble to help if i get specific in the course of sorting it out
thanks
Sign in to post your reply or Sign up for a free account.
Similar topics
by: rusttree |
last post by:
I'm working on a program that manipulates bmp files. I know the offset
location of each piece of relevent data within the bmp file. For
example, I know the 18th through 21st byte is an integer...
|
by: Erik Max Francis |
last post by:
I was interesting in adding selection and hit testing to ZOE, and was
looking at the PyOpenGL wrappers' handling of selection and picking. I
see glSelectBuffer to specify the size of the buffer,...
|
by: Paolo |
last post by:
Hi all!
I'm new to Linux but I have a complex task (at least it seems so to
me!): I created a small multicast protocol in C++ and now I need an
application for testing. I have to create an...
|
by: dduran |
last post by:
I'm on Windows XP using Visual C++ 6.0.
I need to capture the image in the video frame buffer,
modify it by putting a small graphic along the bottom
sixteenth of the image, and write it back to...
|
by: hzgt9b |
last post by:
Using VS2003, VB.NET,
BACKGROUND
I have a window forms based application that will be distributed and
executed directly from CD media. The app contains a TreeView control and a
WebBroswer...
|
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= |
last post by:
I have a web site under .NET 2.0 that renders videos using the Silverlight
media player. The <asp:MediaPlayercontrol only works on .NET 3.5, but I
managed to get things working under .NET 2.0 by...
|
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= |
last post by:
Note: My apologies for repeating this post from last week, but my nospam
alias and profile account were incorrect. I think I have fixed this, so
hopefully this post will trigger MS into a response...
|
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= |
last post by:
This is a follow-up to my post "Silverlight video doesn't work when file is
streamed from handler in ASP.net" at...
|
by: giulio8 |
last post by:
Hello,
I'd appreciate your suggestions about this drafted application for video editing. It is just the first idea, it is (barely) working but can be improved a lot! Find the code attached below....
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |