static int aasc_decode_frame(AVCodecContext *avctx,

                              void *data, int *data_size,

                              AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    AascContext *s = avctx->priv_data;

    int compr, i, stride;



    s->frame.reference = 3;

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

    if (avctx->reget_buffer(avctx, &s->frame)) {

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

        return -1;

    }



    compr = AV_RL32(buf);

    buf += 4;

    buf_size -= 4;

    switch (avctx->codec_tag) {

    case MKTAG('A', 'A', 'S', '4'):

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

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

        break;

    case MKTAG('A', 'A', 'S', 'C'):

    switch(compr){

    case 0:

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

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

            if(avctx->width*3 > buf_size){

                av_log(avctx, AV_LOG_ERROR, "Next line is beyond buffer bounds\n");

                break;

            }

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

            buf += stride;

            buf_size -= stride;

        }

        break;

    case 1:

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

        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 -1;

    }

        break;

    default:

        av_log(avctx, AV_LOG_ERROR, "Unknown FourCC: %X\n", avctx->codec_tag);

        return -1;

    }



    *data_size = sizeof(AVFrame);

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



    /* report that the buffer was completely consumed */

    return buf_size;

}

static int aasc_decode_frame(AVCodecContext *avctx,

                              void *data, int *data_size,

                              AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    AascContext *s = avctx->priv_data;

    int compr, i, stride;



    s->frame.reference = 3;

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

    if (avctx->reget_buffer(avctx, &s->frame)) {

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

        return -1;

    }



    compr = AV_RL32(buf);

    buf += 4;

    buf_size -= 4;

    switch (avctx->codec_tag) {

    case MKTAG('A', 'A', 'S', '4'):

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

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

        break;

    case MKTAG('A', 'A', 'S', 'C'):

    switch(compr){

    case 0:

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

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

            if(avctx->width*3 > buf_size){

                av_log(avctx, AV_LOG_ERROR, "Next line is beyond buffer bounds\n");

                break;

            }

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

            buf += stride;

            buf_size -= stride;

        }

        break;

    case 1:

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

        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 -1;

    }

        break;

    default:

        av_log(avctx, AV_LOG_ERROR, "Unknown FourCC: %X\n", avctx->codec_tag);

        return -1;

    }



    *data_size = sizeof(AVFrame);

    *(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;



    s->frame.reference = 3;

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

    if (VAR_0->reget_buffer(VAR_0, &s->frame)) {

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

        return -1;

    }



    VAR_6 = AV_RL32(VAR_4);

    VAR_4 += 4;

    VAR_5 -= 4;

    switch (VAR_0->codec_tag) {

    case MKTAG('A', 'A', 'S', '4'):

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

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

        break;

    case MKTAG('A', 'A', 'S', 'C'):

    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--){

            if(VAR_0->width*3 > VAR_5){

                av_log(VAR_0, AV_LOG_ERROR, "Next line is beyond buffer bounds\n");

                break;

            }

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

            VAR_4 += VAR_8;

            VAR_5 -= VAR_8;

        }

        break;

    case 1:

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

        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 -1;

    }

        break;

    default:

        av_log(VAR_0, AV_LOG_ERROR, "Unknown FourCC: %X\n", VAR_0->codec_tag);

        return -1;

    }



    *VAR_2 = sizeof(AVFrame);

    *(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; s->frame.reference = 3; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if (VAR_0->reget_buffer(VAR_0, &s->frame)) { av_log(VAR_0, AV_LOG_ERROR, "reget_buffer() failed\n"); return -1; } VAR_6 = AV_RL32(VAR_4); VAR_4 += 4; VAR_5 -= 4; switch (VAR_0->codec_tag) { case MKTAG('A', 'A', 'S', '4'):
bytestream2_init(&s->gb, VAR_4 - 4, VAR_5 + 4); ff_msrle_decode(VAR_0, (AVPicture*)&s->frame, 8, &s->gb); break; case MKTAG('A', 'A', 'S', 'C'):
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--){ if(VAR_0->width*3 > VAR_5){ av_log(VAR_0, AV_LOG_ERROR, "Next line is beyond buffer bounds\n"); break; } memcpy(s->frame.VAR_1[0] + VAR_7*s->frame.linesize[0], VAR_4, VAR_0->width*3); VAR_4 += VAR_8; VAR_5 -= VAR_8; } break; case 1:
bytestream2_init(&s->gb, VAR_4, VAR_5); 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 -1; } break; default:
av_log(VAR_0, AV_LOG_ERROR, "Unknown FourCC: %X\n", VAR_0->codec_tag); return -1; } *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = s->frame; return VAR_5; }