[FFmpeg-devel] [PATCH][VAAPI][6/6] Add H.264 bitstream decoding (take 8)

Michael Niedermayer michaelni
Mon Apr 27 14:01:54 CEST 2009


On Mon, Apr 20, 2009 at 11:49:39AM +0200, Gwenole Beauchesne wrote:
> On Sat, 18 Apr 2009, Michael Niedermayer wrote:
>
>> also maybe you could add a single sentance to each function to describe
>> what it does.
>
> I thought the function names were meaningful enough. ;-) Anyway, here is a 
> new patch to cope with the other changes too.

[...]

> +/** Reconstruct bitstream slice_type */
> +static int h264_get_slice_type(H264Context *h)
> +{
> +    int slice_type = -1;
> +    switch (h->slice_type) {
> +    case FF_P_TYPE:  slice_type = 0; break;
> +    case FF_B_TYPE:  slice_type = 1; break;
> +    case FF_I_TYPE:  slice_type = 2; break;
> +    case FF_SP_TYPE: slice_type = 3; break;
> +    case FF_SI_TYPE: slice_type = 4; break;
> +    }
> +    return slice_type;
> +}

the  slice_type variable is redundant


> +
> +static void vaapi_h264_init_picture(VAPictureH264 *va_pic)
> +{
> +    va_pic->picture_id          = 0xffffffff;
> +    va_pic->flags               = VA_PICTURE_H264_INVALID;
> +    va_pic->TopFieldOrderCnt    = 0;
> +    va_pic->BottomFieldOrderCnt = 0;
> +}
> +

> +/** Translate an FFmpeg Picture into its VA API form */
> +static void vaapi_h264_fill_picture(VAPictureH264 *va_pic, Picture *pic, int pic_structure)

I like the doxy, but the function name says something else


[...]
> +    poc = 0;
> +    if (pic_structure & PICT_TOP_FIELD) {
> +        if ((poc = pic->field_poc[0]) == INT_MAX)
> +            poc = 0;
> +    }
> +    va_pic->TopFieldOrderCnt = poc;

if((pic_structure & PICT_TOP_FIELD) && pic->field_poc[0] != INT_MAX)
    va_pic->TopFieldOrderCnt= pic->field_poc[0];



[...]
> +#define FILL_PRED_WEIGHT_TABLE(n)                                              \
> +    vaapi_h264_fill_pred_weight_table(h, n,                                    \
> +                                      &slice_param->luma_weight_l##n##_flag,   \
> +                                      slice_param->luma_weight_l##n,           \
> +                                      slice_param->luma_offset_l##n,           \
> +                                      &slice_param->chroma_weight_l##n##_flag, \
> +                                      slice_param->chroma_weight_l##n,         \
> +                                      slice_param->chroma_offset_l##n)
> +
> +    FILL_PRED_WEIGHT_TABLE(0);
> +    FILL_PRED_WEIGHT_TABLE(1);

i dont really think this macro improve readability

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- 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/20090427/4ff1fc1a/attachment.pgp>



More information about the ffmpeg-devel mailing list