This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit c185d37f0b003c5d621503e58feecb0bd58104c2
Author:     Wu Jianhua <[email protected]>
AuthorDate: Tue Apr 15 04:46:05 2025 +0800
Commit:     jianhuaw <[email protected]>
CommitDate: Sun Nov 29 10:42:10 2026 +0000

    avcodec/h26x/h2656_inter_template: fix put uni chroma functions for high 
bitdepth
    
    Signed-off-by: Wu Jianhua <[email protected]>
---
 libavcodec/h26x/h2656_inter_template.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/libavcodec/h26x/h2656_inter_template.c 
b/libavcodec/h26x/h2656_inter_template.c
index 71dace8120..02fa94aad4 100644
--- a/libavcodec/h26x/h2656_inter_template.c
+++ b/libavcodec/h26x/h2656_inter_template.c
@@ -404,16 +404,12 @@ static void FUNC(put_uni_chroma_h)(uint8_t *_dst, const 
ptrdiff_t _dst_stride,
     const ptrdiff_t src_stride  = _src_stride / sizeof(pixel);
     const ptrdiff_t dst_stride  = _dst_stride / sizeof(pixel);
     const int8_t *filter        = hf;
-    const int shift             = 14 - BIT_DEPTH;
-#if BIT_DEPTH < 14
+    const int shift             = FFMAX(2, 14 - BIT_DEPTH);
     const int offset            = 1 << (shift - 1);
-#else
-    const int offset            = 0;
-#endif
 
     for (int y = 0; y < height; y++) {
         for (int x = 0; x < width; x++)
-            dst[x] = av_clip_pixel(((CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8)) 
+ offset) >> shift);
+            dst[x] = av_clip_pixel(((CHROMA_FILTER(src, 1) >> FFMIN(4, 
BIT_DEPTH - 8)) + offset) >> shift);
         src += src_stride;
         dst += dst_stride;
     }
@@ -428,16 +424,12 @@ static void FUNC(put_uni_chroma_v)(uint8_t *_dst, const 
ptrdiff_t _dst_stride,
     const ptrdiff_t src_stride  = _src_stride / sizeof(pixel);
     const ptrdiff_t dst_stride  = _dst_stride / sizeof(pixel);
     const int8_t *filter        = vf;
-    const int shift             = 14 - BIT_DEPTH;
-#if BIT_DEPTH < 14
+    const int shift             = FFMAX(2, 14 - BIT_DEPTH);
     const int offset            = 1 << (shift - 1);
-#else
-    const int offset            = 0;
-#endif
 
     for (int y = 0; y < height; y++) {
         for (int x = 0; x < width; x++)
-            dst[x] = av_clip_pixel(((CHROMA_FILTER(src, src_stride) >> 
(BIT_DEPTH - 8)) + offset) >> shift);
+            dst[x] = av_clip_pixel(((CHROMA_FILTER(src, src_stride) >> 
FFMIN(4, BIT_DEPTH - 8)) + offset) >> shift);
         src += src_stride;
         dst += dst_stride;
     }
@@ -447,25 +439,21 @@ static void FUNC(put_uni_chroma_hv)(uint8_t *_dst, const 
ptrdiff_t _dst_stride,
     const uint8_t *_src, const ptrdiff_t _src_stride,
     const int height, const int8_t *hf, const int8_t *vf, const int width)
 {
-    int16_t tmp_array[(MAX_PB_SIZE + CHROMA_EXTRA) * MAX_PB_SIZE];
-    int16_t *tmp                = tmp_array;
+    tpixel tmp_array[(MAX_PB_SIZE + CHROMA_EXTRA) * MAX_PB_SIZE];
+    tpixel *tmp                 = tmp_array;
     const pixel *src            = (const pixel *)_src;
     pixel *dst                  = (pixel *)_dst;
     const ptrdiff_t src_stride  = _src_stride / sizeof(pixel);
     const ptrdiff_t dst_stride  = _dst_stride / sizeof(pixel);
     const int8_t *filter        = hf;
-    const int shift             = 14 - BIT_DEPTH;
-#if BIT_DEPTH < 14
+    const int shift             = FFMAX(2, 14 - BIT_DEPTH);
     const int offset            = 1 << (shift - 1);
-#else
-    const int offset            = 0;
-#endif
 
     src -= CHROMA_EXTRA_BEFORE * src_stride;
 
     for (int y = 0; y < height + CHROMA_EXTRA; y++) {
         for (int x = 0; x < width; x++)
-            tmp[x] = CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8);
+            tmp[x] = CHROMA_FILTER(src, 1) >> FFMIN(4, BIT_DEPTH - 8);
         src += src_stride;
         tmp += MAX_PB_SIZE;
     }

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to