Loading media/codec2/components/gav1/C2SoftGav1Dec.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <C2Debug.h> #include <C2PlatformSupport.h> #include <Codec2BufferUtils.h> #include <Codec2Mapper.h> #include <SimpleC2Interface.h> #include <log/log.h> Loading Loading @@ -338,6 +339,7 @@ C2SoftGav1Dec::C2SoftGav1Dec(const char *name, c2_node_id_t id, std::make_shared<SimpleInterface<IntfImpl>>(name, id, intfImpl)), mIntf(intfImpl), mCodecCtx(nullptr) { mIsFormatR10G10B10A2Supported = IsFormatR10G10B10A2SupportedForLegacyRendering(); gettimeofday(&mTimeStart, nullptr); gettimeofday(&mTimeEnd, nullptr); } Loading Loading @@ -790,9 +792,16 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool, work->workletsProcessed = 1u; return false; } // TODO (b/201787956) For devices that do not support HAL_PIXEL_FORMAT_RGBA_1010102, // HAL_PIXEL_FORMAT_YV12 is used as a temporary work around. if (!mIsFormatR10G10B10A2Supported) { ALOGE("HAL_PIXEL_FORMAT_RGBA_1010102 isn't supported"); format = HAL_PIXEL_FORMAT_YV12; } else { format = HAL_PIXEL_FORMAT_RGBA_1010102; } } } C2MemoryUsage usage = {C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE}; c2_status_t err = pool->fetchGraphicBlock(align(mWidth, 16), mHeight, format, Loading media/codec2/components/gav1/C2SoftGav1Dec.h +1 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ struct C2SoftGav1Dec : public SimpleC2Component { struct timeval mTimeStart; // Time at the start of decode() struct timeval mTimeEnd; // Time at the end of decode() bool mIsFormatR10G10B10A2Supported; bool initDecoder(); void getVuiParams(const libgav1::DecoderBuffer *buffer); Loading media/codec2/components/vpx/C2SoftVpxDec.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <C2Debug.h> #include <C2PlatformSupport.h> #include <Codec2BufferUtils.h> #include <SimpleC2Interface.h> #include "C2SoftVpxDec.h" Loading Loading @@ -351,6 +352,7 @@ C2SoftVpxDec::C2SoftVpxDec( mCodecCtx(nullptr), mCoreCount(1), mQueue(new Mutexed<ConversionQueue>) { mIsFormatR10G10B10A2Supported = IsFormatR10G10B10A2SupportedForLegacyRendering(); } C2SoftVpxDec::~C2SoftVpxDec() { Loading Loading @@ -804,9 +806,16 @@ status_t C2SoftVpxDec::outputBuffer( if (defaultColorAspects->primaries == C2Color::PRIMARIES_BT2020 && defaultColorAspects->matrix == C2Color::MATRIX_BT2020 && defaultColorAspects->transfer == C2Color::TRANSFER_ST2084) { // TODO (b/201787956) For devices that do not support HAL_PIXEL_FORMAT_RGBA_1010102, // HAL_PIXEL_FORMAT_YV12 is used as a temporary work around. if (!mIsFormatR10G10B10A2Supported) { ALOGE("HAL_PIXEL_FORMAT_RGBA_1010102 isn't supported"); format = HAL_PIXEL_FORMAT_YV12; } else { format = HAL_PIXEL_FORMAT_RGBA_1010102; } } } C2MemoryUsage usage = { C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE }; c2_status_t err = pool->fetchGraphicBlock(align(mWidth, 16), mHeight, format, usage, &block); if (err != C2_OK) { Loading media/codec2/components/vpx/C2SoftVpxDec.h +1 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ struct C2SoftVpxDec : public SimpleC2Component { }; std::shared_ptr<Mutexed<ConversionQueue>> mQueue; std::vector<sp<ConverterThread>> mConverterThreads; bool mIsFormatR10G10B10A2Supported; status_t initDecoder(); status_t destroyDecoder(); void finishWork(uint64_t index, const std::unique_ptr<C2Work> &work, Loading media/codec2/sfplugin/utils/Codec2BufferUtils.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,22 @@ static status_t _ImageCopy(View &view, const MediaImage2 *img, ImagePixel *imgBa } // namespace bool IsFormatR10G10B10A2SupportedForLegacyRendering() { const AHardwareBuffer_Desc desc = { .width = 320, .height = 240, .format = AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM, .layers = 1, .usage = AHARDWAREBUFFER_USAGE_CPU_READ_RARELY | AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE, .stride = 0, .rfu0 = 0, .rfu1 = 0, }; return AHardwareBuffer_isSupported(&desc); } status_t ImageCopy(uint8_t *imgBase, const MediaImage2 *img, const C2GraphicView &view) { if (view.crop().width != img->mWidth || view.crop().height != img->mHeight) { return BAD_VALUE; Loading Loading
media/codec2/components/gav1/C2SoftGav1Dec.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <C2Debug.h> #include <C2PlatformSupport.h> #include <Codec2BufferUtils.h> #include <Codec2Mapper.h> #include <SimpleC2Interface.h> #include <log/log.h> Loading Loading @@ -338,6 +339,7 @@ C2SoftGav1Dec::C2SoftGav1Dec(const char *name, c2_node_id_t id, std::make_shared<SimpleInterface<IntfImpl>>(name, id, intfImpl)), mIntf(intfImpl), mCodecCtx(nullptr) { mIsFormatR10G10B10A2Supported = IsFormatR10G10B10A2SupportedForLegacyRendering(); gettimeofday(&mTimeStart, nullptr); gettimeofday(&mTimeEnd, nullptr); } Loading Loading @@ -790,9 +792,16 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool, work->workletsProcessed = 1u; return false; } // TODO (b/201787956) For devices that do not support HAL_PIXEL_FORMAT_RGBA_1010102, // HAL_PIXEL_FORMAT_YV12 is used as a temporary work around. if (!mIsFormatR10G10B10A2Supported) { ALOGE("HAL_PIXEL_FORMAT_RGBA_1010102 isn't supported"); format = HAL_PIXEL_FORMAT_YV12; } else { format = HAL_PIXEL_FORMAT_RGBA_1010102; } } } C2MemoryUsage usage = {C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE}; c2_status_t err = pool->fetchGraphicBlock(align(mWidth, 16), mHeight, format, Loading
media/codec2/components/gav1/C2SoftGav1Dec.h +1 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ struct C2SoftGav1Dec : public SimpleC2Component { struct timeval mTimeStart; // Time at the start of decode() struct timeval mTimeEnd; // Time at the end of decode() bool mIsFormatR10G10B10A2Supported; bool initDecoder(); void getVuiParams(const libgav1::DecoderBuffer *buffer); Loading
media/codec2/components/vpx/C2SoftVpxDec.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <C2Debug.h> #include <C2PlatformSupport.h> #include <Codec2BufferUtils.h> #include <SimpleC2Interface.h> #include "C2SoftVpxDec.h" Loading Loading @@ -351,6 +352,7 @@ C2SoftVpxDec::C2SoftVpxDec( mCodecCtx(nullptr), mCoreCount(1), mQueue(new Mutexed<ConversionQueue>) { mIsFormatR10G10B10A2Supported = IsFormatR10G10B10A2SupportedForLegacyRendering(); } C2SoftVpxDec::~C2SoftVpxDec() { Loading Loading @@ -804,9 +806,16 @@ status_t C2SoftVpxDec::outputBuffer( if (defaultColorAspects->primaries == C2Color::PRIMARIES_BT2020 && defaultColorAspects->matrix == C2Color::MATRIX_BT2020 && defaultColorAspects->transfer == C2Color::TRANSFER_ST2084) { // TODO (b/201787956) For devices that do not support HAL_PIXEL_FORMAT_RGBA_1010102, // HAL_PIXEL_FORMAT_YV12 is used as a temporary work around. if (!mIsFormatR10G10B10A2Supported) { ALOGE("HAL_PIXEL_FORMAT_RGBA_1010102 isn't supported"); format = HAL_PIXEL_FORMAT_YV12; } else { format = HAL_PIXEL_FORMAT_RGBA_1010102; } } } C2MemoryUsage usage = { C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE }; c2_status_t err = pool->fetchGraphicBlock(align(mWidth, 16), mHeight, format, usage, &block); if (err != C2_OK) { Loading
media/codec2/components/vpx/C2SoftVpxDec.h +1 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ struct C2SoftVpxDec : public SimpleC2Component { }; std::shared_ptr<Mutexed<ConversionQueue>> mQueue; std::vector<sp<ConverterThread>> mConverterThreads; bool mIsFormatR10G10B10A2Supported; status_t initDecoder(); status_t destroyDecoder(); void finishWork(uint64_t index, const std::unique_ptr<C2Work> &work, Loading
media/codec2/sfplugin/utils/Codec2BufferUtils.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,22 @@ static status_t _ImageCopy(View &view, const MediaImage2 *img, ImagePixel *imgBa } // namespace bool IsFormatR10G10B10A2SupportedForLegacyRendering() { const AHardwareBuffer_Desc desc = { .width = 320, .height = 240, .format = AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM, .layers = 1, .usage = AHARDWAREBUFFER_USAGE_CPU_READ_RARELY | AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE, .stride = 0, .rfu0 = 0, .rfu1 = 0, }; return AHardwareBuffer_isSupported(&desc); } status_t ImageCopy(uint8_t *imgBase, const MediaImage2 *img, const C2GraphicView &view) { if (view.crop().width != img->mWidth || view.crop().height != img->mHeight) { return BAD_VALUE; Loading