From patchwork Thu Dec 27 11:06:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 11560 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 07CD344C7E6 for ; Thu, 27 Dec 2018 05:14:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B960868AD75; Thu, 27 Dec 2018 05:14:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D1ED568AC0D for ; Thu, 27 Dec 2018 05:14:26 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Dec 2018 19:14:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,403,1539673200"; d="scan'208";a="305287500" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.13.25]) by fmsmga006.fm.intel.com with ESMTP; 26 Dec 2018 19:14:30 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Thu, 27 Dec 2018 19:06:38 +0800 Message-Id: <1545908798-23510-1-git-send-email-yejun.guo@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH V3 3/3] add an example to show how to fill the ROI info X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This patch is just a quick example to show how to fill the ROI info, it does not ask for upstreaming, just for your reference. to verify the ROI feature with this example, the command line looks like: ./ffmpeg -i .../path_to_1920x1080_video_file -vf scale=1920:1080 -c:v libx264 -b:v 2000k -y tmp.264 Signed-off-by: Guo, Yejun --- libavfilter/vf_scale.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index f741419..561391c 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -437,6 +437,20 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) return ret; } + // just to show how a filter fills the ROI info + size_t nb_rois = 1; + AVFrameSideData *sd = av_frame_new_side_data(in, AV_FRAME_DATA_ROIS, nb_rois * sizeof(AVROI)); + if (!sd) { + av_frame_free(&in); + return AVERROR(ENOMEM); + } + AVROI* rois = (AVROI*)sd->data; + rois[0].top = 0; + rois[0].left = 0; + rois[0].bottom = in->height; + rois[0].right = in->width/2; + rois[0].qoffset = -15; + if (!scale->sws) return ff_filter_frame(outlink, in);