History

postproc/postprocess_template: Fix reading uninitialized pixels in dering_C()

This issue was found through the new blocktest

Michael Niedermayer committed 1 year ago

Commit 0118f391 parent 8bb682d2 files · +8 −8Browse files

Unified · Split

2 files
  1. libpostproc/postprocess_altivec_template.c +1 −1
  2. libpostproc/postprocess_template.c +7 −7
libpostproc/postprocess_altivec_template.c+1−1
@@ -530,7 +530,7 @@ static inline void doVertDefFilter_altivec(uint8_t src[], int stride, PPContext · 529 unmodified lines
530 STORE(5)530 STORE(5)
531}531}
532 532
533static inline void dering_altivec(uint8_t src[], int stride, PPContext *c) {533static inline void dering_altivec(uint8_t src[], int stride, PPContext *c, int leftborder, int rightborder) {
534 const vector signed int vsint32_8 = vec_splat_s32(8);534 const vector signed int vsint32_8 = vec_splat_s32(8);
535 const vector unsigned int vuint32_4 = vec_splat_u32(4);535 const vector unsigned int vuint32_4 = vec_splat_u32(4);
536 const vector signed char neg1 = vec_splat_s8(-1);536 const vector signed char neg1 = vec_splat_s8(-1);
libpostproc/postprocess_template.c+7−7
@@ -831,7 +831,7 @@ static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext · 830 unmodified lines
831#endif //TEMPLATE_PP_ALTIVEC831#endif //TEMPLATE_PP_ALTIVEC
832 832
833#if !TEMPLATE_PP_ALTIVEC833#if !TEMPLATE_PP_ALTIVEC
834static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)834static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c, int leftborder, int rightborder)
835{835{
836#if TEMPLATE_PP_MMXEXT && HAVE_7REGS836#if TEMPLATE_PP_MMXEXT && HAVE_7REGS
837 DECLARE_ALIGNED(8, uint64_t, tmp)[3];837 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, · 208 unmodified lines
1046 for(y=0; y<10; y++){1046 for(y=0; y<10; y++){
1047 int t = 0;1047 int t = 0;
1048 1048
1049 if(src[stride*y + 0] > avg) t+= 1;1049 if(!leftborder && src[stride*y + 0] > avg) t+= 1;
1050 if(src[stride*y + 1] > avg) t+= 2;1050 if(src[stride*y + 1] > avg) t+= 2;
1051 if(src[stride*y + 2] > avg) t+= 4;1051 if(src[stride*y + 2] > avg) t+= 4;
1052 if(src[stride*y + 3] > avg) t+= 8;1052 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, · 2 unmodified lines
1055 if(src[stride*y + 6] > avg) t+= 64;1055 if(src[stride*y + 6] > avg) t+= 64;
1056 if(src[stride*y + 7] > avg) t+= 128;1056 if(src[stride*y + 7] > avg) t+= 128;
1057 if(src[stride*y + 8] > avg) t+= 256;1057 if(src[stride*y + 8] > avg) t+= 256;
1058 if(src[stride*y + 9] > avg) t+= 512;1058 if(!rightborder && src[stride*y + 9] > avg) t+= 512;
1059 1059
1060 t |= (~t)<<16;1060 t |= (~t)<<16;
1061 t &= (t<<1) & (t>>1);1061 t &= (t<<1) & (t>>1);
@@ -1072,8 +1072,8 @@ DERING_CORE((%0, %1, 8) ,(%%FF_REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5, · 10 unmodified lines
1072 int x;1072 int x;
1073 int t = s[y-1];1073 int t = s[y-1];
1074 1074
1075 p= src + stride*y;1075 p= src + stride*y + leftborder;
1076 for(x=1; x<9; x++){1076 for(x=1+leftborder; x<9-rightborder; x++){
1077 p++;1077 p++;
1078 if(t & (1<<x)){1078 if(t & (1<<x)){
1079 int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1))1079 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[ · 2130 unmodified lines
3210#endif //TEMPLATE_PP_MMX3210#endif //TEMPLATE_PP_MMX
3211 if(mode & DERING){3211 if(mode & DERING){
3212 //FIXME filter first line3212 //FIXME filter first line
3213 if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, c);3213 if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, c, x<=8, 0);
3214 }3214 }
3215 3215
3216 if(mode & TEMP_NOISE_FILTER)3216 if(mode & TEMP_NOISE_FILTER)
@@ -3232,7 +3232,7 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[ · 15 unmodified lines
3232 }3232 }
3233 3233
3234 if(mode & DERING){3234 if(mode & DERING){
3235 if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, c);3235 if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, c, 0, 1);
3236 }3236 }
3237 3237
3238 if((mode & TEMP_NOISE_FILTER)){3238 if((mode & TEMP_NOISE_FILTER)){

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t