[Ffmpeg-devel] [RFC] rms calculator

Michael Niedermayer michaelni
Mon Mar 27 13:50:06 CEST 2006


Hi

On Mon, Mar 27, 2006 at 01:33:05PM +0000, Benjamin Larsson wrote:
[...]
> >the question is why do you even need to read the headers?
> >16bit data: yes
> >stereo / mono: will match
> >  
> >
> I think I only need to know if it is a stereo or mono stream. The reason
> I added it was that the final rms value should be the largest rms of
> both channels thus I needed to read the headers. I modified tiny_psnr to
> get the sse and that was fine, but I had to skip the headers and the sse
> was the combined sse for both channels, so the rms would be the average
> of the channels rms. Would a byte skip parameter patch for tiny_psnr
> like the one attached be accepted ? And later a stride patch?
> 
> Note, that the rms calculation is not yet there.
> 
> A testrun with "./tiny_psnr testff.wav test.wav 2 0 44" produced a SSE
> value of 432, matching the result from my code.
> 
> MvH
> Benjamin Larsson
> 
> -- 
> "incorrect information" is an oxymoron. Information is, by definition, factual, correct.
> 

> Index: tiny_psnr.c
> ===================================================================
> RCS file: /cvsroot/ffmpeg/ffmpeg/tests/tiny_psnr.c,v
> retrieving revision 1.9
> diff -u -r1.9 tiny_psnr.c
> --- tiny_psnr.c	12 Jan 2006 22:43:26 -0000	1.9
> +++ tiny_psnr.c	27 Mar 2006 11:31:09 -0000
> @@ -106,9 +106,10 @@
>      int len= argc<4 ? 1 : atoi(argv[3]);
>      int64_t max= (1<<(8*len))-1;
>      int shift= argc<5 ? 0 : atoi(argv[4]);
> +    int skip_bytes = argc<6 ? 0 : atoi(argv[5]);
>  
>      if(argc<3){
> -        printf("tiny_psnr <file1> <file2> [<elem size> [<shift>]]\n");
> +        printf("tiny_psnr <file1> <file2> [<elem size> [<shift>] <skip bytes>]\n");
>          return -1;
>      }
>  
> @@ -116,6 +117,11 @@
>      f[1]= fopen(argv[2], "rb");
>      fseek(f[shift<0], shift < 0 ? -shift : shift, SEEK_SET);
>  
> +    if (skip_bytes>0) {
> +        fseek(f[0],skip_bytes,SEEK_SET);
> +        fseek(f[1],skip_bytes,SEEK_SET);
> +    }

rejected

fseek(f[shift< 0], shift + skip, SEEK_SET);
fseek(f[shift>=0],         skip, SEEK_SET);
is much simpler, and whats more important it is actually correct

[...]

-- 
Michael





More information about the ffmpeg-devel mailing list