diff options
author | Harish Mahendrakar <harish.mahendrakar@ittiam.com> | 2019-11-14 15:34:31 -0800 |
---|---|---|
committer | Ray Essick <essick@google.com> | 2020-02-04 19:31:27 +0000 |
commit | 75db1b8e484ffd9256c553cb28dcd0b5d7a3c274 (patch) | |
tree | d7869bbe2bc388739995f5d26482e093c769a916 | |
parent | 75d1ac1026539f82a299ef6cea2b59150098ddbb (diff) | |
download | libhevc-75db1b8e484ffd9256c553cb28dcd0b5d7a3c274.tar.gz |
Do not call SIMD format conversion for width < 32
Neon SIMD functions do not support width < 32.
Bug: 143464314
Test: poc in bug
Change-Id: I2445c3d98c0b1afbb1ef480403bbc67add629cac
(cherry picked from commit 6219b83299f3c0322c4485582222f3dbd1f437a5)
-rw-r--r-- | decoder/ihevcd_fmt_conv.c | 115 |
1 files changed, 74 insertions, 41 deletions
diff --git a/decoder/ihevcd_fmt_conv.c b/decoder/ihevcd_fmt_conv.c index 4e0e4f7..4637fe8 100644 --- a/decoder/ihevcd_fmt_conv.c +++ b/decoder/ihevcd_fmt_conv.c @@ -65,6 +65,8 @@ #include "ihevcd_fmt_conv.h" #include "ihevcd_profile.h" +/* SIMD variants of format conversion modules do not support width less than 32 */ +#define MIN_FMT_CONV_SIMD_WIDTH 32 /** ******************************************************************************* * @@ -830,18 +832,35 @@ IHEVCD_ERROR_T ihevcd_fmt_conv(codec_t *ps_codec, if((IV_YUV_420SP_UV == ps_codec->e_chroma_fmt) || (IV_YUV_420SP_VU == ps_codec->e_chroma_fmt)) { - - ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_420sp_fptr(pu1_y_src, pu1_uv_src, - pu1_y_dst_tmp, pu1_uv_dst_tmp, - ps_codec->i4_disp_wd, - num_rows, - ps_codec->i4_strd, - ps_codec->i4_strd, - ps_codec->i4_disp_strd, - ps_codec->i4_disp_strd); + ihevcd_fmt_conv_420sp_to_420sp_ft *fmt_conv_fptr; + if(ps_codec->i4_disp_wd >= MIN_FMT_CONV_SIMD_WIDTH) + { + fmt_conv_fptr = ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_420sp_fptr; + } + else + { + fmt_conv_fptr = ihevcd_fmt_conv_420sp_to_420sp; + } + fmt_conv_fptr(pu1_y_src, pu1_uv_src, + pu1_y_dst_tmp, pu1_uv_dst_tmp, + ps_codec->i4_disp_wd, + num_rows, + ps_codec->i4_strd, + ps_codec->i4_strd, + ps_codec->i4_disp_strd, + ps_codec->i4_disp_strd); } else if(IV_YUV_420P == ps_codec->e_chroma_fmt) { + ihevcd_fmt_conv_420sp_to_420p_ft *fmt_conv_fptr; + if(ps_codec->i4_disp_wd >= MIN_FMT_CONV_SIMD_WIDTH) + { + fmt_conv_fptr = ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_420p_fptr; + } + else + { + fmt_conv_fptr = ihevcd_fmt_conv_420sp_to_420p; + } if(0 == disable_luma_copy) { @@ -858,46 +877,60 @@ IHEVCD_ERROR_T ihevcd_fmt_conv(codec_t *ps_codec, disable_luma_copy = 1; } - - ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_420p_fptr(pu1_y_src, pu1_uv_src, - pu1_y_dst_tmp, pu1_u_dst_tmp, pu1_v_dst_tmp, - ps_codec->i4_disp_wd, - num_rows, - ps_codec->i4_strd, - ps_codec->i4_strd, - ps_codec->i4_disp_strd, - (ps_codec->i4_disp_strd / 2), - is_u_first, - disable_luma_copy); - + fmt_conv_fptr(pu1_y_src, pu1_uv_src, + pu1_y_dst_tmp, pu1_u_dst_tmp, pu1_v_dst_tmp, + ps_codec->i4_disp_wd, + num_rows, + ps_codec->i4_strd, + ps_codec->i4_strd, + ps_codec->i4_disp_strd, + (ps_codec->i4_disp_strd / 2), + is_u_first, + disable_luma_copy); } else if(IV_RGB_565 == ps_codec->e_chroma_fmt) { + ihevcd_fmt_conv_420sp_to_rgb565_ft *fmt_conv_fptr; + if(ps_codec->i4_disp_wd >= MIN_FMT_CONV_SIMD_WIDTH) + { + fmt_conv_fptr = ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_rgb565_fptr; + } + else + { + fmt_conv_fptr = ihevcd_fmt_conv_420sp_to_rgb565; + } - ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_rgb565_fptr(pu1_y_src, pu1_uv_src, - pu2_rgb_dst_tmp, - ps_codec->i4_disp_wd, - num_rows, - ps_codec->i4_strd, - ps_codec->i4_strd, - ps_codec->i4_disp_strd, - is_u_first); - + fmt_conv_fptr(pu1_y_src, pu1_uv_src, + pu2_rgb_dst_tmp, + ps_codec->i4_disp_wd, + num_rows, + ps_codec->i4_strd, + ps_codec->i4_strd, + ps_codec->i4_disp_strd, + is_u_first); } else if(IV_RGBA_8888 == ps_codec->e_chroma_fmt) { - ASSERT(is_u_first == 1); - - ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_rgba8888_fptr(pu1_y_src, - pu1_uv_src, - pu4_rgb_dst_tmp, - ps_codec->i4_disp_wd, - num_rows, - ps_codec->i4_strd, - ps_codec->i4_strd, - ps_codec->i4_disp_strd, - is_u_first); + ihevcd_fmt_conv_420sp_to_rgba8888_ft *fmt_conv_fptr; + if(ps_codec->i4_disp_wd >= MIN_FMT_CONV_SIMD_WIDTH) + { + fmt_conv_fptr = ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_rgba8888_fptr; + } + else + { + fmt_conv_fptr = ihevcd_fmt_conv_420sp_to_rgba8888; + } + ASSERT(is_u_first == 1); + fmt_conv_fptr(pu1_y_src, + pu1_uv_src, + pu4_rgb_dst_tmp, + ps_codec->i4_disp_wd, + num_rows, + ps_codec->i4_strd, + ps_codec->i4_strd, + ps_codec->i4_disp_strd, + is_u_first); } |