Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 1/7] avcodec/error_resilience: Only keep what is needed from MECmpContext
Date: Mon, 16 May 2022 20:36:54 +0200
Message-ID: <DB6PR0101MB2214BE29F2EBC41AEBFC22DF8FCF9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw)

ERContext currently has an embedded MECmpContext, despite only
needing exactly one function from it. This is wasteful because
MECmpContext is pretty large (135 pointers, 1080 B for eight byte
pointers). So keep only what is needed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/error_resilience.c | 14 ++++++++------
 libavcodec/error_resilience.h |  3 ++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index e9764f8d96..f957c68d2c 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -766,12 +766,12 @@ static int is_intra_more_likely(ERContext *s)
                 } else {
                     ff_thread_await_progress(s->last_pic.tf, mb_y, 0);
                 }
-                is_intra_likely += s->mecc.sad[0](NULL, last_mb_ptr, mb_ptr,
-                                                  linesize[0], 16);
+                is_intra_likely += s->sad(NULL, last_mb_ptr, mb_ptr,
+                                          linesize[0], 16);
                 // FIXME need await_progress() here
-                is_intra_likely -= s->mecc.sad[0](NULL, last_mb_ptr,
-                                                  last_mb_ptr + linesize[0] * 16,
-                                                  linesize[0], 16);
+                is_intra_likely -= s->sad(NULL, last_mb_ptr,
+                                          last_mb_ptr + linesize[0] * 16,
+                                          linesize[0], 16);
             } else {
                 if (IS_INTRA(s->cur_pic.mb_type[mb_xy]))
                    is_intra_likely++;
@@ -790,7 +790,9 @@ void ff_er_frame_start(ERContext *s)
         return;
 
     if (!s->mecc_inited) {
-        ff_me_cmp_init(&s->mecc, s->avctx);
+        MECmpContext mecc;
+        ff_me_cmp_init(&mecc, s->avctx);
+        s->sad = mecc.sad[0];
         s->mecc_inited = 1;
     }
 
diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h
index 2187586618..53e5cf2621 100644
--- a/libavcodec/error_resilience.h
+++ b/libavcodec/error_resilience.h
@@ -52,7 +52,8 @@ typedef struct ERPicture {
 
 typedef struct ERContext {
     AVCodecContext *avctx;
-    MECmpContext mecc;
+
+    me_cmp_func sad;
     int mecc_inited;
 
     int *mb_index2xy;
-- 
2.32.0

_______________________________________________
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".

             reply	other threads:[~2022-05-16 18:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 18:36 Andreas Rheinhardt [this message]
2022-05-16 18:38 ` [FFmpeg-devel] [PATCH 2/7] avcodec/mss2: Remove write-only QpelDSPContext Andreas Rheinhardt
2022-05-16 18:38 ` [FFmpeg-devel] [PATCH 3/7] avcodec/mpegvideo: Move float.h inclusion to mpegvideoenc.h Andreas Rheinhardt
2022-05-16 18:38 ` [FFmpeg-devel] [PATCH 4/7] avcodec/mpegvideoenc: Remove ineffective [pb]bias options Andreas Rheinhardt
2022-05-19 18:16   ` Andreas Rheinhardt
2022-05-16 18:38 ` [FFmpeg-devel] [PATCH 5/7] avcodec/mjpegenc: Remove pointless motion-estimation options Andreas Rheinhardt
2022-05-16 18:38 ` [FFmpeg-devel] [PATCH 6/7] avcodec/mpegvideoenc: Remove ineffective options Andreas Rheinhardt
2022-05-16 18:39 ` [FFmpeg-devel] [PATCH 7/7] avcodec/mjpegenc: Remove ineffective pred option Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB6PR0101MB2214BE29F2EBC41AEBFC22DF8FCF9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git