avfilter/vf_interlace : move func init in ff_interlace_init and add depth arg for...
authorMartin Vignali <martin.vignali@gmail.com>
Mon, 18 Dec 2017 10:18:14 +0000 (11:18 +0100)
committerMartin Vignali <martin.vignali@gmail.com>
Tue, 19 Dec 2017 19:59:47 +0000 (20:59 +0100)
libavfilter/interlace.h
libavfilter/vf_interlace.c
libavfilter/x86/vf_interlace_init.c

index 90a0198..b41f0d5 100644 (file)
@@ -62,6 +62,7 @@ typedef struct InterlaceContext {
                          ptrdiff_t mref, ptrdiff_t pref, int clip_max);
 } InterlaceContext;
 
-void ff_interlace_init_x86(InterlaceContext *interlace);
+void ff_interlace_init(InterlaceContext *interlace, int depth);
+void ff_interlace_init_x86(InterlaceContext *interlace, int depth);
 
 #endif /* AVFILTER_INTERLACE_H */
index 7310698..24c422d 100644 (file)
@@ -185,6 +185,25 @@ static av_cold void uninit(AVFilterContext *ctx)
     av_frame_free(&s->next);
 }
 
+void ff_interlace_init(InterlaceContext *s, int depth)
+{
+    if (s->lowpass) {
+        if (s->lowpass == VLPF_LIN) {
+            if (depth > 8)
+                s->lowpass_line = lowpass_line_c_16;
+            else
+                s->lowpass_line = lowpass_line_c;
+        } else if (s->lowpass == VLPF_CMP) {
+            if (depth > 8)
+                s->lowpass_line = lowpass_line_complex_c_16;
+            else
+                s->lowpass_line = lowpass_line_complex_c;
+        }
+        if (ARCH_X86)
+            ff_interlace_init_x86(s, depth);
+    }
+}
+
 static int config_out_props(AVFilterLink *outlink)
 {
     AVFilterContext *ctx = outlink->src;
@@ -210,21 +229,7 @@ static int config_out_props(AVFilterLink *outlink)
     outlink->frame_rate.den *= 2;
 
     s->csp = av_pix_fmt_desc_get(outlink->format);
-    if (s->lowpass) {
-        if (s->lowpass == VLPF_LIN) {
-            if (s->csp->comp[0].depth > 8)
-                s->lowpass_line = lowpass_line_c_16;
-            else
-                s->lowpass_line = lowpass_line_c;
-        } else if (s->lowpass == VLPF_CMP) {
-            if (s->csp->comp[0].depth > 8)
-                s->lowpass_line = lowpass_line_complex_c_16;
-            else
-                s->lowpass_line = lowpass_line_complex_c;
-        }
-        if (ARCH_X86)
-            ff_interlace_init_x86(s);
-    }
+    ff_interlace_init(s, s->csp->comp[0].depth);
 
     av_log(ctx, AV_LOG_VERBOSE, "%s interlacing %s lowpass filter\n",
            s->scan == MODE_TFF ? "tff" : "bff", (s->lowpass) ? "with" : "without");
index 70fe86c..b024b61 100644 (file)
@@ -48,11 +48,11 @@ void ff_lowpass_line_complex_12_sse2(uint8_t *dstp, ptrdiff_t linesize,
                                      const uint8_t *srcp, ptrdiff_t mref,
                                      ptrdiff_t pref, int clip_max);
 
-av_cold void ff_interlace_init_x86(InterlaceContext *s)
+av_cold void ff_interlace_init_x86(InterlaceContext *s, int depth)
 {
     int cpu_flags = av_get_cpu_flags();
 
-    if (s->csp->comp[0].depth > 8) {
+    if (depth > 8) {
         if (EXTERNAL_SSE2(cpu_flags)) {
             if (s->lowpass == VLPF_LIN)
                 s->lowpass_line = ff_lowpass_line_16_sse2;