diff mbox series

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

Message ID 20201127010249.2724610-41-andreas.rheinhardt@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,01/45] avcodec/a64multienc: Fix memleak upon init failure
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 27, 2020, 1:02 a.m. UTC
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@gmail.com>
---
 libavcodec/smvjpegdec.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff mbox series

Patch

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");