Rename elementSize as pixelSize for consistency
Some checks are pending
CMake / build (cmake, aarch64-linux-gnu-gcc, -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/aarch64_toolchain.cmake, aarch64-linux-gnu-g++, ubuntu-latest-cross-aarch64-cmake, ubuntu-latest) (push) Waiting to run
CMake / build (cmake, arm-linux-gnueabihf-gcc, -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/aarch32_toolchain.cmake, arm-linux-gnueabihf-g++, ubuntu-latest-cross-aarch32-cmake, ubuntu-latest) (push) Waiting to run
CMake / build (cmake, clang, , clang++, macos-latest-clang-cmake, macos-latest) (push) Waiting to run
CMake / build (cmake, clang, , clang++, ubuntu-24.04-arm-clang-cmake, ubuntu-24.04-arm) (push) Waiting to run
CMake / build (cmake, clang, , clang++, ubuntu-latest-clang-cmake, ubuntu-latest) (push) Waiting to run
CMake / build (cmake, clang, -DSANITIZE=fuzzer-no-link,address, clang++, ubuntu-latest-clang-cmake-asan-fuzzer, ubuntu-latest) (push) Waiting to run
CMake / build (cmake, clang, -G Ninja, clang++, ubuntu-latest-clang-cmake-ninja, ubuntu-latest) (push) Waiting to run
CMake / build (cmake, gcc, , g++, ubuntu-latest-gcc-cmake, ubuntu-latest) (push) Waiting to run

This commit is contained in:
Harish Mahendrakar 2026-09-04 12:48:09 -07:00 • committed by Harish Mahendrakar
parent c7ef7d1081
commit 93bbbf9b67
2 changed files with 15 additions and 15 deletions

View file

@ -216,37 +216,37 @@ void Codec::allocFrame() {
size_t aligned_wd = (mWidth + 1) & ~1;
size_t aligned_ht = (mHeight + 1) & ~1;
size_t elementSize = (mBitDepth > 8) ? 2 : 1;
size_t pixelSize = (mBitDepth > 8) ? 2 : 1;
switch (mColorFormat) {
case IV_YUV_420SP_UV:
[[fallthrough]];
case IV_YUV_420SP_VU:
sizes[0] = mWidth * mHeight * elementSize;
sizes[1] = ((aligned_wd * aligned_ht) >> 1) * elementSize;
sizes[0] = mWidth * mHeight * pixelSize;
sizes[1] = ((aligned_wd * aligned_ht) >> 1) * pixelSize;
num_bufs = 2;
break;
case IV_GRAY:
sizes[0] = mWidth * mHeight * elementSize;
sizes[0] = mWidth * mHeight * pixelSize;
num_bufs = 1;
break;
case IV_YUV_444P:
sizes[0] = (mWidth * mHeight) * elementSize;
sizes[1] = (mWidth * mHeight) * elementSize;
sizes[2] = (mWidth * mHeight) * elementSize;
sizes[0] = (mWidth * mHeight) * pixelSize;
sizes[1] = (mWidth * mHeight) * pixelSize;
sizes[2] = (mWidth * mHeight) * pixelSize;
num_bufs = 3;
break;
case IV_YUV_422P:
sizes[0] = (mWidth * mHeight) * elementSize;
sizes[1] = ((aligned_wd * mHeight) >> 1) * elementSize;
sizes[2] = ((aligned_wd * mHeight) >> 1) * elementSize;
sizes[0] = (mWidth * mHeight) * pixelSize;
sizes[1] = ((aligned_wd * mHeight) >> 1) * pixelSize;
sizes[2] = ((aligned_wd * mHeight) >> 1) * pixelSize;
num_bufs = 3;
break;
case IV_YUV_420P:
[[fallthrough]];
default:
sizes[0] = mWidth * mHeight * elementSize;
sizes[1] = ((aligned_wd * aligned_ht) >> 2) * elementSize;
sizes[2] = ((aligned_wd * aligned_ht) >> 2) * elementSize;
sizes[0] = mWidth * mHeight * pixelSize;
sizes[1] = ((aligned_wd * aligned_ht) >> 2) * pixelSize;
sizes[2] = ((aligned_wd * aligned_ht) >> 2) * pixelSize;
num_bufs = 3;
break;
}

View file

@ -93,7 +93,7 @@ bool RawBuf::allocBuffer(size_t width, size_t height, size_t bitDepth,
mOffsets[i] = 0;
}
size_t elementSize = (mBitDepth + 7) / 8;
size_t pixelSize = (mBitDepth + 7) / 8;
for (size_t i = 0; i < planesCount; ++i) {
size_t w = planeWidth(i);
size_t h = planeHeight(i);
@ -102,7 +102,7 @@ bool RawBuf::allocBuffer(size_t width, size_t height, size_t bitDepth,
size_t alignedStride = (w + alignment - 1) & ~(alignment - 1);
mStrides[i] = alignedStride;
mOffsets[i] = totalSize;
totalSize += alignedStride * h * elementSize;
totalSize += alignedStride * h * pixelSize;
}
mStorage.resize(totalSize);