[MPlayer-dev-eng] [PATCH] CQMs in x264

Robert Swain robert.swain at gmail.com
Fri Jul 22 18:08:21 CEST 2005


Hello.

On 7/22/05, Loren Merritt <lorenm at u.washington.edu> wrote:
> On Fri, 15 Jul 2005, Robert Swain wrote:
> > else if( strncasecmp( cqm, "file,", 5 ) == 0 )
> > {
> >     mod->param.i_cqm_preset = X264_CQM_CUSTOM;
> >     mod->param.psz_cqm_file = cqm + 5;
> >     mp_msg( MSGT_MENCODER, MSGL_V, "x264: CQM file correctly loaded.\n" );
> > }
> 
> At that point, you don't know that the file correctly loaded. You haven't
> even checked that the file exists. If x264_encoder_open() succeeds, only
> then do you know it worked.

You are indeed correct and this had already come to mind. Would it be
OK to do something like this?:

+            FILE *cqm_test;
+            cqm_test = fopen( cqm + 5, "rb" );
+            if( cqm_test )
+            {
+                mod->param.i_cqm_preset = X264_CQM_CUSTOM;
+                mod->param.psz_cqm_file = cqm + 5;
+                mp_msg( MSGT_MENCODER, MSGL_V, "x264: CQM file
correctly loaded.\n" );
+            }
+            else
+            {
+                mp_msg( MSGT_MENCODER, MSGL_ERR, "x264: CQM file
failed to open.\n" );
+                return 0;
+            }

I know it doesn't check whether the file was parsed correctly but is
that possible before encoding begins?

I've also stolen your comma separated list parsing code and added a
lot more checks to the interface to make it more robust. I'm a little
wary of attaching the patch as is because I'm sure there's something
else I wanted to do but I don't recall. Anyway, have a look at it and
pick holes in it please.

Robert Swain (superdump)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer.x264.cqm.8.diff
Type: application/octet-stream
Size: 4971 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050722/19ac57e2/attachment.obj>


More information about the MPlayer-dev-eng mailing list