private void unrefShortTerm(int shortNo) { int ind = SliceDecoder.wrap(firstSliceHeader.frame_num - shortNo, 1 << (firstSliceHeader.sps.log2_max_frame_num_minus4 + 4)); releaseRef(vdecoder.sRefs[ind]); vdecoder.sRefs[ind] = null; }
private void convert(int shortNo, int longNo) { int ind = SliceDecoder.wrap(firstSliceHeader.frame_num - shortNo, 1 << (firstSliceHeader.sps.log2_max_frame_num_minus4 + 4)); releaseRef(vdecoder.lRefs[longNo]); vdecoder.lRefs.Add(longNo, vdecoder.sRefs[ind]); vdecoder.sRefs[ind] = null; vdecoder.lRefs[(longNo)].setShortTerm(false); }
private Frame init(int[][] buffer, MemoryStream segment, NALUnit marker) { firstNu = marker; shr = new SliceHeaderReader(); BitReader br = new BitReader(segment.duplicate()); firstSliceHeader = shr.readPart1(br); activePps = vdecoder.pps[firstSliceHeader.pic_parameter_set_id]; activeSps = vdecoder.sps[activePps.seq_parameter_set_id]; shr.readPart2(firstSliceHeader, marker, activeSps, activePps, br); int picWidthInMbs = activeSps.pic_width_in_mbs_minus1 + 1; int picHeightInMbs = Utility.getPicHeightInMbs(activeSps); int[][] nCoeff = (int[][])Array.CreateInstance(typeof(int), new int[] { picHeightInMbs << 2, picWidthInMbs << 2 }); //new int[picHeightInMbs << 2][picWidthInMbs << 2]; mvs = (int[][][][])Array.CreateInstance(typeof(int), new int[] { 2, picHeightInMbs << 2, picWidthInMbs << 2, 3 }); //new int[2][picHeightInMbs << 2][picWidthInMbs << 2][3]; MBType[] mbTypes = new MBType[picHeightInMbs * picWidthInMbs]; bool[] tr8x8Used = new bool[picHeightInMbs * picWidthInMbs]; int[][] mbQps = (int[][])Array.CreateInstance(typeof(int), new int[] { 3, picHeightInMbs * picWidthInMbs });//new int[3][picHeightInMbs * picWidthInMbs]; SliceHeader[] shs = new SliceHeader[picHeightInMbs * picWidthInMbs]; Frame[][][] refsUsed = new Frame[picHeightInMbs * picWidthInMbs][][]; if (vdecoder.sRefs == null) { vdecoder.sRefs = new Frame[1 << (firstSliceHeader.sps.log2_max_frame_num_minus4 + 4)]; vdecoder.lRefs = new Dictionary <int, Frame>(); } Frame result = createFrame(activeSps, buffer, firstSliceHeader.frame_num, mvs, refsUsed, vdecoder.poc.calcPOC(firstSliceHeader, firstNu)); decoder = new SliceDecoder(activeSps, activePps, nCoeff, mvs, mbTypes, mbQps, shs, tr8x8Used, refsUsed, result, vdecoder.sRefs, vdecoder.lRefs); decoder.setDebug(vdecoder.debug); filter = new DeblockingFilter(picWidthInMbs, activeSps.bit_depth_chroma_minus8 + 8, nCoeff, mvs, mbTypes, mbQps, shs, tr8x8Used, refsUsed); return(result); }