[FFmpeg-devel] [PATCH] port DVCProHD encoding code from FFmbc-0.7-rc5

Tomas Härdin tomas.hardin at codemill.se
Wed Jan 18 14:52:24 CET 2012


On Wed, 2012-01-18 at 13:01 +0200, Maksym Veremeyenko wrote:
> Hi,
> 
> attached patch port a code for encoding DVCProHD

Considering FFmbc is GPL, isn't this code too? If so then it requires
some configuration fiddlery as well.
The code may be based on a set of old patches from this mailing list,
meaning it might count as LGPL. IANAL and I don't know if this code is
based on that.

> -static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, int linesize, DVVideoContext *s, int bias)
> +static av_always_inline void dv_set_class_number_sd(DCTELEM *blk, EncBlockInfo *bi,
> +                                          const uint8_t *zigzag_scan,
> +                                          const int *weight, int bias)

Strange indentation

> -       bi->prev[area]     = prev;
> -       bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :)
> -       for (i = mb_area_start[area]; i < mb_area_start[area+1]; i++)
> {
> -          int level = blk[zigzag_scan[i]];
> -
> -          if (level + 15 > 30U) {
> -              bi->sign[i] = (level >> 31) & 1;
> -              /* weight it and and shift down into range, adding for
> rounding */
> -              /* the extra division by a factor of 2^4 reverses the
> 8x expansion of the DCT
> -                 AND the 2x doubling of the weights */
> -              level = (FFABS(level) * weight[i] + (1 <<
> (dv_weight_bits+3))) >> (dv_weight_bits+4);
> -              bi->mb[i] = level;
> -              if (level > max)
> -                  max = level;
> -              bi->bit_size[area] += dv_rl2vlc_size(i - prev  - 1,
> level);
> -              bi->next[prev]= i;
> -              prev = i;
> -          }
> -       }
> +        bi->prev[area]     = prev;
> +        bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :)
> +        for (i = mb_area_start[area]; i < mb_area_start[area+1]; i++)
> {
> +            int level = blk[zigzag_scan[i]];
> +
> +            if (level + 15 > 30U) {
> +                bi->sign[i] = (level >> 31) & 1;
> +                /* weight it and and shift down into range, adding
> for rounding */
> +                /* the extra division by a factor of 2^4 reverses the
> 8x expansion of the DCT
> +                   AND the 2x doubling of the weights */
> +                level = (FFABS(level) * weight[i] + (1 <<
> (dv_weight_bits+3))) >> (dv_weight_bits+4);
> +                bi->mb[i] = level;
> +                if (level > max)
> +                    max = level;
> +                bi->bit_size[area] += dv_rl2vlc_size(i - prev  - 1,
> level);
> +                bi->next[prev] = i;
> +                prev = i;
> +            }
> +        }
>      }
>      bi->next[prev]= i;
>      for (bi->cno = 0; max > classes[bi->cno]; bi->cno++);
> @@ -844,20 +831,336 @@ static av_always_inline int
> dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i
>              bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :)
>              for (; i < mb_area_start[area+1]; i = bi->next[i]) {
>                  bi->mb[i] >>= 1;
> -
>                  if (bi->mb[i]) {
>                      bi->bit_size[area] += dv_rl2vlc_size(i - prev -
> 1, bi->mb[i]);
> -                    bi->next[prev]= i;
> +                    bi->next[prev] = i;
>                      prev = i;
>                  }
>              }
>          }
> -        bi->next[prev]= i;
> +        bi->next[prev] = i;

These look like indentation/cosmetic hunks only - consider moving them
to a separate patch.

Finally, it looks like it might be possible to simplify
dv_guess_qnos_hd(). That can be saved for a separate patch though, if
it's possible at all.

Nothing else in the code pops out from a quick glance.

/Tomas



More information about the ffmpeg-devel mailing list