[FFmpeg-devel] libavcodec: r12b decoder
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon Jun 7 13:59:19 EEST 2021
Dennis Fleurbaaij:
> Pulled master and re-applied to resolve version update conflict
>
> Kind regards,
> Dennis Fleurbaaij
>
>
>
> + if (avctx->width % PIXELS_PER_BLOCK != 0) {
> + av_log(avctx, AV_LOG_ERROR, "image width not modulo 8\n");
> + return AVERROR_INVALIDDATA;
> + }
> +
> + AVFrame *pic = data;
> + pic->pict_type = AV_PICTURE_TYPE_I;
> + pic->key_frame = 1;
> +
This (and other declarations below) should give statement-before
declaration warnings (FFmpeg still uses the C90 convention that all
declarations have to be at the top of each block.
> + const uint8_t* src = (const uint8_t *)avpkt->data;
Unnecessary cast (adding const is safe and doesn't need a cast).
>
> + #define GET_F0(word, byte) ((GET_FF(word, byte) & 0xF0) >> 4)
The & is unnecessary, but the compiler will probably figure this out on
its own.
>
> +#if CONFIG_R12B_DECODER
> +const AVCodec ff_r12b_decoder = {
> + .name = "r12b",
> + .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 12-bit 8px in 36B"),
> + .type = AVMEDIA_TYPE_VIDEO,
> + .id = AV_CODEC_ID_R12B,
> + .init = decode_init,
> + .decode = decode_frame,
> + .capabilities = AV_CODEC_CAP_DR1,
> + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
> +};
> +#endif
The #if is unnecessary as r12bdec.c will only get compiled if
CONFIG_R12B_DECODER is true.
- Andreas
More information about the ffmpeg-devel
mailing list