Skip to content

Commit

Permalink
Bug 1778405 - Correct Cb, Cr in YUVBufferGenerator::CreateNV{12,21}Im…
Browse files Browse the repository at this point in the history
…age() r=jgilbert,jolin

The first element in the NV12's UV plane and NV21's one should be mapped
to Cb and Cr respectively.

Differential Revision: https://phabricator.services.mozilla.com/D151186
  • Loading branch information
ChunMinChang committed Jul 19, 2022
1 parent ab3e31f commit b12089a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions dom/media/gtest/YUVBufferGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ Image* YUVBufferGenerator::CreateI420Image() {
data.mYStride = mImageSize.width;
data.mYSkip = 0;

// Cr plane.
// Cr plane (aka V).
uint8_t* cr = y + yPlaneSize + uvPlaneSize;
data.mCrChannel = cr;
data.mCrSkip = 0;

// Cb plane
// Cb plane (aka U).
uint8_t* cb = y + yPlaneSize;
data.mCbChannel = cb;
data.mCbSkip = 0;
Expand Down Expand Up @@ -92,16 +92,16 @@ Image* YUVBufferGenerator::CreateNV12Image() {
data.mYStride = mImageSize.width;
data.mYSkip = 0;

// Cr plane.
uint8_t* cr = y + yPlaneSize;
data.mCrChannel = cr;
data.mCrSkip = 1;

// Cb plane
uint8_t* cb = y + yPlaneSize + 1;
// Cb plane (aka U).
uint8_t* cb = y + yPlaneSize;
data.mCbChannel = cb;
data.mCbSkip = 1;

// Cr plane (aka V).
uint8_t* cr = y + yPlaneSize + 1;
data.mCrChannel = cr;
data.mCrSkip = 1;

// 4:2:0.
data.mCbCrStride = mImageSize.width;
data.mChromaSubsampling = gfx::ChromaSubsampling::HALF_WIDTH_AND_HEIGHT;
Expand All @@ -123,16 +123,16 @@ Image* YUVBufferGenerator::CreateNV21Image() {
data.mYStride = mImageSize.width;
data.mYSkip = 0;

// Cr plane.
uint8_t* cr = y + yPlaneSize + 1;
data.mCrChannel = cr;
data.mCrSkip = 1;

// Cb plane
uint8_t* cb = y + yPlaneSize;
// Cb plane (aka U).
uint8_t* cb = y + yPlaneSize + 1;
data.mCbChannel = cb;
data.mCbSkip = 1;

// Cr plane (aka V).
uint8_t* cr = y + yPlaneSize;
data.mCrChannel = cr;
data.mCrSkip = 1;

// 4:2:0.
data.mCbCrStride = mImageSize.width;
data.mChromaSubsampling = gfx::ChromaSubsampling::HALF_WIDTH_AND_HEIGHT;
Expand Down

0 comments on commit b12089a

Please sign in to comment.