From fbc6f190a61810a4f3c5181822c2da1027cda154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 28 Mar 2017 11:05:53 +0300 Subject: [PATCH 1/4] arm: Always build the hevcdsp_init_arm.c file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main hevcdsp.c file calls this init function if HAVE_ARM is set, regardless of whether neon support is available or not. This fixes builds where neon isn't supported by the build tools at all. Signed-off-by: Martin Storsjö --- libavcodec/arm/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile index 555de160e4..b48745ad40 100644 --- a/libavcodec/arm/Makefile +++ b/libavcodec/arm/Makefile @@ -41,6 +41,7 @@ OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_init_arm.o \ arm/sbrdsp_init_arm.o OBJS-$(CONFIG_APE_DECODER) += arm/apedsp_init_arm.o OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o +OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_arm.o OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o OBJS-$(CONFIG_RV40_DECODER) += arm/rv40dsp_init_arm.o OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_init_arm.o @@ -134,8 +135,7 @@ NEON-OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_neon.o \ NEON-OBJS-$(CONFIG_APE_DECODER) += arm/apedsp_neon.o NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ arm/synth_filter_neon.o -NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevc_idct.o \ - arm/hevcdsp_init_arm.o +NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevc_idct.o NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \ arm/rv40dsp_neon.o From e788ca05a796c97b84758189c83183f5ffa808f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 28 Mar 2017 12:53:58 +0300 Subject: [PATCH 2/4] hevcdec: Use LOCAL_ALIGNED_* for declaring local variables with alignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not all compilers can do alignment larger than the normal stack alignment for variables on the stack. In these cases, the LOCAL_ALIGNED_* macros produce the workaround alignment wrapper consisting of a padded array and a pointer variable. This fixes the hevc fate tests on RVCT/ARMCC after adding IDCT assembly that actually assumes/relies on this alignment. Signed-off-by: Martin Storsjö --- libavcodec/hevcdec.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index e24ce1e3c0..6a04858587 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -917,8 +917,8 @@ static void hls_residual_coding(HEVCContext *s, int x0, int y0, int vshift = s->ps.sps->vshift[c_idx]; uint8_t *dst = &s->frame->data[c_idx][(y0 >> vshift) * stride + ((x0 >> hshift) << s->ps.sps->pixel_shift)]; - DECLARE_ALIGNED(32, int16_t, coeffs[MAX_TB_SIZE * MAX_TB_SIZE]) = { 0 }; - DECLARE_ALIGNED(8, uint8_t, significant_coeff_group_flag[8][8]) = { { 0 } }; + LOCAL_ALIGNED_32(int16_t, coeffs, [MAX_TB_SIZE * MAX_TB_SIZE]); + LOCAL_ALIGNED_8(uint8_t, significant_coeff_group_flag, [8], [8]); int trafo_size = 1 << log2_trafo_size; int i, qp, shift, add, scale, scale_m; @@ -926,6 +926,8 @@ static void hls_residual_coding(HEVCContext *s, int x0, int y0, const uint8_t *scale_matrix; uint8_t dc_scale; + memset(coeffs, 0, sizeof(int16_t) * MAX_TB_SIZE * MAX_TB_SIZE); + memset(significant_coeff_group_flag, 0, sizeof(uint8_t) * 8 * 8); // Derive QP for dequant if (!lc->cu.cu_transquant_bypass_flag) { static const int qp_c[] = { @@ -1755,8 +1757,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, } if (current_mv.pred_flag[0] && !current_mv.pred_flag[1]) { - DECLARE_ALIGNED(16, int16_t, tmp[MAX_PB_SIZE * MAX_PB_SIZE]); - DECLARE_ALIGNED(16, int16_t, tmp2[MAX_PB_SIZE * MAX_PB_SIZE]); + LOCAL_ALIGNED_16(int16_t, tmp, [MAX_PB_SIZE * MAX_PB_SIZE]); + LOCAL_ALIGNED_16(int16_t, tmp2, [MAX_PB_SIZE * MAX_PB_SIZE]); luma_mc(s, tmp, tmpstride, ref0->frame, ¤t_mv.mv[0], x0, y0, nPbW, nPbH, pred_idx); @@ -1789,8 +1791,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, s->hevcdsp.put_unweighted_pred_chroma[pred_idx](dst2, s->frame->linesize[2], tmp2, tmpstride, nPbH / 2); } } else if (!current_mv.pred_flag[0] && current_mv.pred_flag[1]) { - DECLARE_ALIGNED(16, int16_t, tmp [MAX_PB_SIZE * MAX_PB_SIZE]); - DECLARE_ALIGNED(16, int16_t, tmp2[MAX_PB_SIZE * MAX_PB_SIZE]); + LOCAL_ALIGNED_16(int16_t, tmp, [MAX_PB_SIZE * MAX_PB_SIZE]); + LOCAL_ALIGNED_16(int16_t, tmp2, [MAX_PB_SIZE * MAX_PB_SIZE]); luma_mc(s, tmp, tmpstride, ref1->frame, ¤t_mv.mv[1], x0, y0, nPbW, nPbH, pred_idx); @@ -1822,10 +1824,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, s->hevcdsp.put_unweighted_pred_chroma[pred_idx](dst2, s->frame->linesize[2], tmp2, tmpstride, nPbH / 2); } } else if (current_mv.pred_flag[0] && current_mv.pred_flag[1]) { - DECLARE_ALIGNED(16, int16_t, tmp [MAX_PB_SIZE * MAX_PB_SIZE]); - DECLARE_ALIGNED(16, int16_t, tmp2[MAX_PB_SIZE * MAX_PB_SIZE]); - DECLARE_ALIGNED(16, int16_t, tmp3[MAX_PB_SIZE * MAX_PB_SIZE]); - DECLARE_ALIGNED(16, int16_t, tmp4[MAX_PB_SIZE * MAX_PB_SIZE]); + LOCAL_ALIGNED_16(int16_t, tmp, [MAX_PB_SIZE * MAX_PB_SIZE]); + LOCAL_ALIGNED_16(int16_t, tmp2, [MAX_PB_SIZE * MAX_PB_SIZE]); + LOCAL_ALIGNED_16(int16_t, tmp3, [MAX_PB_SIZE * MAX_PB_SIZE]); + LOCAL_ALIGNED_16(int16_t, tmp4, [MAX_PB_SIZE * MAX_PB_SIZE]); luma_mc(s, tmp, tmpstride, ref0->frame, ¤t_mv.mv[0], x0, y0, nPbW, nPbH, pred_idx); From 6a9e331d79f8f78ba7642004ac13d744d033b98e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 29 Mar 2017 12:04:46 +0200 Subject: [PATCH 3/4] dcadec: remove extra indirection num_core_channels is always equal to s->audio_header.prim_channels, neither one of those variables ever get changed. Signed-off-by: Luca Barbato --- libavcodec/dcadec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index fa2a2400fe..ed1ed2d5f3 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -1263,9 +1263,10 @@ static int scan_for_extensions(AVCodecContext *avctx) return ret; } -static int set_channel_layout(AVCodecContext *avctx, int channels, int num_core_channels) +static int set_channel_layout(AVCodecContext *avctx, int channels) { DCAContext *s = avctx->priv_data; + int num_core_channels = s->audio_header.prim_channels; int i; if (s->amode < 16) { @@ -1372,7 +1373,6 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, int buf_size = avpkt->size; int lfe_samples; - int num_core_channels = 0; int i, ret; float **samples_flt; DCAContext *s = avctx->priv_data; @@ -1406,9 +1406,6 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, } } - /* record number of core channels incase less than max channels are requested */ - num_core_channels = s->audio_header.prim_channels; - if (s->ext_coding) s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr]; else @@ -1420,7 +1417,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, full_channels = channels = s->audio_header.prim_channels + !!s->lfe; - ret = set_channel_layout(avctx, channels, num_core_channels); + ret = set_channel_layout(avctx, channels); if (ret < 0) return ret; avctx->channels = channels; From 163cc67beb3ed28aeb500c9a09df47c8df613025 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 24 Mar 2017 17:35:06 +0100 Subject: [PATCH 4/4] takdec: Use ISO C printf conversion specifiers where appropriate libavformat/takdec.c:144:20: warning: format '%X' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' --- libavformat/takdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/takdec.c b/libavformat/takdec.c index 4b3037d9ca..b3739e446e 100644 --- a/libavformat/takdec.c +++ b/libavformat/takdec.c @@ -140,7 +140,7 @@ static int tak_read_header(AVFormatContext *s) bitstream_read(&bc, TAK_LAST_FRAME_SIZE_BITS); av_freep(&buffer); } else if (type == TAK_METADATA_ENCODER) { - av_log(s, AV_LOG_VERBOSE, "encoder version: %0X\n", + av_log(s, AV_LOG_VERBOSE, "encoder version: %0"PRIX32"\n", bitstream_read(&bc, TAK_ENCODER_VERSION_BITS)); av_freep(&buffer); }