From patchwork Wed Aug 24 08:43:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 37442 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp2371522pzh; Wed, 24 Aug 2022 01:45:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR6qEuSYKQuguIfex0G/0FYXuj+QaIqd2+llCe92c25hjhYvzF9b4daFrT9NhXY8ZzgPBEEF X-Received: by 2002:a17:906:d550:b0:733:8e1a:f7 with SMTP id cr16-20020a170906d55000b007338e1a00f7mr2312196ejc.580.1661330712123; Wed, 24 Aug 2022 01:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661330712; cv=none; d=google.com; s=arc-20160816; b=CNBhKbAqnt+03eO6vJajtfyrr/zldZYCJC5NB7kw3bXmJoRiGei3KuX6h2I40cyDzI PhCqjg7cnA96M1uSKgtc3vPylOgbTbSH38Raxv5E2ytxhJqP9GmaEAG3SGZXUJQOzNcv KhFCLn3nDt0vCiMSNxGwRAAyGXfZfZBXM6fHyrbffaVbqFCoMryBSdJgIWzS+4vVEDL0 OK0pPqLRrsQVDQjQ71kZK3XUmhwvaPkSgqYwAr/uoPRTjD+R8oisX6iZZ/vG7PinAJC3 vWDC68eJNJ9RLvgYfhep+vFbuXEaIixq004ydZ7sualy2kg48CJ4hsbP8J/Rbph9Cq43 xuFQ== 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=BQxxWeINCB4YdlhTcPELBhtMgaMUaXVl+AdlGxpq83M=; b=EtRP/aDP3wkRj6LwG6ApR6ZAXKlBQIVwNwGYn/q5uJHCGVWzlVA+qB5tY8Isc/AT/R qFy2X1tAn1VFNSVoY+Ra3AxNWXAk8vtM4U8uHlxc0AL+v6vgYsERPX69WCEhbizX1Ula gtgeKiKV9QCgzQn6+1suZn0vOMk1L0bzZTHrbETlHOM+lgxhFeuEaJSPD1FGeDEk9ef0 u3BmOndswPfRcxOXVI8tHLDXT/CcqEIMjh6Xc0/o6lE0g2bLBezHRX5tJ3NHhfCOEDbA m65M9YX5zrux6t/zi5rX3abiDOfvQrBJYclCUSp1cLaOKutq9egJpvFvAG+I5CwKdBuX dI4w== 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 cr2-20020a170906d54200b007341ad4b028si2131506ejc.642.2022.08.24.01.45.11; Wed, 24 Aug 2022 01:45:12 -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 4B19868BA44; Wed, 24 Aug 2022 11:43:59 +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 1DB7B68B9E7 for ; Wed, 24 Aug 2022 11:43:50 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id C12AD240D22 for ; Wed, 24 Aug 2022 10:43:47 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 4XI-VTgPL3wa for ; Wed, 24 Aug 2022 10:43:47 +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 D41C8240D24 for ; Wed, 24 Aug 2022 10:43:41 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 8C5C33A2209; Wed, 24 Aug 2022 10:43:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Aug 2022 10:43:07 +0200 Message-Id: <20220824084318.333-7-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 07/18] lavc/dv: do not pass DVVideoContext to dv_calculate_mb_xy() 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: Jsy9HR/kejqL Pass the two variables needed from it directly. This is done in preparation to splitting DVVideoContext. --- libavcodec/dv.h | 5 +++-- libavcodec/dvdec.c | 2 +- libavcodec/dvenc.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/dv.h b/libavcodec/dv.h index 286b267de2..6430688795 100644 --- a/libavcodec/dv.h +++ b/libavcodec/dv.h @@ -107,7 +107,8 @@ static inline int dv_work_pool_size(const AVDVProfile *d) return size; } -static inline void dv_calculate_mb_xy(const DVVideoContext *s, +static inline void dv_calculate_mb_xy(const AVDVProfile *sys, + const uint8_t *buf, const DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y) { @@ -116,7 +117,7 @@ static inline void dv_calculate_mb_xy(const DVVideoContext *s, /* We work with 720p frames split in half. * The odd half-frame (chan == 2,3) is displaced :-( */ - if (s->sys->height == 720 && !(s->buf[1] & 0x0C)) + if (sys->height == 720 && !(buf[1] & 0x0C)) /* shifting the Y coordinate down by 72/2 macro blocks */ *mb_y -= (*mb_y > 17) ? 18 : -72; } diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index 1e2c097ed0..7f9e4eb0c0 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -535,7 +535,7 @@ retry: block = &sblock[0][0]; mb = mb_data; for (mb_index = 0; mb_index < 5; mb_index++) { - dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y); + dv_calculate_mb_xy(s->sys, s->buf, work_chunk, mb_index, &mb_x, &mb_y); /* idct_put'ting luminance */ if ((s->sys->pix_fmt == AV_PIX_FMT_YUV420P) || diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c index 712ca325de..c12fce9e8b 100644 --- a/libavcodec/dvenc.c +++ b/libavcodec/dvenc.c @@ -866,7 +866,7 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg) p = dif = &s->buf[work_chunk->buf_offset * 80]; enc_blk = &enc_blks[0]; for (mb_index = 0; mb_index < 5; mb_index++) { - dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y); + dv_calculate_mb_xy(s->sys, s->buf, work_chunk, mb_index, &mb_x, &mb_y); qnos[mb_index] = DV_PROFILE_IS_HD(s->sys) ? 1 : 15;