static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
                                  int *got_frame, uint8_t *data_start,
                                  unsigned int data_size)
{
    WebPContext *s = avctx->priv_data;
    AVPacket pkt;
    int ret;
    if (!s->initialized) {
        ff_vp8_decode_init(avctx);
        s->initialized = 1;
    }
    avctx->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
    s->lossless = 0;
    if (data_size > INT_MAX) {
        av_log(avctx, AV_LOG_ERROR, "unsupported chunk size\n");
        return AVERROR_PATCHWELCOME;
    }
    av_init_packet(&pkt);
    pkt.data = data_start;
    pkt.size = data_size;
    ret = ff_vp8_decode_frame(avctx, p, got_frame, &pkt);
    if (ret < 0)
        return ret;
    update_canvas_size(avctx, avctx->width, avctx->height);
    if (s->has_alpha) {
        ret = vp8_lossy_decode_alpha(avctx, p, s->alpha_data,
                                     s->alpha_data_size);
        if (ret < 0)
            return ret;
    }
    return ret;
}
static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
                                  int *got_frame, uint8_t *data_start,
                                  unsigned int data_size)
{
    WebPContext *s = avctx->priv_data;
    AVPacket pkt;
    int ret;
    if (!s->initialized) {
        ff_vp8_decode_init(avctx);
        s->initialized = 1;
    }
    avctx->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
    s->lossless = 0;
    if (data_size > INT_MAX) {
        av_log(avctx, AV_LOG_ERROR, "unsupported chunk size\n");
        return AVERROR_PATCHWELCOME;
    }
    av_init_packet(&pkt);
    pkt.data = data_start;
    pkt.size = data_size;
    ret = ff_vp8_decode_frame(avctx, p, got_frame, &pkt);
    if (ret < 0)
        return ret;
    update_canvas_size(avctx, avctx->width, avctx->height);
    if (s->has_alpha) {
        ret = vp8_lossy_decode_alpha(avctx, p, s->alpha_data,
                                     s->alpha_data_size);
        if (ret < 0)
            return ret;
    }
    return ret;
}
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,
                                  int *VAR_2, uint8_t *VAR_3,
                                  unsigned int VAR_4)
{
    WebPContext *s = VAR_0->priv_data;
    AVPacket pkt;
    int VAR_5;
    if (!s->initialized) {
        ff_vp8_decode_init(VAR_0);
        s->initialized = 1;
    }
    VAR_0->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
    s->lossless = 0;
    if (VAR_4 > INT_MAX) {
        av_log(VAR_0, AV_LOG_ERROR, "unsupported chunk size\n");
        return AVERROR_PATCHWELCOME;
    }
    av_init_packet(&pkt);
    pkt.data = VAR_3;
    pkt.size = VAR_4;
    VAR_5 = ff_vp8_decode_frame(VAR_0, VAR_1, VAR_2, &pkt);
    if (VAR_5 < 0)
        return VAR_5;
    update_canvas_size(VAR_0, VAR_0->width, VAR_0->height);
    if (s->has_alpha) {
        VAR_5 = vp8_lossy_decode_alpha(VAR_0, VAR_1, s->alpha_data,
                                     s->alpha_data_size);
        if (VAR_5 < 0)
            return VAR_5;
    }
    return VAR_5;
}
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,
int *VAR_2, uint8_t *VAR_3,
unsigned int VAR_4)
{ WebPContext *s = VAR_0->priv_data; AVPacket pkt; int VAR_5; if (!s->initialized) { ff_vp8_decode_init(VAR_0); s->initialized = 1; } VAR_0->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P; s->lossless = 0; if (VAR_4 > INT_MAX) { av_log(VAR_0, AV_LOG_ERROR, "unsupported chunk size\n"); return AVERROR_PATCHWELCOME; } av_init_packet(&pkt); pkt.data = VAR_3; pkt.size = VAR_4; VAR_5 = ff_vp8_decode_frame(VAR_0, VAR_1, VAR_2, &pkt); if (VAR_5 < 0)
return VAR_5; update_canvas_size(VAR_0, VAR_0->width, VAR_0->height); if (s->has_alpha) { VAR_5 = vp8_lossy_decode_alpha(VAR_0, VAR_1, s->alpha_data,
s->alpha_data_size); if (VAR_5 < 0)
return VAR_5; } return VAR_5; }