[FFmpeg-devel] Prepwork for DVCPRO HD inclusion

Michael Niedermayer michaelni
Sun Aug 10 22:25:31 CEST 2008


On Sun, Aug 10, 2008 at 12:45:59PM -0700, Roman V. Shaposhnik wrote:
> Hi Guys!
> 
> Attached are 2 patches against the DV codec. Both of them make the
> codec somewhat better/faster, but the real reason I need them is
> to make it easier to implement DVCPRO HD. The first patch (patch.units)
> corrects a long standing issue with DV50 placement tables: the 
> horizontal coordinate is not in units of 8 (now that the units are
> fixed calculating y_ptr and c_offset also becomes more straightforward).
> The second patch (patch.factor) simplifies the unweighting and 
> dequantization steps in the decoder and also reduces the # of tables
> used.
> 
> I intend to commit them myself unless I hear any objections or
> criticism.
> 
> Thanks,
> Roman.

> diff --git a/libavcodec/dv.c b/libavcodec/dv.c
> index 8ba952a..a181557 100644
> --- a/libavcodec/dv.c
> +++ b/libavcodec/dv.c
> @@ -50,7 +50,7 @@ typedef struct DVVideoContext {
>      uint8_t *buf;
>  
>      uint8_t dv_zigzag[2][64];
> -    uint8_t dv_idct_shift[2][2][22][64];
> +    uint32_t dv_idct_factor[2][2][22][64];
>  
>      void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size);
>      void (*fdct[2])(DCTELEM *block);
> @@ -84,25 +84,22 @@ static struct dv_vlc_pair {
>  
>  static void dv_build_unquantize_tables(DVVideoContext *s, uint8_t* perm)
>  {
> -    int i, q, j;
> +    int i, q, a; 
>  
>      /* NOTE: max left shift is 6 */
>      for(q = 0; q < 22; q++) {
>          /* 88DCT */
> -        for(i = 1; i < 64; i++) {
> +        i=1;
> +        for(a = 0; a<4; a++) {
> +            for(; i < dv_quant_areas[a]; i++) {
> -            /* 88 table */
> +                /* 88 table */
> -            j = perm[i];
> -            s->dv_idct_shift[0][0][q][j] =
> -                dv_quant_shifts[q][dv_88_areas[i]] + 1;
> +                s->dv_idct_factor[0][0][q][i] = dv_iweight_88[i]<<(dv_quant_shifts[q][a] + 1);
> -            s->dv_idct_shift[1][0][q][j] = s->dv_idct_shift[0][0][q][j] + 1;
> +                s->dv_idct_factor[1][0][q][i] = s->dv_idct_factor[0][0][q][i]<<1;
> -        }
> -
> -        /* 248DCT */
> -        for(i = 1; i < 64; i++) {
> +
> +                /* 248 table */
> -            /* 248 table */
> -            s->dv_idct_shift[0][1][q][i] =
> -                dv_quant_shifts[q][dv_248_areas[i]] + 1;
> +                s->dv_idct_factor[0][1][q][i] = dv_iweight_248[i]<<(dv_quant_shifts[q][a] + 1);
> -            s->dv_idct_shift[1][1][q][i] = s->dv_idct_shift[0][1][q][i] + 1;
> +                s->dv_idct_factor[1][1][q][i] = s->dv_idct_factor[0][1][q][i]<<1;
> +            }
>          }
>      }
>  }

cosmetic and functional mix, please split the patch in a cosmetic and
a functional patch. This is very hard to decypher otherwise


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

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080810/98dbf5fd/attachment.pgp>



More information about the ffmpeg-devel mailing list