[FFmpeg-cvslog] lavc/mjpeg: Add profiles for MJPEG using SOF marker codes

Mark Thompson git at videolan.org
Thu Feb 22 01:47:46 EET 2018


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Thu Nov 23 22:44:27 2017 +0000| [9ca79784e9e640829645b0b28201cf9cdfbfc0f4] | committer: Mark Thompson

lavc/mjpeg: Add profiles for MJPEG using SOF marker codes

This is needed by later hwaccel code to tell which encoding process was
used for a particular frame, because hardware decoders may only support a
subset of possible methods.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ca79784e9e640829645b0b28201cf9cdfbfc0f4
---

 libavcodec/avcodec.h                 | 6 ++++++
 libavcodec/mjpegdec.c                | 7 +++++++
 libavcodec/version.h                 | 4 ++--
 tests/ref/fate/api-mjpeg-codec-param | 4 ++--
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index bc0eacd66b..74c7b9dadd 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2918,6 +2918,12 @@ typedef struct AVCodecContext {
 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE          3
 #define FF_PROFILE_HEVC_REXT                        4
 
+#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT            0xc0
+#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
+#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT         0xc2
+#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS                0xc3
+#define FF_PROFILE_MJPEG_JPEG_LS                         0xf7
+
     /**
      * level
      * - encoding: Set by user.
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 5055ee2826..29f99373cc 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2288,6 +2288,10 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             break;
         case SOF0:
         case SOF1:
+            if (start_code == SOF0)
+                s->avctx->profile = FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT;
+            else
+                s->avctx->profile = FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT;
             s->lossless    = 0;
             s->ls          = 0;
             s->progressive = 0;
@@ -2295,6 +2299,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                 goto fail;
             break;
         case SOF2:
+            s->avctx->profile = FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT;
             s->lossless    = 0;
             s->ls          = 0;
             s->progressive = 1;
@@ -2302,6 +2307,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                 goto fail;
             break;
         case SOF3:
+            s->avctx->profile     = FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS;
             s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
             s->lossless    = 1;
             s->ls          = 0;
@@ -2310,6 +2316,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                 goto fail;
             break;
         case SOF48:
+            s->avctx->profile     = FF_PROFILE_MJPEG_JPEG_LS;
             s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
             s->lossless    = 1;
             s->ls          = 1;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index d13dd41fa3..d772f3e48e 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  11
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR  12
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/tests/ref/fate/api-mjpeg-codec-param b/tests/ref/fate/api-mjpeg-codec-param
index e5ad2b7656..290f941ff3 100644
--- a/tests/ref/fate/api-mjpeg-codec-param
+++ b/tests/ref/fate/api-mjpeg-codec-param
@@ -81,7 +81,7 @@ stream=0, decode=0
     nssew=8
     skip_top=0
     skip_bottom=0
-    profile=-99
+    profile=192
     level=-99
     lowres=0
     skip_threshold=0
@@ -221,7 +221,7 @@ stream=0, decode=1
     nssew=8
     skip_top=0
     skip_bottom=0
-    profile=-99
+    profile=192
     level=-99
     lowres=0
     skip_threshold=0



More information about the ffmpeg-cvslog mailing list