Merge commit '32c8d89c036b0e75ece74aea638df587099def0b'
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 13 Jul 2015 23:33:58 +0000 (01:33 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 13 Jul 2015 23:33:58 +0000 (01:33 +0200)
* commit '32c8d89c036b0e75ece74aea638df587099def0b':
  hevc: Print the non-supported chroma_format_idc

Conflicts:
libavcodec/hevc_ps.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
1  2 
libavcodec/hevc_ps.c

@@@ -745,35 -645,20 +745,38 @@@ static int scaling_list_data(GetBitCont
  static int map_pixel_format(AVCodecContext *avctx, HEVCSPS *sps)
  {
      const AVPixFmtDescriptor *desc;
 -    if (sps->chroma_format_idc == 1) {
 -        switch (sps->bit_depth) {
 -        case 8:  sps->pix_fmt = AV_PIX_FMT_YUV420P;   break;
 -        case 9:  sps->pix_fmt = AV_PIX_FMT_YUV420P9;  break;
 -        case 10: sps->pix_fmt = AV_PIX_FMT_YUV420P10; break;
 -        default:
 -            av_log(avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n",
 -                   sps->bit_depth);
 -            return AVERROR_PATCHWELCOME;
 -        }
 -    } else {
 +    switch (sps->bit_depth) {
 +    case 8:
 +        if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY8;
 +        if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P;
 +        if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P;
 +        if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P;
 +       break;
 +    case 9:
 +        if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY16;
 +        if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P9;
 +        if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P9;
 +        if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P9;
 +        break;
 +    case 10:
 +        if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY16;
 +        if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P10;
 +        if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P10;
 +        if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P10;
 +        break;
 +    case 12:
 +        if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY16;
 +        if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P12;
 +        if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P12;
 +        if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P12;
 +        break;
 +    default:
          av_log(avctx, AV_LOG_ERROR,
 -               "non-4:2:0 support is currently unspecified.\n");
 -        return AVERROR_PATCHWELCOME;
 +               "4:2:0, 4:2:2, 4:4:4 supports are currently specified for 8, 10 and 12 bits.\n");
++        av_log(avctx, AV_LOG_ERROR,
++               "chroma_format_idc is %d",
++               sps->chroma_format_idc);
 +        return AVERROR_INVALIDDATA;
      }
  
      desc = av_pix_fmt_desc_get(sps->pix_fmt);