[FFmpeg-devel] [PATCH]lavc/hevc: Support GBR encoding and decoding

Hendrik Leppkes h.leppkes at gmail.com
Sun Mar 13 03:18:03 CET 2016


On Sun, Mar 13, 2016 at 3:14 AM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> On Sat, Mar 12, 2016 at 1:44 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>> Hi!
>>
>> Attached patch allows GBR encoding and decoding for hevc.
>>
>
> Encoder and decoder patches should be separated, they are quite
> distinct code other then being related by codec, otherwise its
> probably fine.
>

Actually some further comments:

> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index bcb63a3..7237ee6 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -561,6 +561,17 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx,
>                 vui->transfer_characteristic = AVCOL_TRC_UNSPECIFIED;
>             if (vui->matrix_coeffs >= AVCOL_SPC_NB)
>                 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;
> +            }

Please add a break here for consistency, avoiding issues early, etc. :)

>         }
>     }
>
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> index 68c7fba..072bace 100644
> --- a/libavcodec/libx265.c
> +++ b/libavcodec/libx265.c
> @@ -257,6 +263,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>
>         x265pic.pts      = pic->pts;
>         x265pic.bitDepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth;
> +printf("x265pic.bitDepth: %d \n", x265pic.bitDepth);
>
>         x265pic.sliceType = pic->pict_type == AV_PICTURE_TYPE_I ? X265_TYPE_I :
>                             pic->pict_type == AV_PICTURE_TYPE_P ? X265_TYPE_P :

The printf is hopefully a debugging artifact? :)


- H endrik


More information about the ffmpeg-devel mailing list