This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 617a9afeb4df99cd169a50d1cac9aa505cdc3009 Author: Andreas Rheinhardt <[email protected]> AuthorDate: Sun May 10 20:18:59 2026 +0200 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Fri May 15 20:29:29 2026 +0200 avfilter/vf_pp7: Add proper PP7DSPContext This is in preparation for checkasm tests for dctB. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavfilter/vf_pp7.c | 52 ++++++++++++++------------------ libavfilter/{vf_pp7.h => vf_pp7dsp.h} | 57 +++++++++++++++++++++++------------ libavfilter/x86/vf_pp7_init.c | 4 +-- 3 files changed, 62 insertions(+), 51 deletions(-) diff --git a/libavfilter/vf_pp7.c b/libavfilter/vf_pp7.c index ea27e10060..d8a5501b47 100644 --- a/libavfilter/vf_pp7.c +++ b/libavfilter/vf_pp7.c @@ -33,10 +33,12 @@ #include "libavutil/mem_internal.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" +#include "libavutil/video_enc_params.h" +#include "avfilter.h" #include "filters.h" #include "qp_table.h" -#include "vf_pp7.h" +#include "vf_pp7dsp.h" #include "video.h" enum mode { @@ -45,6 +47,23 @@ enum mode { MODE_MEDIUM }; +typedef struct PP7Context { + const AVClass *class; + int thres2[99][16]; + + int qp; + int mode; + enum AVVideoEncParamsType qscale_type; + int hsub; + int vsub; + int temp_stride; + uint8_t *src; + + int (*requantize)(const struct PP7Context *p, const int16_t *src, int qp); + + PP7DSPContext pp7dsp; +} PP7Context; + #define OFFSET(x) offsetof(PP7Context, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM static const AVOption pp7_options[] = { @@ -119,29 +138,6 @@ static inline void dctA_c(int16_t *dst, const uint8_t *src, int stride) } } -static void dctB_c(int16_t *dst, const int16_t *src) -{ - int i; - - for (i = 0; i < 4; i++) { - int s0 = src[0 * 4] + src[6 * 4]; - int s1 = src[1 * 4] + src[5 * 4]; - int s2 = src[2 * 4] + src[4 * 4]; - int s3 = src[3 * 4]; - int s = s3 + s3; - s3 = s - s0; - s0 = s + s0; - s = s2 + s1; - s2 = s2 - s1; - dst[0 * 4] = s0 + s; - dst[2 * 4] = s0 - s; - dst[1 * 4] = 2 * s3 + s2; - dst[3 * 4] = s3 - 2 * s2; - src++; - dst++; - } -} - static int hardthresh_c(const PP7Context *p, const int16_t *src, int qp) { int i; @@ -256,7 +252,7 @@ static void filter(PP7Context *p, uint8_t *dst, const uint8_t *src, if ((x & 3) == 0) dctA_c(tp + 4 * 8, src, stride); - p->dctB(block, tp); + p->pp7dsp.dctB(block, tp); v = p->requantize(p, block, qp); v = (v + dither[y & 7][x & 7]) >> 6; @@ -303,11 +299,7 @@ static int config_input(AVFilterLink *inlink) case 2: pp7->requantize = mediumthresh_c; break; } - pp7->dctB = dctB_c; - -#if ARCH_X86 && HAVE_X86ASM - ff_pp7_init_x86(pp7); -#endif + ff_pp7dsp_init(&pp7->pp7dsp); return 0; } diff --git a/libavfilter/vf_pp7.h b/libavfilter/vf_pp7dsp.h similarity index 50% rename from libavfilter/vf_pp7.h rename to libavfilter/vf_pp7dsp.h index c733079291..e75917bdb4 100644 --- a/libavfilter/vf_pp7.h +++ b/libavfilter/vf_pp7dsp.h @@ -19,28 +19,47 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef AVFILTER_PP7_H -#define AVFILTER_PP7_H +#ifndef AVFILTER_PP7DSP_H +#define AVFILTER_PP7DSP_H -#include "libavutil/video_enc_params.h" -#include "avfilter.h" +#include <stdint.h> -typedef struct PP7Context { - AVClass *class; - int thres2[99][16]; +#include "config.h" - int qp; - int mode; - enum AVVideoEncParamsType qscale_type; - int hsub; - int vsub; - int temp_stride; - uint8_t *src; - - int (*requantize)(const struct PP7Context *p, const int16_t *src, int qp); +typedef struct PP7DSPContext { void (*dctB)(int16_t *dst, const int16_t *src); -} PP7Context; +} PP7DSPContext; + +void ff_pp7dsp_init_x86(PP7DSPContext *pp7dsp); + +static void dctB_c(int16_t *dst, const int16_t *src) +{ + for (int i = 0; i < 4; i++) { + int s0 = src[0 * 4] + src[6 * 4]; + int s1 = src[1 * 4] + src[5 * 4]; + int s2 = src[2 * 4] + src[4 * 4]; + int s3 = src[3 * 4]; + int s = s3 + s3; + s3 = s - s0; + s0 = s + s0; + s = s2 + s1; + s2 = s2 - s1; + dst[0 * 4] = s0 + s; + dst[2 * 4] = s0 - s; + dst[1 * 4] = 2 * s3 + s2; + dst[3 * 4] = s3 - 2 * s2; + src++; + dst++; + } +} + +static inline void ff_pp7dsp_init(PP7DSPContext *pp7dsp) +{ + pp7dsp->dctB = dctB_c; -void ff_pp7_init_x86(PP7Context *pp7); +#if ARCH_X86 && HAVE_X86ASM + ff_pp7dsp_init_x86(pp7dsp); +#endif +} -#endif /* AVFILTER_PP7_H */ +#endif /* AVFILTER_PP7DSP_H */ diff --git a/libavfilter/x86/vf_pp7_init.c b/libavfilter/x86/vf_pp7_init.c index a87882359d..53ac907f27 100644 --- a/libavfilter/x86/vf_pp7_init.c +++ b/libavfilter/x86/vf_pp7_init.c @@ -21,11 +21,11 @@ #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86/cpu.h" -#include "libavfilter/vf_pp7.h" +#include "libavfilter/vf_pp7dsp.h" void ff_pp7_dctB_mmx(int16_t *dst, const int16_t *src); -av_cold void ff_pp7_init_x86(PP7Context *p) +av_cold void ff_pp7dsp_init_x86(PP7DSPContext *p) { int cpu_flags = av_get_cpu_flags(); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
