public override void Reconstruct(YuvFrameBuffer outFrameBuffer) { var x = macroblock.PixelX; var y = macroblock.PixelY; var cx = macroblock.PixelChromaX; var cy = macroblock.PixelChromaY; for (var j = 0; j < Macroblock.MbHeight; j++) for (var i = 0; i < Macroblock.MbWidth; i++) outFrameBuffer.SetY8Bit(i + x, j + y, bufferY[i][j]); for (var j = 0; j < Macroblock.MbChromaHeight; j++) for (var i = 0; i < Macroblock.MbChromaWidth; i++) outFrameBuffer.SetCb8Bit(i + cx, j + cy, bufferU[i][j]); for (var j = 0; j < Macroblock.MbChromaHeight; j++) for (var i = 0; i < Macroblock.MbChromaWidth; i++) outFrameBuffer.SetCr8Bit(i + cx, j + cy, bufferV[i][j]); }
public void Reconstruct(YuvFrameBuffer outFrameBuffer) { const int dqBits = 6; var mrInv = new int[mbHeight][]; for (var i = 0; i < mrInv.Length; i++) mrInv[i] = new int[mbWidth]; InverseTransform(mDc, mResd, mrInv); for (var j = 0; j < mbHeight; j++) { var jj = y + j; for (var i = 0; i < mbWidth; i++) { var ii = x + i; var predicted = mPred[j][i]; // Predicted sample var residualRecons = MathHelper.RshiftRound(mrInv[j][i], dqBits); // Reconstructed residual sample var originalRecons = residualRecons + predicted; // Reconstructed original sample originalRecons = MathHelper.Clip(maxImagePelValue, originalRecons); outFrameBuffer.SetY8Bit(ii, jj, originalRecons); } } }