[FFmpeg-cvslog] postproc/postprocess_template: Fix reading uninitialized pixels in dering_C()
Michael Niedermayer
git at videolan.org
Sun Apr 27 06:06:05 EEST 2025
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Apr 22 03:35:31 2025 +0200| [0118f392be916784f92508474e8d64243fd6fa97] | committer: Michael Niedermayer
postproc/postprocess_template: Fix reading uninitialized pixels in dering_C()
This issue was found through the new blocktest
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0118f392be916784f92508474e8d64243fd6fa97
---
libpostproc/postprocess_altivec_template.c | 2 +-
libpostproc/postprocess_template.c | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libpostproc/postprocess_altivec_template.c b/libpostproc/postprocess_altivec_template.c
index 827d6300e5..1fc7c65ee4 100644
--- a/libpostproc/postprocess_altivec_template.c
+++ b/libpostproc/postprocess_altivec_template.c
@@ -530,7 +530,7 @@ static inline void doVertDefFilter_altivec(uint8_t src[], int stride, PPContext
STORE(5)
}
-static inline void dering_altivec(uint8_t src[], int stride, PPContext *c) {
+static inline void dering_altivec(uint8_t src[], int stride, PPContext *c, int leftborder, int rightborder) {
const vector signed int vsint32_8 = vec_splat_s32(8);
const vector unsigned int vuint32_4 = vec_splat_u32(4);
const vector signed char neg1 = vec_splat_s8(-1);
diff --git a/libpostproc/postprocess_template.c b/libpostproc/postprocess_template.c
index f0e3c50d88..d2e7a642ff 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -831,7 +831,7 @@ static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext
#endif //TEMPLATE_PP_ALTIVEC
#if !TEMPLATE_PP_ALTIVEC
-static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)
+static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c, int leftborder, int rightborder)
{
#if TEMPLATE_PP_MMXEXT && HAVE_7REGS
DECLARE_ALIGNED(8, uint64_t, tmp)[3];
@@ -1046,7 +1046,7 @@ DERING_CORE((%0, %1, 8) ,(%%FF_REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,
for(y=0; y<10; y++){
int t = 0;
- if(src[stride*y + 0] > avg) t+= 1;
+ if(!leftborder && src[stride*y + 0] > avg) t+= 1;
if(src[stride*y + 1] > avg) t+= 2;
if(src[stride*y + 2] > avg) t+= 4;
if(src[stride*y + 3] > avg) t+= 8;
@@ -1055,7 +1055,7 @@ DERING_CORE((%0, %1, 8) ,(%%FF_REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,
if(src[stride*y + 6] > avg) t+= 64;
if(src[stride*y + 7] > avg) t+= 128;
if(src[stride*y + 8] > avg) t+= 256;
- if(src[stride*y + 9] > avg) t+= 512;
+ if(!rightborder && src[stride*y + 9] > avg) t+= 512;
t |= (~t)<<16;
t &= (t<<1) & (t>>1);
@@ -1072,8 +1072,8 @@ DERING_CORE((%0, %1, 8) ,(%%FF_REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,
int x;
int t = s[y-1];
- p= src + stride*y;
- for(x=1; x<9; x++){
+ p= src + stride*y + leftborder;
+ for(x=1+leftborder; x<9-rightborder; x++){
p++;
if(t & (1<<x)){
int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1))
@@ -3210,7 +3210,7 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[
#endif //TEMPLATE_PP_MMX
if(mode & DERING){
//FIXME filter first line
- if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, c);
+ if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, c, x<=8, 0);
}
if(mode & TEMP_NOISE_FILTER)
@@ -3232,7 +3232,7 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[
}
if(mode & DERING){
- if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, c);
+ if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, c, 0, 1);
}
if((mode & TEMP_NOISE_FILTER)){
More information about the ffmpeg-cvslog
mailing list