Example #1
0
        private void writeDecRefPicMarking(SliceHeader sliceHeader, bool idrSlice, BitWriter writer)
        {
            if (idrSlice)
            {
                RefPicMarkingIDR drpmidr = sliceHeader.refPicMarkingIDR;
                CAVLCWriter.writeBool(writer, drpmidr.isDiscardDecodedPics(), "SH: no_output_of_prior_pics_flag");
                CAVLCWriter.writeBool(writer, drpmidr.isUseForlongTerm(), "SH: long_term_reference_flag");
            }
            else
            {
                CAVLCWriter.writeBool(writer, sliceHeader.refPicMarkingNonIDR != null, "SH: adaptive_ref_pic_marking_mode_flag");
                if (sliceHeader.refPicMarkingNonIDR != null)
                {
                    RefPicMarking drpmidr = sliceHeader.refPicMarkingNonIDR;
                    foreach (var mmop in drpmidr.getInstructions())
                    {
                        switch (mmop.getType())
                        {
                        case RefPicMarking.InstrType.REMOVE_SHORT:
                            CAVLCWriter.writeUE(writer, 1, "SH: memory_management_control_operation");
                            CAVLCWriter.writeUE(writer, mmop.getArg1() - 1, "SH: difference_of_pic_nums_minus1");
                            break;

                        case RefPicMarking.InstrType.REMOVE_LONG:
                            CAVLCWriter.writeUE(writer, 2, "SH: memory_management_control_operation");
                            CAVLCWriter.writeUE(writer, mmop.getArg1(), "SH: long_term_pic_num");
                            break;

                        case RefPicMarking.InstrType.CONVERT_INTO_LONG:
                            CAVLCWriter.writeUE(writer, 3, "SH: memory_management_control_operation");
                            CAVLCWriter.writeUE(writer, mmop.getArg1() - 1, "SH: difference_of_pic_nums_minus1");
                            CAVLCWriter.writeUE(writer, mmop.getArg2(), "SH: long_term_frame_idx");
                            break;

                        case RefPicMarking.InstrType.TRUNK_LONG:
                            CAVLCWriter.writeUE(writer, 4, "SH: memory_management_control_operation");
                            CAVLCWriter.writeUE(writer, mmop.getArg1() + 1, "SH: max_long_term_frame_idx_plus1");
                            break;

                        case RefPicMarking.InstrType.CLEAR:
                            CAVLCWriter.writeUE(writer, 5, "SH: memory_management_control_operation");
                            break;

                        case RefPicMarking.InstrType.MARK_LONG:
                            CAVLCWriter.writeUE(writer, 6, "SH: memory_management_control_operation");
                            CAVLCWriter.writeUE(writer, mmop.getArg1(), "SH: long_term_frame_idx");
                            break;
                        }
                    }
                    CAVLCWriter.writeUE(writer, 0, "SH: memory_management_control_operation");
                }
            }
        }
Example #2
0
            public void performIDRMarking(RefPicMarkingIDR refPicMarkingIDR, Frame picture)
            {
                clearAll();
                vdecoder.pictureBuffer.Clear();

                Frame saved = saveRef(picture);

                if (refPicMarkingIDR.isUseForlongTerm())
                {
                    vdecoder.lRefs.Add(0, saved);
                    saved.setShortTerm(false);
                }
                else
                {
                    vdecoder.sRefs[firstSliceHeader.frame_num] = saved;
                }
            }