avfilter/bwdif: move filter_line init to a dedicated function

This commit is contained in:
James Darnley 2023-02-20 20:55:08 +01:00
parent 90488e1440
commit b503b5a0cf
3 changed files with 12 additions and 8 deletions

View File

@ -37,6 +37,7 @@ typedef struct BWDIFContext {
int parity, int clip_max, int spat);
} BWDIFContext;
void ff_bwdif_init_x86(BWDIFContext *bwdif);
void ff_bwdif_init_filter_line(BWDIFContext *bwdif, int bit_depth);
void ff_bwdif_init_x86(BWDIFContext *bwdif, int bit_depth);
#endif /* AVFILTER_BWDIF_H */

View File

@ -340,7 +340,14 @@ static int config_props(AVFilterLink *link)
yadif->csp = av_pix_fmt_desc_get(link->format);
yadif->filter = filter;
if (yadif->csp->comp[0].depth > 8) {
ff_bwdif_init_filter_line(s, yadif->csp->comp[0].depth);
return 0;
}
av_cold void ff_bwdif_init_filter_line(BWDIFContext *s, int bit_depth)
{
if (bit_depth > 8) {
s->filter_intra = filter_intra_16bit;
s->filter_line = filter_line_c_16bit;
s->filter_edge = filter_edge_16bit;
@ -351,10 +358,8 @@ static int config_props(AVFilterLink *link)
}
#if ARCH_X86
ff_bwdif_init_x86(s);
ff_bwdif_init_x86(s, bit_depth);
#endif
return 0;
}

View File

@ -42,11 +42,9 @@ void ff_bwdif_filter_line_12bit_ssse3(void *dst, void *prev, void *cur, void *ne
int mrefs2, int prefs3, int mrefs3, int prefs4,
int mrefs4, int parity, int clip_max);
av_cold void ff_bwdif_init_x86(BWDIFContext *bwdif)
av_cold void ff_bwdif_init_x86(BWDIFContext *bwdif, int bit_depth)
{
YADIFContext *yadif = &bwdif->yadif;
int cpu_flags = av_get_cpu_flags();
int bit_depth = (!yadif->csp) ? 8 : yadif->csp->comp[0].depth;
if (bit_depth <= 8) {
if (EXTERNAL_SSE2(cpu_flags))