[FFmpeg-devel] [PATCH 2/2] avfilter/vf_zscale: fix mapping of zimg_chroma_location_e to AVChromaLocation
Jan Ekström
jeebjp at gmail.com
Thu Oct 28 12:52:32 EEST 2021
On Thu, Oct 28, 2021 at 1:25 AM Paul B Mahol <onemda at gmail.com> wrote:
>
> probably fine
This can be verified by specifying - say - chromal topleft, and seeing
that the ffmpeg.c Output: bit right now would end up being "left"
(most likely). While if you apply this, you should get "topleft".
Technically if the values were unsanitized, having a mapping function
like we have the other way would be better, but since the code already
utilized +/- 1... I went with that way of just fixing the logic to go
the right way.
For verification of the internal values, something like the following
can be utilized:
diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index 1288c5efc1..50df90e9ec 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -126,6 +126,8 @@ typedef struct ZScaleContext {
enum AVColorPrimaries in_primaries, out_primaries;
enum AVColorRange in_range, out_range;
enum AVChromaLocation in_chromal, out_chromal;
+
+ int lel;
} ZScaleContext;
static av_cold int init(AVFilterContext *ctx)
@@ -687,6 +689,12 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
update_output_color_information(s, out);
+ av_log_once(s, AV_LOG_VERBOSE, AV_LOG_TRACE, &(s->lel),
+ "output frame chroma location: %s "
+ "(s->chromal: %d, dst_format.chroma_location: %d)\n",
+ av_chroma_location_name(out->chroma_location),
+ s->chromal, s->dst_format.chroma_location);
+
av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den,
(int64_t)in->sample_aspect_ratio.num * outlink->h * link->w,
(int64_t)in->sample_aspect_ratio.den * outlink->w * link->h,
More information about the ffmpeg-devel
mailing list