From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id A0A394F15D for ; Sun, 15 Jun 2025 16:57:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 4BC4E68D773; Sun, 15 Jun 2025 19:56:15 +0300 (EEST) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 2B9B168D731 for ; Sun, 15 Jun 2025 19:56:13 +0300 (EEST) Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-b26df8f44e6so3876890a12.2 for ; Sun, 15 Jun 2025 09:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750006571; x=1750611371; darn=ffmpeg.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:from:to:cc:subject:date :message-id:reply-to; bh=aZv/oD9ZCMACehpa61E9rjn/N4AvIbhskLTPHPs4Oes=; b=jZR6XfjqmIturrkT19esel9bVdgImXyzeKokBMoapsFubxKVzzRjV7hv5XDUaNx3Z+ 97EMTcglMWyVjOwz8HjM2rpJXubaxb5yRc50kBPA/ls8gytJEHJMCylO5LkxmQP7bnsd AFoj6bKJlamqDh9MNJng/fYZ176iSQ2EQ4V0W84PYEJ7V+rNJXINlyRKC2g1R/70vqFf Y74G2mY30u+MYnLQio7FkxeBHlDXE/tOdFn94tRsj5ZuPb8kJuLIR4Ta4hPd+VclLPgx w4a7mobf9Q7FtWJSxwQuGBMGH7k49V89UD5/s3BkIvU03kZU++2aJAFz+9DXHy/7cEbo 1nNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750006571; x=1750611371; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=aZv/oD9ZCMACehpa61E9rjn/N4AvIbhskLTPHPs4Oes=; b=DoAiS1JlVZA+wsTOT+FEzBVODOiD4HK3sXmkHiq+fHWa+TDM7d1QkW1EKckff4GzTy hpAUNdH0ZcsuDZvbFGF8HzAWKnFV3ZJKVSCi6LLCid1AJDe/G3rCtlKK8QZP/bSnMg4Q 7YIcM+ToILuJTBgqHd6mBwG0votm+cMV9opi/9gtRW+nD9xiZumuw1h+GIfUxwJluOT2 1vDcqxrv3Z6xP/DORrdr/Jk2K1SoK/ESVDEbVyUnd3QuwcTls2hRVX1ZsajGQRZbsMry Yi1gVW38SpaQAnfFh1TZC58YCSzoQBlMws8HeBAP1d74xrWMqcgd6CWGUh+puNT0hRid SfUw== X-Gm-Message-State: AOJu0YxcTkJ9JmU4Tk+01tbtpyl5UyKjy1PzII7cyx2otMbLIgqZ4i4s nCHa5vMznzm4eS3K118TEbuOZwiiLohbA1gRvV1sX5xICe76Mi2yH7THRE/zYA== X-Gm-Gg: ASbGncsM1+QTFTQmlE17PRiN/vrYClfbxIlOcxT2pJRozD89V+zBfiyUGg74fHhkLnL LGiRsJmZcm7ZsXe/HF+SrJj4lx8iUViDDdHlEbHbyltmV8hJaZR+O1t3bflnQMWrXvhzg1O1Yx0 ySlWc2iV0iCmnJgN93cOv8jlM0YFkjzpfs36mFkD7vwQvLsrqYKNbfQMhyfJ7ZcK6xL8zRviGXi b61/brtzWfaDPp7GDDSuFsEQy/ZZ9dmq+qi5hZ0lwdl9uIJR226udM0ABYGGgGWNMqWK9j5GR9D Hdtw7JgC91RLZa7A4vRryVviDSWYwq/4ccO9iiz8MjZPrtGkGleK+2uXDWOKvHwbycJpf8phF0j BvKGH6ctBdrqWhjiO X-Google-Smtp-Source: AGHT+IGHZAPDm/LbplHBbjQbWgnVm8MGXMOV/XPDxXigGyaroKUNw9Iu3ipQlL/Xu/H0LBI/YPdNqg== X-Received: by 2002:a17:90b:1b48:b0:311:df4b:4b91 with SMTP id 98e67ed59e1d1-313f1ca77e4mr10997016a91.7.1750006571303; Sun, 15 Jun 2025 09:56:11 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-313a6877cfesm7061356a91.1.2025.06.15.09.56.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Jun 2025 09:56:10 -0700 (PDT) From: Andreas Rheinhardt X-Google-Original-From: Andreas Rheinhardt Message-Id: In-Reply-To: References: Date: Sun, 15 Jun 2025 16:54:06 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 15/47] avcodec/svq1enc: Stop calling ff_mpv_common_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 Cc: Andreas Rheinhardt Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Andreas Rheinhardt It is not really needed, as none of the buffers allocated in ff_mpv_common_init() are used lateron; in fact, ff_mpv_common_init() is called with MpegEncContext.width and height equal to zero (as well as encoding equal to zero, so that the error resilience parts are initialized...), so that all the buffers are too small anyway. The call to ff_mpv_common_init() has been added in commit f6774f905fb3cfdc319523ac640be30b14c1bc55 in order to allocate {current,last,new}_picture.f (an AVFrame). Yet this is unnecessary since 7814dd77aa61703e3d43fc72bfaf6a9fbc42ff9c. The only task that ff_mpv_common_init() does that may be used is initializing the HpelDSPContext embedded in the MpegEncContext. In fact, it was not initialized before f6774f905fb3cfdc319523ac640be30b14c1bc55 and not initializing it passes FATE, yet I can't prove that it is indeed unnecessary. Therefore it is still initialized and used instead of SVQ1EncContext.hdsp. Signed-off-by: Andreas Rheinhardt --- libavcodec/svq1enc.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 948a7c41eb..e3061baff4 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -62,7 +62,6 @@ typedef struct SVQ1EncContext { MPVEncContext m; AVCodecContext *avctx; MECmpContext mecc; - HpelDSPContext hdsp; AVFrame *current_picture; AVFrame *last_picture; @@ -468,10 +467,10 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, dxy = (mx & 1) + 2 * (my & 1); - s->hdsp.put_pixels_tab[0][dxy](temp + 16*stride, - ref + (mx >> 1) + - stride * (my >> 1), - stride, 16); + s2->hdsp.put_pixels_tab[0][dxy](temp + 16*stride, + ref + (mx >> 1) + + stride * (my >> 1), + stride, 16); score[1] += encode_block(s, src + 16 * x, temp + 16*stride, decoded, stride, 5, 64, lambda, 0); @@ -482,7 +481,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, score[2] += SVQ1_BLOCK_SKIP_LEN * lambda; if (score[2] < score[best] && mx == 0 && my == 0) { best = 2; - s->hdsp.put_pixels_tab[0][0](decoded, ref, stride, 16); + s2->hdsp.put_pixels_tab[0][0](decoded, ref, stride, 16); put_bits(pb, SVQ1_BLOCK_SKIP_LEN, SVQ1_BLOCK_SKIP_CODE); } } @@ -511,7 +510,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, ff_copy_bits(pb, reorder_buffer[best][i], count[best][i]); if (best == 0) - s->hdsp.put_pixels_tab[0][0](decoded, temp, stride, 16); + s2->hdsp.put_pixels_tab[0][0](decoded, temp, stride, 16); } s2->first_slice_line = 0; } @@ -533,9 +532,6 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx) av_freep(&s->dummy); av_freep(&s->scratchbuf); - s->m.mb_type = NULL; - ff_mpv_common_end(&s->m.c); - for (i = 0; i < 3; i++) { av_freep(&s->motion_val8[i]); av_freep(&s->motion_val16[i]); @@ -571,7 +567,7 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx) return AVERROR(EINVAL); } - ff_hpeldsp_init(&s->hdsp, avctx->flags); + ff_hpeldsp_init(&s->m.c.hdsp, avctx->flags); ff_me_cmp_init(&s->mecc, avctx); ret = ff_me_init(&s->m.me, avctx, &s->mecc, 0); if (ret < 0) @@ -605,10 +601,6 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx) s->avctx = avctx; s->m.c.avctx = avctx; - ret = ff_mpv_common_init(&s->m.c); - if (ret < 0) - return ret; - for (size_t plane = 0; plane < FF_ARRAY_ELEMS(s->motion_val16); ++plane) { const int shift = plane ? 2 : 0; unsigned block_height = ((s->frame_height >> shift) + 15U) / 16; -- ffmpeg-codebot _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".