From patchwork Wed Aug 24 08:43:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 37446 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp2371765pzh; Wed, 24 Aug 2022 01:45:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR6JIzIDjd4pglGzxtFYFfD4FsFNGtAgVLaDD6TsCYsFzHr+/3JykTxWmo91uMn0q86wYyju X-Received: by 2002:a17:906:ef8c:b0:73d:c311:bffc with SMTP id ze12-20020a170906ef8c00b0073dc311bffcmr270392ejb.693.1661330748686; Wed, 24 Aug 2022 01:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661330748; cv=none; d=google.com; s=arc-20160816; b=ErjTuGeqmwkY9WbdOxt+lSOVxGUd54lT+0a/EzUCJ4T9QfmQ9+Zbgv/D3X1pz2ORTF F8naqmPyvaqFObqHQ6tGYpBWHsede23KMUDPsAjTQvTILmCbPdOlAwmdvyTCTA7X9czX 9IiP+AK95eD1lSALyMj6nPVbY63AL4fsTtkW3UUULE35yXFo7nAC5S7piOepPpYHAOt1 IwBKMI9soKUvOq22fsg48D4pwLwNzI10SwVvcqzh9B3O9aXHrAxh9CuBarf2f4GwM/Pr 55b79bsLbnTyAvYQEvwPuet8oEUKTSF1s/lc4loLORpgJciIefbnftLHqOZpceG8qxyE vO7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=BZMfZVZsjzATZ/tYhM2gPI/xZqJIHKls8Onzav0ccpY=; b=IjV14C671+8jYfKBXFzkuKIx8nQbJXFvh4lmHAffOGIvuY4QlCYoDE1EAZTPjL6GC+ yDLBMYwdxcGcXu/XxQLUiHVXGrpucv5+F7bsacRisoUnJnYlQ11YeYsCadP7s1gzLWEn 7dTAxSmr7dGYFRjhWx2wTSKLdcpKURe+u06y10wRpT5oUrhmyODfasGcDLOKubsIKibX vadkeNIlDnmP1bEuNQBAAtf4kvUUIyCYzMQHpX905X/V1nnTWl+lfDI8n+pHhMfZU5Uc HE3oTFT6M4eXa9zdD58OfQQVVBTmp4Zn/1hlilhtAG40uAFVhk74JOG+7lLq2EdkUPXA o7YQ== 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 nc31-20020a1709071c1f00b0073d67160cb5si1952045ejc.922.2022.08.24.01.45.48; Wed, 24 Aug 2022 01:45:48 -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 7445A68BA56; Wed, 24 Aug 2022 11:44:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D213668BA0A for ; Wed, 24 Aug 2022 11:43:48 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id B929B240D03 for ; Wed, 24 Aug 2022 10:43:44 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id IQqn5hFukLzn for ; Wed, 24 Aug 2022 10:43:44 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 99CA9240D1C for ; Wed, 24 Aug 2022 10:43:41 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 839103A21EA; Wed, 24 Aug 2022 10:43:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Aug 2022 10:43:05 +0200 Message-Id: <20220824084318.333-5-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220824084318.333-1-anton@khirnov.net> References: <20220824084318.333-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/18] lavc/dv: remove ff_dvvideo_init() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5Bt3+60ELU53 The function contains only two assignments, which are simpler to duplicate into decoder and encoder. Additionally, dvdec does not use DVVideoContext.avctx at all. --- libavcodec/dv.c | 10 ---------- libavcodec/dv.h | 2 -- libavcodec/dvdec.c | 4 +++- libavcodec/dvenc.c | 5 ++++- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/libavcodec/dv.c b/libavcodec/dv.c index e2550c4cc1..9e05aa8927 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -184,13 +184,3 @@ int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const AVDVProfile *d) return 0; } - -av_cold int ff_dvvideo_init(AVCodecContext *avctx) -{ - DVVideoContext *s = avctx->priv_data; - - s->avctx = avctx; - avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; - - return 0; -} diff --git a/libavcodec/dv.h b/libavcodec/dv.h index 331b8e846a..2b082d0140 100644 --- a/libavcodec/dv.h +++ b/libavcodec/dv.h @@ -97,8 +97,6 @@ enum dv_pack_type { int ff_dv_init_dynamic_tables(DVVideoContext *s, const AVDVProfile *d); -int ff_dvvideo_init(AVCodecContext *avctx); - static inline int dv_work_pool_size(const AVDVProfile *d) { int size = d->n_difchan * d->difseg_size * 27; diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index bad8419925..daee2347e6 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -240,6 +240,8 @@ static av_cold int dvvideo_decode_init(AVCodecContext *avctx) DVVideoContext *s = avctx->priv_data; int i; + avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; + ff_idctdsp_init(&s->idsp, avctx); for (i = 0; i < 64; i++) @@ -258,7 +260,7 @@ static av_cold int dvvideo_decode_init(AVCodecContext *avctx) ff_thread_once(&init_static_once, dv_init_static); - return ff_dvvideo_init(avctx); + return 0; } /* decode AC coefficients */ diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c index 5ba4de3213..8027feb9b3 100644 --- a/libavcodec/dvenc.c +++ b/libavcodec/dvenc.c @@ -55,6 +55,9 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx) PixblockDSPContext pdsp; int ret; + s->avctx = avctx; + avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; + s->sys = av_dv_codec_profile2(avctx->width, avctx->height, avctx->pix_fmt, avctx->time_base); if (!s->sys) { av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video. " @@ -91,7 +94,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx) } #endif - return ff_dvvideo_init(avctx); + return 0; } /* bit budget for AC only in 5 MBs */