aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-06 14:24:06 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-12-06 14:31:23 +0100
commit2b215f39391c0f9ddb547d16d568776e9e5da54d (patch)
treede093856d64626144ceb9c8a345ad6e4efd0b8f2 /libavcodec/mjpegenc.c
parent535af2c22211567bb237525f89d058b5b08e33b1 (diff)
downloadffmpeg-2b215f39391c0f9ddb547d16d568776e9e5da54d.tar.gz
mjpeg/ljpegenc: factor ff_mjpeg_init_hvsample() out
This reduces the amount of duplicated code Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegenc.c')
-rw-r--r--libavcodec/mjpegenc.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index a78123bcfa..ffc29fd41f 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -204,14 +204,9 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
}
}
-void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
- ScanTable *intra_scantable,
- uint16_t intra_matrix[64])
+void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[3], int vsample[3])
{
int chroma_h_shift, chroma_v_shift;
- const int lossless = avctx->codec_id != AV_CODEC_ID_MJPEG && avctx->codec_id != AV_CODEC_ID_AMV;
- int hsample[3], vsample[3];
- int i;
av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift,
&chroma_v_shift);
@@ -233,6 +228,17 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
hsample[1] = 2 >> chroma_h_shift;
hsample[2] = 2 >> chroma_h_shift;
}
+}
+
+void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
+ ScanTable *intra_scantable,
+ uint16_t intra_matrix[64])
+{
+ const int lossless = avctx->codec_id != AV_CODEC_ID_MJPEG && avctx->codec_id != AV_CODEC_ID_AMV;
+ int hsample[3], vsample[3];
+ int i;
+
+ ff_mjpeg_init_hvsample(avctx, hsample, vsample);
put_marker(pb, SOI);