summaryrefslogtreecommitdiff
path: root/src/libffmpeg/libavcodec/mjpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libffmpeg/libavcodec/mjpeg.c')
-rw-r--r--src/libffmpeg/libavcodec/mjpeg.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/libffmpeg/libavcodec/mjpeg.c b/src/libffmpeg/libavcodec/mjpeg.c
index 30029d40c..255a82d2c 100644
--- a/src/libffmpeg/libavcodec/mjpeg.c
+++ b/src/libffmpeg/libavcodec/mjpeg.c
@@ -862,13 +862,11 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
memset(&s2, 0, sizeof(MpegEncContext));
s2.avctx= avctx;
// s2->out_format = FMT_MJPEG;
- s2.width = 8;
- s2.height = 8;
- if (MPV_common_init(&s2) < 0)
- return -1;
+ dsputil_init(&s2.dsp, avctx);
+ DCT_common_init(&s2);
+
s->scantable= s2.intra_scantable;
s->idct_put= s2.dsp.idct_put;
- MPV_common_end(&s2);
s->mpeg_enc_ctx_allocated = 0;
s->buffer_size = 102400; /* smaller buffer should be enough,
@@ -1532,15 +1530,22 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
if (id == ff_get_fourcc("JFIF"))
{
- int t_w, t_h;
+ int t_w, t_h, v1, v2;
skip_bits(&s->gb, 8); /* the trailing zero-byte */
- av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x)\n",
- get_bits(&s->gb, 8), get_bits(&s->gb, 8));
+ v1= get_bits(&s->gb, 8);
+ v2= get_bits(&s->gb, 8);
skip_bits(&s->gb, 8);
s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 16);
s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 16);
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO)
+ av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\n",
+ v1, v2,
+ s->avctx->sample_aspect_ratio.num,
+ s->avctx->sample_aspect_ratio.den
+ );
+
t_w = get_bits(&s->gb, 8);
t_h = get_bits(&s->gb, 8);
if (t_w && t_h)
@@ -1555,7 +1560,8 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
if (id == ff_get_fourcc("Adob") && (get_bits(&s->gb, 8) == 'e'))
{
- av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n");
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO)
+ av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n");
skip_bits(&s->gb, 16); /* version */
skip_bits(&s->gb, 16); /* flags0 */
skip_bits(&s->gb, 16); /* flags1 */
@@ -1565,7 +1571,8 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
}
if (id == ff_get_fourcc("LJIF")){
- av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n");
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO)
+ av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n");
skip_bits(&s->gb, 16); /* version ? */
skip_bits(&s->gb, 16); /* unknwon always 0? */
skip_bits(&s->gb, 16); /* unknwon always 0? */
@@ -1604,7 +1611,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
skip_bits(&s->gb, 32); /* scan off */
skip_bits(&s->gb, 32); /* data off */
#endif
- if (s->first_picture)
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n");
}
}
@@ -1635,7 +1642,8 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
else
cbuf[i] = 0;
- av_log(s->avctx, AV_LOG_INFO, "mjpeg comment: '%s'\n", cbuf);
+ if(s->avctx->debug & FF_DEBUG_PICT_INFO)
+ av_log(s->avctx, AV_LOG_INFO, "mjpeg comment: '%s'\n", cbuf);
/* buggy avid, it puts EOI only at every 10th frame */
if (!strcmp(cbuf, "AVID"))
@@ -1781,13 +1789,12 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
/* process markers */
if (start_code >= 0xd0 && start_code <= 0xd7) {
dprintf("restart marker: %d\n", start_code&0x0f);
- } else if (s->first_picture) {
/* APP fields */
- if (start_code >= 0xe0 && start_code <= 0xef)
- mjpeg_decode_app(s);
+ } else if (start_code >= APP0 && start_code <= APP15) {
+ mjpeg_decode_app(s);
/* Comment */
- else if (start_code == COM)
- mjpeg_decode_com(s);
+ } else if (start_code == COM){
+ mjpeg_decode_com(s);
}
switch(start_code) {