From patchwork Tue Dec 25 20:12:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 11545 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 BE54744C6BE for ; Tue, 25 Dec 2018 14:20:16 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7D22068AE59; Tue, 25 Dec 2018 14:20:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 076E568AE49 for ; Tue, 25 Dec 2018 14:20:06 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Dec 2018 04:20:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,396,1539673200"; d="scan'208";a="113155010" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.13.25]) by orsmga003.jf.intel.com with ESMTP; 25 Dec 2018 04:20:09 -0800 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Wed, 26 Dec 2018 04:12:15 +0800 Message-Id: <1545768735-31225-1-git-send-email-yejun.guo@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH V2 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 | 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);