[FFmpeg-cvslog] Merge commit 'ff9db5cfd14558df9cfcc54d6c062bc34bf1f341'

Clément Bœsch git at videolan.org
Sat Apr 8 15:43:25 EEST 2017


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sat Apr  8 14:41:10 2017 +0200| [883fe17e3bef8ae176876273bef6b7a81f413bc7] | committer: Clément Bœsch

Merge commit 'ff9db5cfd14558df9cfcc54d6c062bc34bf1f341'

* commit 'ff9db5cfd14558df9cfcc54d6c062bc34bf1f341':
  lavc: Use a stricter check for the color properties values

Merged-by: Clément Bœsch <u at pkh.me>

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

 libavcodec/h264_ps.c | 8 +++++---
 libavcodec/hevc_ps.c | 6 +++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 7e66ed7..7858361 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -168,11 +168,13 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
             sps->color_primaries = get_bits(gb, 8); /* colour_primaries */
             sps->color_trc       = get_bits(gb, 8); /* transfer_characteristics */
             sps->colorspace      = get_bits(gb, 8); /* matrix_coefficients */
-            if (sps->color_primaries >= AVCOL_PRI_NB)
+
+            // Set invalid values to "unspecified"
+            if (!av_color_primaries_name(sps->color_primaries))
                 sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
-            if (sps->color_trc >= AVCOL_TRC_NB)
+            if (!av_color_transfer_name(sps->color_trc))
                 sps->color_trc = AVCOL_TRC_UNSPECIFIED;
-            if (sps->colorspace >= AVCOL_SPC_NB)
+            if (!av_color_space_name(sps->colorspace))
                 sps->colorspace = AVCOL_SPC_UNSPECIFIED;
         }
     }
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index acd55cc..6d67dd9 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -568,11 +568,11 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx,
             vui->matrix_coeffs           = get_bits(gb, 8);
 
             // Set invalid values to "unspecified"
-            if (vui->colour_primaries >= AVCOL_PRI_NB)
+            if (!av_color_primaries_name(vui->colour_primaries))
                 vui->colour_primaries = AVCOL_PRI_UNSPECIFIED;
-            if (vui->transfer_characteristic >= AVCOL_TRC_NB)
+            if (!av_color_transfer_name(vui->transfer_characteristic))
                 vui->transfer_characteristic = AVCOL_TRC_UNSPECIFIED;
-            if (vui->matrix_coeffs >= AVCOL_SPC_NB)
+            if (!av_color_space_name(vui->matrix_coeffs))
                 vui->matrix_coeffs = AVCOL_SPC_UNSPECIFIED;
             if (vui->matrix_coeffs == AVCOL_SPC_RGB) {
                 switch (sps->pix_fmt) {


======================================================================

diff --cc libavcodec/hevc_ps.c
index acd55cc,2471907..6d67dd9
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@@ -568,25 -497,12 +568,25 @@@ static void decode_vui(GetBitContext *g
              vui->matrix_coeffs           = get_bits(gb, 8);
  
              // Set invalid values to "unspecified"
-             if (vui->colour_primaries >= AVCOL_PRI_NB)
+             if (!av_color_primaries_name(vui->colour_primaries))
                  vui->colour_primaries = AVCOL_PRI_UNSPECIFIED;
-             if (vui->transfer_characteristic >= AVCOL_TRC_NB)
+             if (!av_color_transfer_name(vui->transfer_characteristic))
                  vui->transfer_characteristic = AVCOL_TRC_UNSPECIFIED;
-             if (vui->matrix_coeffs >= AVCOL_SPC_NB)
+             if (!av_color_space_name(vui->matrix_coeffs))
                  vui->matrix_coeffs = AVCOL_SPC_UNSPECIFIED;
 +            if (vui->matrix_coeffs == AVCOL_SPC_RGB) {
 +                switch (sps->pix_fmt) {
 +                case AV_PIX_FMT_YUV444P:
 +                    sps->pix_fmt = AV_PIX_FMT_GBRP;
 +                    break;
 +                case AV_PIX_FMT_YUV444P10:
 +                    sps->pix_fmt = AV_PIX_FMT_GBRP10;
 +                    break;
 +                case AV_PIX_FMT_YUV444P12:
 +                    sps->pix_fmt = AV_PIX_FMT_GBRP12;
 +                    break;
 +                }
 +            }
          }
      }
  



More information about the ffmpeg-cvslog mailing list