aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-09-28 21:16:29 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-01 01:01:50 +0200
commitb2f5899ec2062f209b9a4d4277910678c6d55f79 (patch)
tree976489a192f33c1caee371c2f2467754e3daaefb /libavcodec
parent0e18f1e9a3c1abefc0a945727490550427cee2cb (diff)
downloadffmpeg-b2f5899ec2062f209b9a4d4277910678c6d55f79.tar.gz
avcodec/utvideo: Split UTvideoContext into decoder and encoder contexts
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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/utvideo.h35
-rw-r--r--libavcodec/utvideodec.c27
-rw-r--r--libavcodec/utvideoenc.c18
3 files changed, 45 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..16f51e4b47 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -37,8 +37,35 @@
#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 {
+ 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..1fcb6854f2 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);