]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mjpeg.c
Use correct dequantizer value
[ffmpeg] / libavcodec / mjpeg.c
index fc79772f3f0ef4926e8c72e2bdfd1caf973672df..214fc08a9e58561b30a346cd31a67673024e1850 100644 (file)
@@ -22,7 +22,7 @@
  *
  * Support for external huffman table, various fixes (AVID workaround),
  * aspecting, new decode_frame mechanism and apple mjpeg-b support
- *                                  by Alex Beregszaszi <alex@naxine.org>
+ *                                  by Alex Beregszaszi
  */
 
 /**
@@ -1005,7 +1005,7 @@ static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
 
 static int jpeg_parse(AVCodecParserContext *s,
                            AVCodecContext *avctx,
-                           uint8_t **poutbuf, int *poutbuf_size,
+                           const uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size)
 {
     ParseContext *pc = s->priv_data;
@@ -1013,13 +1013,13 @@ static int jpeg_parse(AVCodecParserContext *s,
 
     next= find_frame_end(pc, buf, buf_size);
 
-    if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
+    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
         *poutbuf = NULL;
         *poutbuf_size = 0;
         return buf_size;
     }
 
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
@@ -1760,7 +1760,7 @@ static int mjpeg_decode_dri(MJpegDecodeContext *s)
 
 static int mjpeg_decode_app(MJpegDecodeContext *s)
 {
-    int len, id;
+    int len, id, i;
 
     len = get_bits(&s->gb, 16);
     if (len < 5)
@@ -1791,7 +1791,9 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
             s->buggy_avid = 1;
 //        if (s->first_picture)
 //            printf("mjpeg: workarounding buggy AVID\n");
-        s->bottom_field = get_bits(&s->gb, 8) == 2;
+        i = get_bits(&s->gb, 8);
+        if     (i==2) s->bottom_field= 1;
+        else if(i==1) s->bottom_field= 0;
 #if 0
         skip_bits(&s->gb, 8);
         skip_bits(&s->gb, 32);
@@ -2624,6 +2626,7 @@ AVCodec ljpeg_encoder = { //FIXME avoid MPV_* lossless jpeg shouldnt need them
 };
 #endif
 
+#ifdef CONFIG_MJPEG_PARSER
 AVCodecParser mjpeg_parser = {
     { CODEC_ID_MJPEG },
     sizeof(ParseContext),
@@ -2631,6 +2634,7 @@ AVCodecParser mjpeg_parser = {
     jpeg_parse,
     ff_parse_close,
 };
+#endif
 
 AVBitStreamFilter mjpega_dump_header_bsf = {
     "mjpegadump",