[Ffmpeg-devel] [RFC] VC3/DNxHD decoder

Baptiste Coudurier baptiste.coudurier
Mon Mar 19 00:26:04 CET 2007


Hi

Michael Niedermayer wrote:
> Hi
> 
> On Sun, Mar 18, 2007 at 08:32:43PM +0100, Baptiste Coudurier wrote:
> [...]
>>>> +    DECLARE_ALIGNED_8(ScanTable, scantable);
>>>> +    const CIDEntry *cid_table;
>>>> +} DNXHDContext;
>>>> +
>>>> +static const CIDEntry cid_table[] = {
>>>> +    { 1238, 1920, 1080, 0, 917504, 4, 8,
>>>> +      dnxhd_1238_luma_weigth, dnxhd_1238_chroma_weigth,
>>>> +      dnxhd_1238_dc_codes, dnxhd_1238_dc_bits,
>>>> +      dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
>>>> +      dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag,
>>>> +      dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1238_run_level },
>>>> +/*     { 1243, 1920, 1080, 1, 917504, 4, 8, */
>>>> +/*       dnxhd_1243_luma_weigth, dnxhd_1243_chroma_weigth, */
>>>> +/*       dnxhd_1238_dc_codes, dnxhd_1238_dc_bits, */
>>>> +/*       dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level, */
>>>> +/*       dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag, */
>>>> +/*       dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1238_run_level }, */
>>>> +};
>>> id suggest that all values which are always the same no matter which cid
>>> should be hardcoded as that should be faster
>> What do you mean by hardcoded ?
> 
> #define INDEX_BITS 4
> INDEX_BITS
> 
> instead of
> 
> ctx->index_bits
> 
> for example

Ok, index_bits will be different for 10bit per comp.

> [...]
>> +typedef struct {
>> +    AVCodecContext *avctx;
>> +    AVFrame picture;
>> +    GetBitContext gb;
>> +    int cid; ///< compression id
>> +    unsigned int width, height;
>> +    unsigned int mb_width, mb_height;
>> +    uint32_t mb_scan_index[68]; /* max for 1080p */
>> +    int cur_field; ///< current interlaced field
>> +    int index_bits; ///< length of index value
> 
> vertically aligning the comments makes them more readable IMHO
> 
>     int cid;                            ///< compression id
>     unsigned int width, height;
>     unsigned int mb_width, mb_height;
>     uint32_t mb_scan_index[68];         /* max for 1080p */
>     int cur_field;                      ///< current interlaced field
>     int index_bits;                     ///< length of index value

Done

> [...]
>> +static int dnxhd_decode_macroblock(DNXHDContext *ctx, int x, int y)
>> +{
>> +    int dct_linesize_luma   = ctx->picture.linesize[0];
>> +    int dct_linesize_chroma = ctx->picture.linesize[1];
>> +    uint8_t *dest_y, *dest_u, *dest_v;
>> +    int dct_offset;
>> +    int qscale, i;
>> +
>> +    ctx->dsp.clear_blocks(ctx->blocks[0]);
>> +    ctx->dsp.clear_blocks(ctx->blocks[2]); // FIXME change clear blocks to take block amount
>> +
>> +    qscale = get_bits(&ctx->gb, 11);
>> +    skip_bits1(&ctx->gb);
>> +    //av_log(ctx->avctx, AV_LOG_DEBUG, "qscale %d\n", qscale);
>> +
>> +    for (i = 0; i < 8; i++) {
>> +        dnxhd_decode_dct_block(ctx, ctx->blocks[i], i, qscale);
> 
> the <0 return is ignored, not a big issue but still, id either make functions
> return void or check their return value and pass the error up

Changed decode_dct_block to return void.

> besides these patch ok

Yeah, applied.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list