From c90856a12b2b643ff55f89056b4c57cf877caa0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=B9=94=E5=BC=82?= Date: Mon, 8 Sep 2025 19:27:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A5=87=E6=95=B0?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E5=86=85=E5=AD=98=E8=B6=8A=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈乔异 --- frameworks/innerkitsimpl/converter/src/post_proc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/innerkitsimpl/converter/src/post_proc.cpp b/frameworks/innerkitsimpl/converter/src/post_proc.cpp index f0202327b..412b7904c 100644 --- a/frameworks/innerkitsimpl/converter/src/post_proc.cpp +++ b/frameworks/innerkitsimpl/converter/src/post_proc.cpp @@ -1196,7 +1196,8 @@ bool PostProc::ScalePixelMapEx(const Size &desiredSize, PixelMap &pixelMap, cons desiredSize.width * ImageUtils::GetPixelBytes(imgInfo.pixelFormat); void *inBuf = nullptr; - if (srcWidth % HALF != 0 && pixelMap.GetAllocatorType() == AllocatorType::SHARE_MEM_ALLOC) { + if (srcWidth % HALF != 0 && + (pixelMap.GetAllocatorType() == AllocatorType::SHARE_MEM_ALLOC || pixelMap.GetNoPaddingUsage())) { // Workaround for crash on odd number width, caused by FFmpeg 5.0 upgrade uint64_t byteCount = static_cast(srcRowStride[0]) * static_cast(srcHeight); uint64_t allocSize = static_cast(srcWidth + 1) * static_cast(srcHeight) * -- Gitee From e02729aea56d8581da0c302538b10b9544a488a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=B9=94=E5=BC=82?= Date: Wed, 10 Sep 2025 16:12:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈乔异 --- .../test/unittest/post_proc_test.cpp | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/frameworks/innerkitsimpl/test/unittest/post_proc_test.cpp b/frameworks/innerkitsimpl/test/unittest/post_proc_test.cpp index 3a3a53fe3..0414c5d75 100644 --- a/frameworks/innerkitsimpl/test/unittest/post_proc_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/post_proc_test.cpp @@ -1052,6 +1052,56 @@ HWTEST_F(PostProcTest, ScalePixelMapExTest001, TestSize.Level3) GTEST_LOG_(INFO) << "PostProcTest: ScalePixelMapExTest001 end"; } +/** + * @tc.name: ScalePixelMapExOddWidthTest001 + * @tc.desc: Test ScalePixelMapEx with odd number PixelMap width + * @tc.type: FUNC + */ +HWTEST_F(PostProcTest, ScalePixelMapExOddWidthTest001, TestSize.Level3) +{ + GTEST_LOG_(INFO) << "PostProcTest: ScalePixelMapExOddWidthTest001 start"; + + InitializationOptions opts; + opts.size = {1, 1}; + opts.allocatorType = AllocatorType::SHARE_MEM_ALLOC; + std::unique_ptr pixelMap = PixelMap::Create(opts); + if (!pixelMap) { + return; + } + PostProc postProc; + Size desiredSize = {10, 10}; + bool ret = postProc.ScalePixelMapEx(desiredSize, *(pixelMap.get())); + ASSERT_EQ(ret, true); + + GTEST_LOG_(INFO) << "PostProcTest: ScalePixelMapExOddWidthTest001 end"; +} + +/** + * @tc.name: ScalePixelMapExOddWidthTest002 + * @tc.desc: Test ScalePixelMapEx with odd number PixelMap width + * @tc.type: FUNC + */ +HWTEST_F(PostProcTest, ScalePixelMapExOddWidthTest002, TestSize.Level3) +{ + GTEST_LOG_(INFO) << "PostProcTest: ScalePixelMapExOddWidthTest002 start"; + + InitializationOptions opts; + opts.size = {513, 512}; + opts.pixelFormat = PixelFormat::RGBA_8888; + opts.allocatorType = AllocatorType::SHARE_MEM_ALLOC; + opts.useDMA = true; + std::unique_ptr pixelMap = PixelMap::Create(opts); + if (!pixelMap) { + return; + } + PostProc postProc; + Size desiredSize = {11, 10}; + bool ret = postProc.ScalePixelMapEx(desiredSize, *(pixelMap.get())); + ASSERT_EQ(ret, true); + + GTEST_LOG_(INFO) << "PostProcTest: ScalePixelMapExOddWidthTest002 end"; +} + /** * @tc.name: DecodePostProc001 * @tc.desc: Vertify that DecodePostProc when cropAndScaleStrategy is scale first. -- Gitee