From patchwork Sat Sep 8 13:26:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jay@wizardofthenet.com X-Patchwork-Id: 10277 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp571415jap; Sat, 8 Sep 2018 06:27:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbD9a6om0eNK2euppF/2wdN0h36+PJ741beYzqNJ+IRsBG8tuScFIwORcb6EIKzmLRqo+2+ X-Received: by 2002:a1c:3c85:: with SMTP id j127-v6mr7941994wma.124.1536413247775; Sat, 08 Sep 2018 06:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536413247; cv=none; d=google.com; s=arc-20160816; b=vzSwpp252XSVR1oMqXlkU3xL7T9KhmqiLOuvrxysgupnvjUXKdSckJ6TgCeDwimWlY WiUmv3w1HdLv9nO32EVGmZjSrTA4YGAX9xvoZT7T580uYJZV6zV1ZkCq1D+56SIULtW0 f9lyjyCJGXfwMxVF+ks7SLCl9yhk47mFGoCDiJTCJAJAWdhRrmQvMYU92n46SynBleIm ZROjGj+QmUOuyGa0XDWsfwKvA1vTbs/JSK/KowZcUZSO5DAj3V7ijFyzVXO+VRCT+rqi ljyrq54o7OlNsfZ8O8NlJZYILtrcTCxaIP2nBElgHgjxauMji7t5ugsGZJSQy79bAOZM mk3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=VPthmtOlWdHpKU2NC95bPiM4xir4GKzzm7W5qheZIxQ=; b=gTTFGHWC4a/kRnP4FaS7v4fGX4313RkTlh3kCBmhjQH0idZeZ3Xsyf6SzCUxZFvKke j6YcnCChdLmdhU5dggEZjZa9Tb+XoTTjwx0dEXaaly/XBb9xYIh8hZcRt+qIUj4jigxi HIU/h5UOVF9erJjQGPTBdFikbk+jm9aWq/WATw50nas4mte4WAsjfqzaNYJ5gjJnCLKC uV1Jdt0+XlHxgnYApn48wSsFtwz3VvuWRti2FOrjDqIGwaK4SFp18eqv8pRsNrnDXats RCvt/YpyodH6XzQuy8dQMUSsBRnaMYPRXXnR89CG1rtuBGaCllb0otKVbeyaevDmQiJ6 Zsxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u13-v6si10111498wri.169.2018.09.08.06.27.27; Sat, 08 Sep 2018 06:27:27 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 037F468A0A7; Sat, 8 Sep 2018 16:27:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp81.ord1d.emailsrvr.com (smtp81.ord1d.emailsrvr.com [184.106.54.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A0E2F689F67 for ; Sat, 8 Sep 2018 16:27:00 +0300 (EEST) Received: from smtp3.relay.ord1d.emailsrvr.com (localhost [127.0.0.1]) by smtp3.relay.ord1d.emailsrvr.com (SMTP Server) with ESMTP id 64108600F5; Sat, 8 Sep 2018 09:27:08 -0400 (EDT) X-Auth-ID: jay@wizardofthenet.com Received: by smtp3.relay.ord1d.emailsrvr.com (Authenticated sender: jay-AT-wizardofthenet.com) with ESMTPSA id 0EC8B600D0; Sat, 8 Sep 2018 09:27:07 -0400 (EDT) X-Sender-Id: jay@wizardofthenet.com Received: from python-centos7.fdn.ad (usa-67-224-107-242.sohonet.co.uk [67.224.107.242]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256) by 0.0.0.0:465 (trex/5.7.12); Sat, 08 Sep 2018 09:27:08 -0400 From: Jason Stevens To: ffmpeg-devel@ffmpeg.org Date: Sat, 8 Sep 2018 06:26:30 -0700 Message-Id: <20180908132631.8052-2-jay@wizardofthenet.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908132631.8052-1-jay@wizardofthenet.com> References: <20180908132631.8052-1-jay@wizardofthenet.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 1/2] libavcodec/dnxhd: change ff_dnxhd_get_hr_frame_size to avpriv_ 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 Cc: Jason Stevens Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" refactor ff_dnxhd_get_hr_frame_size to avpriv_dnxhd_get_hr_frame_size, to allow cross library usage in libavformat/mxfenc this change makes this function no longer be always inlined. Signed-off-by: Jason Stevens --- libavcodec/dnxhd_parser.c | 2 +- libavcodec/dnxhddata.c | 13 +++++++++++++ libavcodec/dnxhddata.h | 14 +------------- libavcodec/dnxhdenc.c | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c index 79ca1d6718..7c16e251a4 100644 --- a/libavcodec/dnxhd_parser.c +++ b/libavcodec/dnxhd_parser.c @@ -75,7 +75,7 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx, remaining = avpriv_dnxhd_get_frame_size(cid); if (remaining <= 0) { - remaining = ff_dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h); + remaining = avpriv_dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h); if (remaining <= 0) continue; } diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c index e9dd29ce4c..154be89860 100644 --- a/libavcodec/dnxhddata.c +++ b/libavcodec/dnxhddata.c @@ -1092,6 +1092,19 @@ int avpriv_dnxhd_get_frame_size(int cid) return ff_dnxhd_cid_table[i].frame_size; } +int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h) +{ + int result, i = ff_dnxhd_get_cid_table(cid); + + if (i < 0) + return i; + + result = ((h + 15) / 16) * ((w + 15) / 16) * (int64_t)ff_dnxhd_cid_table[i].packet_scale.num / ff_dnxhd_cid_table[i].packet_scale.den; + result = (result + 2048) / 4096 * 4096; + + return FFMAX(result, 8192); +} + int avpriv_dnxhd_get_interlaced(int cid) { int i = ff_dnxhd_get_cid_table(cid); diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h index f80ce18f3c..cfa6b0c99d 100644 --- a/libavcodec/dnxhddata.h +++ b/libavcodec/dnxhddata.h @@ -90,20 +90,8 @@ static av_always_inline uint64_t ff_dnxhd_parse_header_prefix(const uint8_t *buf return ff_dnxhd_check_header_prefix(prefix); } -static av_always_inline int ff_dnxhd_get_hr_frame_size(int cid, int w, int h) -{ - int result, i = ff_dnxhd_get_cid_table(cid); - - if (i < 0) - return i; - - result = ((h + 15) / 16) * ((w + 15) / 16) * (int64_t)ff_dnxhd_cid_table[i].packet_scale.num / ff_dnxhd_cid_table[i].packet_scale.den; - result = (result + 2048) / 4096 * 4096; - - return FFMAX(result, 8192); -} - int avpriv_dnxhd_get_frame_size(int cid); +int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h); int avpriv_dnxhd_get_interlaced(int cid); #endif /* AVCODEC_DNXHDDATA_H */ diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 9325f38baf..41b8079a09 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -482,7 +482,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx) ctx->m.mb_num = ctx->m.mb_height * ctx->m.mb_width; if (ctx->cid_table->frame_size == DNXHD_VARIABLE) { - ctx->frame_size = ff_dnxhd_get_hr_frame_size(ctx->cid, + ctx->frame_size = avpriv_dnxhd_get_hr_frame_size(ctx->cid, avctx->width, avctx->height); av_assert0(ctx->frame_size >= 0); ctx->coding_unit_size = ctx->frame_size;