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 08/14] avcodec/utvideo: Split UTvideoContext into decoder and encoder contexts
Date: Thu, 28 Sep 2023 23:35:42 +0200
Message-ID: <AS8P250MB07448942B61D08087F1CB1AB8FC1A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB0744136FB53B9E573DD249D68FC1A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

In particular the encoder used only a small part of the context:
The new encoder context is only 128B here. It used to be 32992.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/utvideo.h    | 35 +----------------------------------
 libavcodec/utvideodec.c | 28 ++++++++++++++++++++++++++++
 libavcodec/utvideoenc.c | 18 +++++++++++++++++-
 3 files changed, 46 insertions(+), 35 deletions(-)

diff --git a/libavcodec/utvideo.h b/libavcodec/utvideo.h
index e5160aa394..b081b50a2f 100644
--- a/libavcodec/utvideo.h
+++ b/libavcodec/utvideo.h
@@ -27,12 +27,7 @@
  * Common Ut Video header
  */
 
-#include "libavutil/common.h"
-#include "avcodec.h"
-#include "bswapdsp.h"
-#include "utvideodsp.h"
-#include "lossless_videodsp.h"
-#include "lossless_videoencdsp.h"
+#include "libavutil/macros.h"
 
 enum {
     PRED_NONE = 0,
@@ -61,32 +56,4 @@ enum {
     UTVIDEO_444  = MKTAG('Y', 'V', '2', '4'),
 };
 
-typedef struct UtvideoContext {
-    const AVClass *class;
-    AVCodecContext *avctx;
-    UTVideoDSPContext utdsp;
-    BswapDSPContext bdsp;
-    LLVidDSPContext llviddsp;
-    LLVidEncDSPContext llvidencdsp;
-
-    uint32_t frame_info_size, flags, frame_info, offset;
-    int      planes;
-    int      slices;
-    int      compression;
-    int      interlaced;
-    int      frame_pred;
-    int      pro;
-    int      pack;
-
-    ptrdiff_t slice_stride;
-    uint8_t *slice_bits, *slice_buffer[4];
-    int      slice_bits_size;
-    void    *buffer;
-
-    const uint8_t *packed_stream[4][256];
-    size_t packed_stream_size[4][256];
-    const uint8_t *control_stream[4][256];
-    size_t control_stream_size[4][256];
-} UtvideoContext;
-
 #endif /* AVCODEC_UTVIDEO_H */
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 7ee07209d4..fa80cc577c 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -37,8 +37,36 @@
 #include "bytestream.h"
 #include "codec_internal.h"
 #include "get_bits.h"
+#include "lossless_videodsp.h"
 #include "thread.h"
 #include "utvideo.h"
+#include "utvideodsp.h"
+
+typedef struct UtvideoContext {
+    const AVClass *class;
+    AVCodecContext *avctx;
+    UTVideoDSPContext utdsp;
+    BswapDSPContext bdsp;
+    LLVidDSPContext llviddsp;
+
+    uint32_t frame_info_size, flags, frame_info, offset;
+    int      planes;
+    int      slices;
+    int      compression;
+    int      interlaced;
+    int      frame_pred;
+    int      pro;
+    int      pack;
+
+    uint8_t *slice_bits;
+    int      slice_bits_size;
+    void    *buffer;
+
+    const uint8_t *packed_stream[4][256];
+    size_t packed_stream_size[4][256];
+    const uint8_t *control_stream[4][256];
+    size_t control_stream_size[4][256];
+} UtvideoContext;
 
 typedef struct HuffEntry {
     uint8_t len;
diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index 6e87bbc2b6..c2a7728574 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -33,11 +33,28 @@
 #include "encode.h"
 #include "bswapdsp.h"
 #include "bytestream.h"
+#include "lossless_videoencdsp.h"
 #include "put_bits.h"
 #include "mathops.h"
 #include "utvideo.h"
 #include "huffman.h"
 
+typedef struct UtvideoContext {
+    const AVClass *class;
+    BswapDSPContext bdsp;
+    LLVidEncDSPContext llvidencdsp;
+
+    uint32_t frame_info_size, flags;
+    int      planes;
+    int      slices;
+    int      compression;
+    int      frame_pred;
+
+    ptrdiff_t slice_stride;
+    uint8_t *slice_bits, *slice_buffer[4];
+    int      slice_bits_size;
+} UtvideoContext;
+
 typedef struct HuffEntry {
     uint16_t sym;
     uint8_t  len;
@@ -76,7 +93,6 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
     int i, subsampled_height;
     uint32_t original_format;
 
-    c->avctx           = avctx;
     c->frame_info_size = 4;
     c->slice_stride    = FFALIGN(avctx->width, 32);
 
-- 
2.34.1

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

  parent reply	other threads:[~2023-09-28 21:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 21:32 [FFmpeg-devel] [PATCH 01/14] configure: Remove obsolete wmavoice->rdft, dct dependencies Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 02/14] configure: Remove obsolete ffplay->rdft dependency Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 03/14] configure: Remove unnecessary vf_spp->fft dependency Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 04/14] avcodec/mpegaudiodsp: Init dct32 directly Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 06/14] configure: Remove dct, fft, mdct, rdft subsystems Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 07/14] avcodec/vorbis: Use void* logctx instead of AVCodecContext* Andreas Rheinhardt
2023-09-30 10:28   ` Andreas Rheinhardt
2023-09-28 21:35 ` Andreas Rheinhardt [this message]
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 09/14] avcodec/sipr: Remove write-only AVCodecContext* Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 10/14] avcodec/roqvideo: Use void*, not AVCodecContext* for logctx Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 11/14] avcodec/opus_silk: Use void* instead of AVCodecContext* as logctx Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 12/14] avcodec/lagarith: " Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 13/14] avcodec/flac_parse: " Andreas Rheinhardt
2023-09-28 21:35 ` [FFmpeg-devel] [PATCH 14/14] avcodec/bgmc: " Andreas Rheinhardt
2023-09-28 21:42 ` [FFmpeg-devel] [PATCH 01/14] configure: Remove obsolete wmavoice->rdft, dct dependencies Andreas Rheinhardt
2023-09-28 21:59   ` Lynne
2023-09-28 22:11     ` Andreas Rheinhardt
2023-09-28 23:26       ` Lynne

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=AS8P250MB07448942B61D08087F1CB1AB8FC1A@AS8P250MB0744.EURP250.PROD.OUTLOOK.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