Merge commit 'ff9db5cfd14558df9cfcc54d6c062bc34bf1f341'
authorClément Bœsch <u@pkh.me>
Sat, 8 Apr 2017 12:41:10 +0000 (14:41 +0200)
committerClément Bœsch <u@pkh.me>
Sat, 8 Apr 2017 12:41:10 +0000 (14:41 +0200)
* commit 'ff9db5cfd14558df9cfcc54d6c062bc34bf1f341':
  lavc: Use a stricter check for the color properties values

Merged-by: Clément Bœsch <u@pkh.me>
1  2 
libavcodec/h264_ps.c
libavcodec/hevc_ps.c

Simple merge
@@@ -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;
 +                }
 +            }
          }
      }