static void dvbsub_parse_object_segment(AVCodecContext *avctx,

                                        const uint8_t *buf, int buf_size)

{

    DVBSubContext *ctx = avctx->priv_data;



    const uint8_t *buf_end = buf + buf_size;

    const uint8_t *block;

    int object_id;

    DVBSubObject *object;

    DVBSubObjectDisplay *display;

    int top_field_len, bottom_field_len;



    int coding_method, non_modifying_color;



    object_id = AV_RB16(buf);

    buf += 2;



    object = get_object(ctx, object_id);



    if (!object)

        return;



    coding_method = ((*buf) >> 2) & 3;

    non_modifying_color = ((*buf++) >> 1) & 1;



    if (coding_method == 0) {

        top_field_len = AV_RB16(buf);

        buf += 2;

        bottom_field_len = AV_RB16(buf);

        buf += 2;



        if (buf + top_field_len + bottom_field_len > buf_end) {

            av_log(avctx, AV_LOG_ERROR, "Field data size too large\n");

            return;

        }



        for (display = object->display_list; display; display = display->object_list_next) {

            block = buf;



            dvbsub_parse_pixel_data_block(avctx, display, block, top_field_len, 0,

                                            non_modifying_color);



            if (bottom_field_len > 0)

                block = buf + top_field_len;

            else

                bottom_field_len = top_field_len;



            dvbsub_parse_pixel_data_block(avctx, display, block, bottom_field_len, 1,

                                            non_modifying_color);

        }



/*  } else if (coding_method == 1) {*/



    } else {

        av_log(avctx, AV_LOG_ERROR, "Unknown object coding %d\n", coding_method);

    }



}

static void dvbsub_parse_object_segment(AVCodecContext *avctx,

                                        const uint8_t *buf, int buf_size)

{

    DVBSubContext *ctx = avctx->priv_data;



    const uint8_t *buf_end = buf + buf_size;

    const uint8_t *block;

    int object_id;

    DVBSubObject *object;

    DVBSubObjectDisplay *display;

    int top_field_len, bottom_field_len;



    int coding_method, non_modifying_color;



    object_id = AV_RB16(buf);

    buf += 2;



    object = get_object(ctx, object_id);



    if (!object)

        return;



    coding_method = ((*buf) >> 2) & 3;

    non_modifying_color = ((*buf++) >> 1) & 1;



    if (coding_method == 0) {

        top_field_len = AV_RB16(buf);

        buf += 2;

        bottom_field_len = AV_RB16(buf);

        buf += 2;



        if (buf + top_field_len + bottom_field_len > buf_end) {

            av_log(avctx, AV_LOG_ERROR, "Field data size too large\n");

            return;

        }



        for (display = object->display_list; display; display = display->object_list_next) {

            block = buf;



            dvbsub_parse_pixel_data_block(avctx, display, block, top_field_len, 0,

                                            non_modifying_color);



            if (bottom_field_len > 0)

                block = buf + top_field_len;

            else

                bottom_field_len = top_field_len;



            dvbsub_parse_pixel_data_block(avctx, display, block, bottom_field_len, 1,

                                            non_modifying_color);

        }







    } else {

        av_log(avctx, AV_LOG_ERROR, "Unknown object coding %d\n", coding_method);

    }



}

static void FUNC_0(AVCodecContext *VAR_0,

                                        const uint8_t *VAR_1, int VAR_2)

{

    DVBSubContext *ctx = VAR_0->priv_data;



    const uint8_t *VAR_3 = VAR_1 + VAR_2;

    const uint8_t *VAR_4;

    int VAR_5;

    DVBSubObject *object;

    DVBSubObjectDisplay *display;

    int VAR_6, VAR_7;



    int VAR_8, VAR_9;



    VAR_5 = AV_RB16(VAR_1);

    VAR_1 += 2;



    object = get_object(ctx, VAR_5);



    if (!object)

        return;



    VAR_8 = ((*VAR_1) >> 2) & 3;

    VAR_9 = ((*VAR_1++) >> 1) & 1;



    if (VAR_8 == 0) {

        VAR_6 = AV_RB16(VAR_1);

        VAR_1 += 2;

        VAR_7 = AV_RB16(VAR_1);

        VAR_1 += 2;



        if (VAR_1 + VAR_6 + VAR_7 > VAR_3) {

            av_log(VAR_0, AV_LOG_ERROR, "Field data size too large\n");

            return;

        }



        for (display = object->display_list; display; display = display->object_list_next) {

            VAR_4 = VAR_1;



            dvbsub_parse_pixel_data_block(VAR_0, display, VAR_4, VAR_6, 0,

                                            VAR_9);



            if (VAR_7 > 0)

                VAR_4 = VAR_1 + VAR_6;

            else

                VAR_7 = VAR_6;



            dvbsub_parse_pixel_data_block(VAR_0, display, VAR_4, VAR_7, 1,

                                            VAR_9);

        }







    } else {

        av_log(VAR_0, AV_LOG_ERROR, "Unknown object coding %d\n", VAR_8);

    }



}

static void FUNC_0(AVCodecContext *VAR_0,
const uint8_t *VAR_1, int VAR_2)
{ DVBSubContext *ctx = VAR_0->priv_data; const uint8_t *VAR_3 = VAR_1 + VAR_2; const uint8_t *VAR_4; int VAR_5; DVBSubObject *object; DVBSubObjectDisplay *display; int VAR_6, VAR_7; int VAR_8, VAR_9; VAR_5 = AV_RB16(VAR_1); VAR_1 += 2; object = get_object(ctx, VAR_5); if (!object)
return; VAR_8 = ((*VAR_1) >> 2) & 3; VAR_9 = ((*VAR_1++) >> 1) & 1; if (VAR_8 == 0) { VAR_6 = AV_RB16(VAR_1); VAR_1 += 2; VAR_7 = AV_RB16(VAR_1); VAR_1 += 2; if (VAR_1 + VAR_6 + VAR_7 > VAR_3) { av_log(VAR_0, AV_LOG_ERROR, "Field data size too large\n"); return; } for (display = object->display_list; display; display = display->object_list_next) { VAR_4 = VAR_1; dvbsub_parse_pixel_data_block(VAR_0, display, VAR_4, VAR_6, 0,
VAR_9); if (VAR_7 > 0)
VAR_4 = VAR_1 + VAR_6; else
VAR_7 = VAR_6; dvbsub_parse_pixel_data_block(VAR_0, display, VAR_4, VAR_7, 1,
VAR_9); } } else { av_log(VAR_0, AV_LOG_ERROR, "Unknown object coding %d\n", VAR_8); } }