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

Michael Niedermayer michaelni
Tue Jun 19 23:10:58 CEST 2007


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);

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- 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/20070619/d1c430b6/attachment.pgp>



More information about the ffmpeg-devel mailing list