[FFmpeg-devel] [PATCH RFC] avfilter/vf_delogo: Use AVPixFmtDescriptor.nb_components

Jean Delvare jdelvare at suse.de
Thu Dec 10 15:25:57 CET 2015


Relying on AVPixFmtDescriptor.nb_components is cleaner and faster than
checking data and linesize for every possible plane.

Signed-off-by: Jean Delvare <jdelvare at suse.de>
---
I see that most filters use AVPixFmtDescriptor.nb_components while
others still check data and linesize. Am I correct assuming that the
former is faster and preferred?

 libavfilter/vf_delogo.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- ffmpeg.orig/libavfilter/vf_delogo.c	2015-12-10 13:06:16.212908502 +0100
+++ ffmpeg/libavfilter/vf_delogo.c	2015-12-10 13:07:04.877966120 +0100
@@ -256,7 +256,7 @@ static int filter_frame(AVFilterLink *in
     if (!sar.num)
         sar.num = sar.den = 1;
 
-    for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) {
+    for (plane = 0; plane < desc->nb_components; plane++) {
         int hsub = plane == 1 || plane == 2 ? hsub0 : 0;
         int vsub = plane == 1 || plane == 2 ? vsub0 : 0;
 


-- 
Jean Delvare
SUSE L3 Support


More information about the ffmpeg-devel mailing list