Relying on AVPixFmtDescriptor.nb_components is cleaner and faster than
checking data and linesize for every possible plane.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -256,7 +256,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
256 | 256 |
if (!sar.num) |
257 | 257 |
sar.num = sar.den = 1; |
258 | 258 |
|
259 |
- for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) { |
|
259 |
+ for (plane = 0; plane < desc->nb_components; plane++) { |
|
260 | 260 |
int hsub = plane == 1 || plane == 2 ? hsub0 : 0; |
261 | 261 |
int vsub = plane == 1 || plane == 2 ? vsub0 : 0; |
262 | 262 |
|