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

Peter Ross pross at xvid.org
Tue Jan 22 22:48:10 EET 2019


On Tue, Jan 22, 2019 at 10:22:29AM -0300, James Almer wrote:
> On 1/22/2019 6:55 AM, Paul B Mahol wrote:
> > Thanks Kostya for great help in reversing binary.

:)

> > +static void fill_tile4(AVCodecContext *avctx, uint8_t *color, AVFrame *frame)
> > +{
> > +    ARBCContext *s = avctx->priv_data;
> > +    GetByteContext *gb = &s->gb;
> > +    int nb_tiles = bytestream2_get_le16(gb);
> > +    int h = avctx->height - 1;
> > +
> > +    for (int i = 0; i < nb_tiles; i++) {
> > +        int y = bytestream2_get_byte(gb);
> > +        int x = bytestream2_get_byte(gb);
> > +        uint16_t mask = bytestream2_get_le16(gb);
> > +        int start_y = y * 4, start_x = x * 4;
> > +        int end_y = start_y + 4, end_x = start_x + 4;
> > +
> > +        for (int j = start_y; j < end_y; j++) {
> > +            for (int k = start_x; k < end_x; k++) {
> > +                if (mask & 0x8000) {
> > +                    if (j >= avctx->height || k >= avctx->width)
> > +                        continue;
> > +                    frame->data[0][frame->linesize[0] * (h - j) + 3 * k + 0] = color[0];
> > +                    frame->data[0][frame->linesize[0] * (h - j) + 3 * k + 1] = color[1];
> > +                    frame->data[0][frame->linesize[0] * (h - j) + 3 * k + 2] = color[2];
> > +                }
> > +                mask = mask << 1;
> 
> get_bits(). Same below.

i do not agree, for the overkill reason given by paul.

equally, the pixel blit code could be moved to a seperate inlined function.
this is just a code style suggestion from me.

otherwise looks good.

-- 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/20190123/1146a6f8/attachment.sig>


More information about the ffmpeg-devel mailing list