static void parse_palette_segment(AVCodecContext *avctx,

                                  const uint8_t *buf, int buf_size)

{

    PGSSubContext *ctx = avctx->priv_data;



    const uint8_t *buf_end = buf + buf_size;

    const uint8_t *cm      = ff_crop_tab + MAX_NEG_CROP;

    int color_id;

    int y, cb, cr, alpha;

    int r, g, b, r_add, g_add, b_add;



    /* Skip two null bytes */

    buf += 2;



    while (buf < buf_end) {

        color_id  = bytestream_get_byte(&buf);

        y         = bytestream_get_byte(&buf);

        cr        = bytestream_get_byte(&buf);

        cb        = bytestream_get_byte(&buf);

        alpha     = bytestream_get_byte(&buf);



        YUV_TO_RGB1(cb, cr);

        YUV_TO_RGB2(r, g, b, y);



        av_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);



        /* Store color in palette */

        ctx->clut[color_id] = RGBA(r,g,b,alpha);

    }

}

static void parse_palette_segment(AVCodecContext *avctx,

                                  const uint8_t *buf, int buf_size)

{

    PGSSubContext *ctx = avctx->priv_data;



    const uint8_t *buf_end = buf + buf_size;

    const uint8_t *cm      = ff_crop_tab + MAX_NEG_CROP;

    int color_id;

    int y, cb, cr, alpha;

    int r, g, b, r_add, g_add, b_add;



    

    buf += 2;



    while (buf < buf_end) {

        color_id  = bytestream_get_byte(&buf);

        y         = bytestream_get_byte(&buf);

        cr        = bytestream_get_byte(&buf);

        cb        = bytestream_get_byte(&buf);

        alpha     = bytestream_get_byte(&buf);



        YUV_TO_RGB1(cb, cr);

        YUV_TO_RGB2(r, g, b, y);



        av_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);



        

        ctx->clut[color_id] = RGBA(r,g,b,alpha);

    }

}

static void FUNC_0(AVCodecContext *VAR_0,

                                  const uint8_t *VAR_1, int VAR_2)

{

    PGSSubContext *ctx = VAR_0->priv_data;



    const uint8_t *VAR_3 = VAR_1 + VAR_2;

    const uint8_t *VAR_4      = ff_crop_tab + MAX_NEG_CROP;

    int VAR_5;

    int VAR_6, VAR_7, VAR_8, VAR_9;

    int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15;



    

    VAR_1 += 2;



    while (VAR_1 < VAR_3) {

        VAR_5  = bytestream_get_byte(&VAR_1);

        VAR_6         = bytestream_get_byte(&VAR_1);

        VAR_8        = bytestream_get_byte(&VAR_1);

        VAR_7        = bytestream_get_byte(&VAR_1);

        VAR_9     = bytestream_get_byte(&VAR_1);



        YUV_TO_RGB1(VAR_7, VAR_8);

        YUV_TO_RGB2(VAR_10, VAR_11, VAR_12, VAR_6);



        av_dlog(VAR_0, "Color %d := (%d,%d,%d,%d)\n", VAR_5, VAR_10, VAR_11, VAR_12, VAR_9);



        

        ctx->clut[VAR_5] = RGBA(VAR_10,VAR_11,VAR_12,VAR_9);

    }

}

static void FUNC_0(AVCodecContext *VAR_0,
const uint8_t *VAR_1, int VAR_2)
{ PGSSubContext *ctx = VAR_0->priv_data; const uint8_t *VAR_3 = VAR_1 + VAR_2; const uint8_t *VAR_4      = ff_crop_tab + MAX_NEG_CROP; int VAR_5; int VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15; VAR_1 += 2; while (VAR_1 < VAR_3) { VAR_5  = bytestream_get_byte(&VAR_1); VAR_6         = bytestream_get_byte(&VAR_1); VAR_8        = bytestream_get_byte(&VAR_1); VAR_7        = bytestream_get_byte(&VAR_1); VAR_9     = bytestream_get_byte(&VAR_1); YUV_TO_RGB1(VAR_7, VAR_8); YUV_TO_RGB2(VAR_10, VAR_11, VAR_12, VAR_6); av_dlog(VAR_0, "Color %d := (%d,%d,%d,%d)\n", VAR_5, VAR_10, VAR_11, VAR_12, VAR_9); ctx->clut[VAR_5] = RGBA(VAR_10,VAR_11,VAR_12,VAR_9); } }