Example #1
0
        public int ff_h264_decode_ref_pic_marking(GetBitContext gb)
        {
            int i;

            this.mmco_index = 0;
            if (this.nal_unit_type == NAL_IDR_SLICE)
            { //FIXME fields
                s.broken_link = (int)gb.get_bits1("broken_link") - 1;
                if (gb.get_bits1("MMCO_LONG?") != 0)
                {
                    this.mmco[0].opcode = MMCO.MMCO_LONG;
                    this.mmco[0].long_arg = 0;
                    this.mmco_index = 1;
                }
            }
            else
            {
                if (gb.get_bits1("adaptive_ref_pic_marking_mode_flag") != 0)
                { // adaptive_ref_pic_marking_mode_flag
                    for (i = 0; i < MAX_MMCO_COUNT; i++)
                    {
                        /*MMCOOpcode*/
                        int opcode = gb.get_ue_golomb_31("MMCOOpcode");

                        this.mmco[i].opcode = opcode;
                        if (opcode == MMCO.MMCO_SHORT2UNUSED || opcode == MMCO.MMCO_SHORT2LONG)
                        {
                            this.mmco[i].short_pic_num = (this.curr_pic_num - gb.get_ue_golomb("?") - 1) & (this.max_pic_num - 1);
                            /*                    if(this.mmco[i].short_pic_num >= this.short_ref_count || this.short_ref[ this.mmco[i].short_pic_num ] == NULL){
                                                    av_log(s.avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco);
                                                    return -1;
                                                }*/
                        }
                        if (opcode == MMCO.MMCO_SHORT2LONG || opcode == MMCO.MMCO_LONG2UNUSED || opcode == MMCO.MMCO_LONG || opcode == MMCO.MMCO_SET_MAX_LONG)
                        {
                            /*unsigned */
                            int long_arg = gb.get_ue_golomb_31("long_arg");
                            if (long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO.MMCO_LONG2UNUSED && (s.picture_structure != Constants.PICT_FRAME))))
                            {
                                //av_log(this.s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode);
                                return -58;
                            }
                            this.mmco[i].long_arg = long_arg;
                        }

                        if (opcode > /*(unsigned)*/MMCO.MMCO_LONG)
                        {
                            //av_log(this.s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode);
                            return -59;
                        }
                        if (opcode == MMCO.MMCO_END)
                            break;
                    }
                    this.mmco_index = i;
                }
                else
                {
                    this.ff_generate_sliding_window_mmcos();
                }
            }

            return 0;
        }