summaryrefslogtreecommitdiff
path: root/libavcodec/mjpegenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-22 01:03:46 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-04 16:28:54 +0100
commit410af1caa34838ab36ceeab83f82b0ef8df823ba (patch)
tree9d7f9ea2960e158dc01827f4737200a96975842b /libavcodec/mjpegenc.c
parentbe736e42372ddb311ff6d7bf8898f67bf3a20793 (diff)
avcodec/mjpegenc: Add wrapper for ff_mjpeg_encode_picture_header()
This factors the translation from MpegEncContext out and will enable further optimizations in the next commits. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mjpegenc.c')
-rw-r--r--libavcodec/mjpegenc.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 57f249f56e..152919f4c8 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -74,6 +74,19 @@ static av_cold void init_uni_ac_vlc(const uint8_t huff_size_ac[256],
}
}
+static void mjpeg_encode_picture_header(MpegEncContext *s)
+{
+ ff_mjpeg_encode_picture_header(s->avctx, &s->pb, &s->intra_scantable,
+ s->pred, s->intra_matrix, s->chroma_intra_matrix);
+}
+
+void ff_mjpeg_amv_encode_picture_header(MpegEncContext *s)
+{
+ /* s->huffman == HUFFMAN_TABLE_OPTIMAL can only be true for MJPEG. */
+ if (!CONFIG_MJPEG_ENCODER || s->huffman != HUFFMAN_TABLE_OPTIMAL)
+ mjpeg_encode_picture_header(s);
+}
+
#if CONFIG_MJPEG_ENCODER
/**
* Encodes and outputs the entire frame in the JPEG format.
@@ -213,8 +226,7 @@ int ff_mjpeg_encode_stuffing(MpegEncContext *s)
s->intra_chroma_ac_vlc_length =
s->intra_chroma_ac_vlc_last_length = m->uni_chroma_ac_vlc_len;
- ff_mjpeg_encode_picture_header(s->avctx, &s->pb, &s->intra_scantable,
- s->pred, s->intra_matrix, s->chroma_intra_matrix);
+ mjpeg_encode_picture_header(s);
mjpeg_encode_picture_frame(s);
}
#endif