[FFmpeg-devel] [PATCH] avcodec: add IMM5 decoder

Peter Ross pross at xvid.org
Tue Jul 16 13:32:56 EEST 2019


On Tue, Jul 16, 2019 at 11:57:36AM +0200, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  configure               |   1 +
>  libavcodec/Makefile     |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h    |   1 +
>  libavcodec/codec_desc.c |   7 ++
>  libavcodec/imm5.c       | 175 ++++++++++++++++++++++++++++++++++++++++
>  libavformat/riff.c      |   1 +
>  7 files changed, 187 insertions(+)
>  create mode 100644 libavcodec/imm5.c
> 
> diff --git a/configure b/configure

> +
> +        if (index >= 1 && index <= 12) {
> +            index -= 1;
> +            off = offset = IMM5_units[index].len;
> +            if (codec_type == 2) {
> +                offset += IMM5_units[12].len;
> +            } else {
> +                offset += IMM5_units[13].len;
> +            }
> +
> +            buf += 24 - offset;
> +            buf_size = new_size + offset;
> +
> +            memcpy(buf, IMM5_units[index].bits, IMM5_units[index].len);
> +            if (codec_type == 2) {
> +                memcpy(buf + off, IMM5_units[12].bits, IMM5_units[12].len);
> +            } else {
> +                memcpy(buf + off, IMM5_units[13].bits, IMM5_units[13].len);
> +            }

this all looks pretty good.
without trying to nitpick it forever, i suggest replacing the (codec_type==2) blocks.

index2 = codec_type2 == 2 ? 12 : 13;

offset += IMM5_units[index2].len;
...
memcpy(buf + off, IMM5_units[index2].bits, IMM5_units[index2].len);


-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190716/bc5fdd47/attachment.sig>


More information about the ffmpeg-devel mailing list