[FFmpeg-devel] [PATCH 2/2] lavfi/showinfo: support regions of interest sidedata
Guo, Yejun
yejun.guo at intel.com
Sat Mar 9 11:35:45 EET 2019
> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Jun Zhao
> Sent: Saturday, March 09, 2019 4:34 PM
> To: ffmpeg-devel at ffmpeg.org
> Cc: Jun Zhao <barryjzhao at tencent.com>
> Subject: [FFmpeg-devel] [PATCH 2/2] lavfi/showinfo: support regions of
> interest sidedata
>
> From: Jun Zhao <barryjzhao at tencent.com>
>
> support regions of interest sidedata
>
> Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> ---
> libavfilter/vf_showinfo.c | 23 +++++++++++++++++++++++
> 1 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> index 9e84197..b51c1ae 100644
> --- a/libavfilter/vf_showinfo.c
> +++ b/libavfilter/vf_showinfo.c
> @@ -111,6 +111,26 @@ static void dump_stereo3d(AVFilterContext *ctx,
> AVFrameSideData *sd)
> av_log(ctx, AV_LOG_INFO, " (inverted)");
> }
>
> +static void dump_roi(AVFilterContext *ctx, AVFrameSideData *sd)
> +{
> + AVRegionOfInterest *roi;
> + int nb_rois;
> +
> + if (sd->size < sizeof(*roi)) {
> + av_log(ctx, AV_LOG_INFO, "invalid data");
> + return;
> + }
roi = (const AVRegionOfInterest *)sd->data;
if (roi->self_size == 0 || sd->size % roi->self_size != 0) {
//report error and return.
}
> +
> + roi = (AVRegionOfInterest *)sd->data;
> + nb_rois = sd->size / sizeof(*roi);
nb_rois = sd->size / roi->self_size;
> +
> + av_log(ctx, AV_LOG_INFO, "Regions Of Interest(RoI) informations: ");
> + for (int index = 0; index < nb_rois; index++) {
> + av_log(ctx, AV_LOG_INFO, "index: %d, region: (%d %d)/(%d %d), qp
> offset: %d/%d",
> + index, roi->left, roi->top, roi->right, roi->bottom, roi->qoffset.num,
> roi->qoffset.den);
> + }
> +}
> +
> static void dump_color_property(AVFilterContext *ctx, AVFrame *frame)
> {
> const char *color_range_str = av_color_range_name(frame-
> >color_range);
> @@ -246,6 +266,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *frame)
> case AV_FRAME_DATA_AFD:
> av_log(ctx, AV_LOG_INFO, "afd: value of %"PRIu8, sd->data[0]);
> break;
> + case AV_FRAME_DATA_REGIONS_OF_INTEREST:
> + dump_roi(ctx, sd);
> + break;
> default:
> av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d
> bytes)",
> sd->type, sd->size);
> --
> 1.7.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list