[FFmpeg-devel] [PATCH 2/2] postproc/postprocess_template: fix handling of first row of dering_C
Michael Niedermayer
michael at niedermayer.cc
Tue Apr 22 22:28:51 EEST 2025
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libpostproc/postprocess_altivec_template.c | 5 ++++-
libpostproc/postprocess_template.c | 12 +++++++-----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/libpostproc/postprocess_altivec_template.c b/libpostproc/postprocess_altivec_template.c
index 1fc7c65ee47..feddab50356 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, int leftborder, int rightborder) {
+static inline void dering_altivec(uint8_t src[], int stride, PPContext *c, int leftborder, int rightborder, int topborder) {
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);
@@ -577,6 +577,9 @@ static inline void dering_altivec(uint8_t src[], int stride, PPContext *c, int l
const vector signed int zero = vec_splat_s32(0);
vector unsigned char v_dt = vec_splat(vec_ld(0, dt), 0);
+ if (topborder)
+ return;
+
#define LOAD_LINE(i) \
const vector unsigned char perm##i = \
vec_lvsl(i * stride, srcCopy); \
diff --git a/libpostproc/postprocess_template.c b/libpostproc/postprocess_template.c
index d2e7a642ffb..0531e39477a 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -831,9 +831,11 @@ 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, int leftborder, int rightborder)
+static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c, int leftborder, int rightborder, int topborder)
{
#if TEMPLATE_PP_MMXEXT && HAVE_7REGS
+ if (topborder)
+ return;
DECLARE_ALIGNED(8, uint64_t, tmp)[3];
__asm__ volatile(
"pxor %%mm6, %%mm6 \n\t"
@@ -1043,7 +1045,8 @@ DERING_CORE((%0, %1, 8) ,(%%FF_REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,
if (max - min < DERING_THRESHOLD) return;
- for(y=0; y<10; y++){
+ s[0] = 0;
+ for(y=topborder; y<10; y++){
int t = 0;
if(!leftborder && src[stride*y + 0] > avg) t+= 1;
@@ -3209,8 +3212,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, x<=8, 0);
+ RENAME(dering)(dstBlock - stride - 8, stride, c, x<=8, 0, y<=0);
}
if(mode & TEMP_NOISE_FILTER)
@@ -3232,7 +3234,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, 0, 1);
+ RENAME(dering)(dstBlock - dstStride - 8, dstStride, c, 0, 1, y<=0);
}
if((mode & TEMP_NOISE_FILTER)){
--
2.49.0
More information about the ffmpeg-devel
mailing list