[Libva] [libva-intel-driver PATCH 02/10] support HEVC 10bits decoding

Xiang, Haihao haihao.xiang at intel.com
Sun Dec 6 08:26:14 PST 2015



>-----Original Message-----
>From: Emil Velikov [mailto:emil.l.velikov at gmail.com]
>Sent: Friday, December 4, 2015 10:10 PM
>To: Xiang, Haihao
>Cc: libva at lists.freedesktop.org
>Subject: Re: [Libva] [libva-intel-driver PATCH 02/10] support HEVC 10bits
>decoding
>
>On 3 December 2015 at 18:13, Xiang, Haihao <haihao.xiang at intel.com> wrote:
>> From: Peng Chen <peng.c.chen at intel.com>
>>
>> Signed-off-by: Peng Chen <peng.c.chen at intel.com>
>> [Haihao: code cleanup]
>> Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
>> ---
>>  src/gen9_mfd.c           |  61 +++++++++++++++++++---
>>  src/i965_decoder_utils.c |  21 +++++++-
>>  src/i965_defines.h       |   2 +
>>  src/i965_device_info.c   |   7 ++-
>>  src/i965_drv_video.c     | 130 +++++++++++++++++++++++++++++++++----
>----------
>>  src/i965_drv_video.h     |   3 ++
>>  src/i965_encoder.c       |   4 +-
>>  7 files changed, 178 insertions(+), 50 deletions(-)
>>
>> diff --git a/src/gen9_mfd.c b/src/gen9_mfd.c index da76378..44b343f
>> 100644
>> --- a/src/gen9_mfd.c
>> +++ b/src/gen9_mfd.c
>> @@ -109,6 +109,7 @@ gen9_hcpd_hevc_decode_init(VADriverContextP ctx,
>>      VAPictureParameterBufferHEVC *pic_param;
>>      struct object_surface *obj_surface;
>>      uint32_t size;
>> +    int hevc_10bit = 0;
>>
>>      assert(decode_state->pic_param && decode_state->pic_param->buffer);
>>      pic_param = (VAPictureParameterBufferHEVC
>> *)decode_state->pic_param->buffer;
>> @@ -134,12 +135,22 @@ gen9_hcpd_hevc_decode_init(VADriverContextP
>ctx,
>>      hevc_ensure_surface_bo(ctx, decode_state, obj_surface, pic_param);
>>      gen9_hcpd_init_hevc_surface(ctx, pic_param, obj_surface,
>> gen9_hcpd_context);
>>
>> -    size = ALIGN(gen9_hcpd_context->picture_width_in_pixels, 32) >> 3;
>> +    if((pic_param->bit_depth_luma_minus8 > 0)
>> +        || (pic_param->bit_depth_chroma_minus8 > 0))
>> +        hevc_10bit = 1;
>> +
>> +    if(hevc_10bit)
>> +        size = ALIGN(gen9_hcpd_context->picture_width_in_pixels, 32) >> 2;
>> +    else
>> +        size = ALIGN(gen9_hcpd_context->picture_width_in_pixels, 32)
>> + >> 3;
>>      size <<= 6;
>>      ALLOC_GEN_BUFFER((&gen9_hcpd_context-
>>deblocking_filter_line_buffer), "line buffer", size);
>>
>> ALLOC_GEN_BUFFER((&gen9_hcpd_context-
>>deblocking_filter_tile_line_buff
>> er), "tile line buffer", size);
>>
>> -    size = ALIGN(gen9_hcpd_context->picture_height_in_pixels + 6 *
>gen9_hcpd_context->picture_height_in_ctbs, 32) >> 3;
>> +    if(hevc_10bit)
>> +        size = ALIGN(gen9_hcpd_context->picture_height_in_pixels + 6 *
>gen9_hcpd_context->picture_height_in_ctbs, 32) >> 2;
>> +    else
>> +        size = ALIGN(gen9_hcpd_context->picture_height_in_pixels + 6
>> + * gen9_hcpd_context->picture_height_in_ctbs, 32) >> 3;
>>      size <<= 6;
>>
>> ALLOC_GEN_BUFFER((&gen9_hcpd_context-
>>deblocking_filter_tile_column_bu
>> ffer), "tile column buffer", size);
>>
>> @@ -158,15 +169,24 @@ gen9_hcpd_hevc_decode_init(VADriverContextP
>ctx,
>>      size <<= 6;
>>
>> ALLOC_GEN_BUFFER((&gen9_hcpd_context-
>>metadata_tile_column_buffer),
>> "metadata tile column buffer", size);
>>
>> -    size = ALIGN(((gen9_hcpd_context->picture_width_in_pixels >> 1) + 3 *
>gen9_hcpd_context->picture_width_in_ctbs), 16) >> 3;
>> +    if(hevc_10bit)
>> +        size = ALIGN(((gen9_hcpd_context->picture_width_in_pixels >> 1) + 3
>* gen9_hcpd_context->picture_width_in_ctbs), 16) >> 2;
>> +    else
>> +        size = ALIGN(((gen9_hcpd_context->picture_width_in_pixels >>
>> + 1) + 3 * gen9_hcpd_context->picture_width_in_ctbs), 16) >> 3;
>>      size <<= 6;
>>      ALLOC_GEN_BUFFER((&gen9_hcpd_context->sao_line_buffer), "sao line
>> buffer", size);
>>
>> -    size = ALIGN(((gen9_hcpd_context->picture_width_in_pixels >> 1) + 6 *
>gen9_hcpd_context->picture_width_in_ctbs), 16) >> 3;
>> +    if(hevc_10bit)
>> +        size = ALIGN(((gen9_hcpd_context->picture_width_in_pixels >> 1) + 6
>* gen9_hcpd_context->picture_width_in_ctbs), 16) >> 2;
>> +    else
>> +        size = ALIGN(((gen9_hcpd_context->picture_width_in_pixels >>
>> + 1) + 6 * gen9_hcpd_context->picture_width_in_ctbs), 16) >> 3;
>>      size <<= 6;
>>      ALLOC_GEN_BUFFER((&gen9_hcpd_context->sao_tile_line_buffer), "sao
>> tile line buffer", size);
>>
>> -    size = ALIGN(((gen9_hcpd_context->picture_height_in_pixels >> 1) + 6 *
>gen9_hcpd_context->picture_height_in_ctbs), 16) >> 3;
>> +    if(hevc_10bit)
>> +        size = ALIGN(((gen9_hcpd_context->picture_height_in_pixels >> 1) +
>6 * gen9_hcpd_context->picture_height_in_ctbs), 16) >> 2;
>> +    else
>> +        size = ALIGN(((gen9_hcpd_context->picture_height_in_pixels >>
>> + 1) + 6 * gen9_hcpd_context->picture_height_in_ctbs), 16) >> 3;
>You can simplify this whole lot (and make it more readable) if you just store
>the shift in a const int at the top :-)

Thanks for your comment.  I will follow your suggestion to change it.

>
>-Emil


More information about the Libva mailing list