From patchwork Wed Dec 12 16:27:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 11381 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 1F39644D198 for ; Wed, 12 Dec 2018 10:35:30 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6D42668A715; Wed, 12 Dec 2018 10:35:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4D48568A713 for ; Wed, 12 Dec 2018 10:35:13 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2018 00:35:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,343,1539673200"; d="scan'208";a="125169597" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.13.25]) by fmsmga002.fm.intel.com with ESMTP; 12 Dec 2018 00:35:23 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Thu, 13 Dec 2018 00:27:51 +0800 Message-Id: <1544632071-23069-1-git-send-email-yejun.guo@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH 2/2] 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 patchset contains two patches. - the first patch finished the code and ask for upstreaming. - the second patch (this patch) is just a quick example and not ask for upstreaming. to verify it, 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index f741419..6776ad9 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -437,6 +437,16 @@ 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; + in->rois_buf = av_buffer_alloc(sizeof(AVFrameROI) * nb_rois); + AVFrameROI* rois = (AVFrameROI*)in->rois_buf->data; + rois[0].top = 0; + rois[0].left = 0; + rois[0].bottom = in->height; + rois[0].right = in->width/2; + rois[0].quality = AV_RQ_BEST; + if (!scale->sws) return ff_filter_frame(outlink, in);