[FFmpeg-devel] [PATCH 41/45] avcodec/smvjpegdec: Remove unused MJpegDecodeContext

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Nov 27 03:02:45 EET 2020


The SMV JPEG uses the Motion JPEG decoder internally, but it does so
by opening a decoder instance via avcodec_open2(); this means that the
Motion JPEG decoder has its own context and its own private data; so
there is no need to add a MJpegDecodeContext at the beginning of the SMV
JPEG decoder's structure. In other words: The one that is already there
can be removed (it is unused anyway).

This reduces sizeof(SMVJpegDecodeContext) from 4576 to 32 bytes here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/smvjpegdec.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
index c134fdc685..72c8f34370 100644
--- a/libavcodec/smvjpegdec.c
+++ b/libavcodec/smvjpegdec.c
@@ -25,14 +25,14 @@
  */
 
 // #define DEBUG
+#include "libavutil/avassert.h"
+#include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 #include "libavutil/opt.h"
 #include "libavutil/imgutils.h"
-#include "mjpegdec.h"
 #include "internal.h"
 
 typedef struct SMVJpegDecodeContext {
-    MJpegDecodeContext jpg;
     AVFrame *picture[2]; /* pictures array */
     AVCodecContext* avctx;
     int frames_per_jpeg;
@@ -78,9 +78,7 @@ static inline void smv_img_pnt(uint8_t *dst_data[4], uint8_t *src_data[4],
 static av_cold int smvjpeg_decode_end(AVCodecContext *avctx)
 {
     SMVJpegDecodeContext *s = avctx->priv_data;
-    MJpegDecodeContext *jpg = &s->jpg;
 
-    jpg->picture_ptr = NULL;
     av_frame_free(&s->picture[0]);
     av_frame_free(&s->picture[1]);
     avcodec_free_context(&s->avctx);
@@ -108,8 +106,6 @@ static av_cold int smvjpeg_decode_init(AVCodecContext *avctx)
     if (!s->picture[1])
         return AVERROR(ENOMEM);
 
-    s->jpg.picture_ptr      = s->picture[0];
-
     codec = avcodec_find_decoder(AV_CODEC_ID_MJPEG);
     if (!codec) {
         av_log(avctx, AV_LOG_ERROR, "MJPEG codec not found\n");
-- 
2.25.1



More information about the ffmpeg-devel mailing list