[FFmpeg-devel] [PATCH] wmv3 encoder : msmpeg4.c changes

Michael Niedermayer michaelni
Fri Jun 22 03:46:59 CEST 2007


Hi

On Thu, Jun 21, 2007 at 09:29:05PM +0200, Denis Fortin wrote:
> Michael Niedermayer a ?crit :
> >Hi
> >
> >On Tue, Jun 19, 2007 at 09:54:48PM +0200, Denis Fortin wrote:
> >>This patch includes changes useful for wmv3 encoder.
> >>Remove some static inline (this has been previously discussed and 
> >>benchmarked)
> >>Add wmv3 specific behavior (it won't affect anything else)
> >
> >[...]
> >>@@ -593,7 +593,7 @@
> >>         s->misc_bits += get_bits_diff(s);
> >> 
> >>         for (i = 0; i < 6; i++) {
> >>-            msmpeg4_encode_block(s, block[i], i);
> >>+            ff_msmpeg4_encode_block(s, block[i], i);
> >>         }
> >>         s->i_tex_bits += get_bits_diff(s);
> >>         s->i_count++;
> >>@@ -783,7 +783,8 @@
> >> static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int 
> >> *dir_ptr)
> >> {
> >>     int sign, code;
> >>-    int pred;
> >>+    int pred, extquant;
> >>+    int extrabits = 0;
> >> 
> >>     if(s->msmpeg4_version==1){
> >>         int32_t *dc_val;
> >>@@ -825,7 +826,16 @@
> >>         code = level;
> >>         if (code > DC_MAX)
> >>             code = DC_MAX;
> >>-
> >>+        else if( s->msmpeg4_version>=6 ) {
> >>+            if( s->qscale == 1 ) {
> >>+                extquant = (level + 3) & 0x3;
> >>+                code  = ((level+3)>>2);
> >>+            } else if( s->qscale == 2 ) {
> >>+                extquant = (level + 1) & 0x1;
> >>+                code  = ((level+1)>>1);
> >>+            }
> >>+        }
> >>+        
> >>         if (s->dc_table_index == 0) {
> >
> >trailing whitespace, and the static X -> ff_X change belongs into a
> >seperate patch
> >
> >
> >[...]
> >>@@ -937,10 +952,18 @@
> >>                             if(s->esc3_level_length==0){
> >>                                 s->esc3_level_length=8;
> >>                                 s->esc3_run_length= 6;
> >>-                                if(s->qscale<8)
> >>-                                    put_bits(&s->pb, 6, 3);
> >>-                                else
> >>-                                    put_bits(&s->pb, 8, 3);
> >>+                                if(s->msmpeg4_version<6) {
> >>+                                    if(s->qscale<8)
> >>+                                        put_bits(&s->pb, 6, 3);
> >>+                                    else
> >>+                                        put_bits(&s->pb, 8, 3);
> >>+                                } else {
> >>+                                    if(s->qscale<8)
> >>+                                        put_bits(&s->pb,5,0);
> >>+                                    else
> >>+                                        put_bits(&s->pb,6,0);
> >>+                                    put_bits(&s->pb,2,3);
> >>+                                }
> >
> >ideg ...
> >
> >that is just
> >
> >if(s->qscale<8)
> >    put_bits(&s->pb, 6 + (s->msmpeg4_version>=6), 3);
> >else
> >    put_bits(&s->pb, 8, 3);
> >
> >[...]
> 
> Updated patch with comments addressed

looks ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070622/db444838/attachment.pgp>



More information about the ffmpeg-devel mailing list