static int aasc_decode_frame(AVCodecContext *avctx,

                              void *data, int *got_frame,

                              AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size       = avpkt->size;

    AascContext *s     = avctx->priv_data;

    int compr, i, stride, ret;



    s->frame.reference = 1;

    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;

    if ((ret = avctx->reget_buffer(avctx, &s->frame)) < 0) {

        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");

        return ret;

    }



    compr     = AV_RL32(buf);

    buf      += 4;

    buf_size -= 4;

    switch (compr) {

    case 0:

        stride = (avctx->width * 3 + 3) & ~3;

        for (i = avctx->height - 1; i >= 0; i--) {

            memcpy(s->frame.data[0] + i * s->frame.linesize[0], buf, avctx->width * 3);

            buf += stride;

        }

        break;

    case 1:

        bytestream2_init(&s->gb, buf - 4, buf_size + 4);

        ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb);

        break;

    default:

        av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);

        return AVERROR_INVALIDDATA;

    }



    *got_frame = 1;

    *(AVFrame*)data = s->frame;



    /* report that the buffer was completely consumed */

    return buf_size;

}

static int aasc_decode_frame(AVCodecContext *avctx,

                              void *data, int *got_frame,

                              AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size       = avpkt->size;

    AascContext *s     = avctx->priv_data;

    int compr, i, stride, ret;



    s->frame.reference = 1;

    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;

    if ((ret = avctx->reget_buffer(avctx, &s->frame)) < 0) {

        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");

        return ret;

    }



    compr     = AV_RL32(buf);

    buf      += 4;

    buf_size -= 4;

    switch (compr) {

    case 0:

        stride = (avctx->width * 3 + 3) & ~3;

        for (i = avctx->height - 1; i >= 0; i--) {

            memcpy(s->frame.data[0] + i * s->frame.linesize[0], buf, avctx->width * 3);

            buf += stride;

        }

        break;

    case 1:

        bytestream2_init(&s->gb, buf - 4, buf_size + 4);

        ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb);

        break;

    default:

        av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);

        return AVERROR_INVALIDDATA;

    }



    *got_frame = 1;

    *(AVFrame*)data = s->frame;



    

    return buf_size;

}

static int FUNC_0(AVCodecContext *VAR_0,

                              void *VAR_1, int *VAR_2,

                              AVPacket *VAR_3)

{

    const uint8_t *VAR_4 = VAR_3->VAR_1;

    int VAR_5       = VAR_3->size;

    AascContext *s     = VAR_0->priv_data;

    int VAR_6, VAR_7, VAR_8, VAR_9;



    s->frame.reference = 1;

    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;

    if ((VAR_9 = VAR_0->reget_buffer(VAR_0, &s->frame)) < 0) {

        av_log(VAR_0, AV_LOG_ERROR, "reget_buffer() failed\n");

        return VAR_9;

    }



    VAR_6     = AV_RL32(VAR_4);

    VAR_4      += 4;

    VAR_5 -= 4;

    switch (VAR_6) {

    case 0:

        VAR_8 = (VAR_0->width * 3 + 3) & ~3;

        for (VAR_7 = VAR_0->height - 1; VAR_7 >= 0; VAR_7--) {

            memcpy(s->frame.VAR_1[0] + VAR_7 * s->frame.linesize[0], VAR_4, VAR_0->width * 3);

            VAR_4 += VAR_8;

        }

        break;

    case 1:

        bytestream2_init(&s->gb, VAR_4 - 4, VAR_5 + 4);

        ff_msrle_decode(VAR_0, (AVPicture*)&s->frame, 8, &s->gb);

        break;

    default:

        av_log(VAR_0, AV_LOG_ERROR, "Unknown compression type %d\n", VAR_6);

        return AVERROR_INVALIDDATA;

    }



    *VAR_2 = 1;

    *(AVFrame*)VAR_1 = s->frame;



    

    return VAR_5;

}

static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{ const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5       = VAR_3->size; AascContext *s     = VAR_0->priv_data; int VAR_6, VAR_7, VAR_8, VAR_9; s->frame.reference = 1; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if ((VAR_9 = VAR_0->reget_buffer(VAR_0, &s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "reget_buffer() failed\n"); return VAR_9; } VAR_6     = AV_RL32(VAR_4); VAR_4      += 4; VAR_5 -= 4; switch (VAR_6) { case 0:
VAR_8 = (VAR_0->width * 3 + 3) & ~3; for (VAR_7 = VAR_0->height - 1; VAR_7 >= 0; VAR_7--) { memcpy(s->frame.VAR_1[0] + VAR_7 * s->frame.linesize[0], VAR_4, VAR_0->width * 3); VAR_4 += VAR_8; } break; case 1:
bytestream2_init(&s->gb, VAR_4 - 4, VAR_5 + 4); ff_msrle_decode(VAR_0, (AVPicture*)&s->frame, 8, &s->gb); break; default:
av_log(VAR_0, AV_LOG_ERROR, "Unknown compression type %d\n", VAR_6); return AVERROR_INVALIDDATA; } *VAR_2 = 1; *(AVFrame*)VAR_1 = s->frame; return VAR_5; }