aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrujan Vandrangi <srujan.vandrangi@ittiam.com>2024-04-24 22:27:04 +0530
committerSrujan Vandrangi <srujan.vandrangi@ittiam.com>2024-04-24 17:01:56 +0000
commit6e8f8ec91d5b38031bb3aaab304f1364ef2c677b (patch)
tree6f625d7c45940f579530132d178bec86495c5cfb
parent21f3eddcb038076220c6da4e4cdd7ecec88a4f1c (diff)
parent828cdb77ba434eb11ce19f7f0d4482e744b27064 (diff)
downloadlibavc-master.tar.gz
Upgrade libavc to v1.4.0HEADmastermain
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update external/libavc For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md Bug: 325356593 Test: atest CtsMediaV2TestCases Change-Id: If5cfbadef49d467bb00914988690cab24e80070e
-rw-r--r--METADATA18
-rw-r--r--common/arm/svc/isvc_iquant_itrans_recon_neon.c452
-rw-r--r--common/svc/isvc_mem_fns.c158
-rw-r--r--common/svc/isvc_mem_fns.h8
-rw-r--r--common/svc/isvc_trans_quant_itrans_iquant.h8
-rw-r--r--common/x86/svc/isvc_iquant_itrans_recon_sse42.c681
-rw-r--r--decoder/ih264d_parse_headers.c14
-rw-r--r--decoder/ih264d_sei.c8
-rw-r--r--decoder/ih264d_utils.c4
-rw-r--r--decoder/mvc/imvcd_api.c22
-rw-r--r--decoder/mvc/imvcd_api_utils.c16
-rw-r--r--decoder/mvc/imvcd_api_utils.h3
-rw-r--r--decoder/mvc/imvcd_defs.h10
-rw-r--r--decoder/svc/isvcd_api.c35
-rw-r--r--decoder/svc/isvcd_intra_resamp.c39
-rw-r--r--decoder/svc/isvcd_intra_resamp.h2
-rw-r--r--decoder/svc/isvcd_parse_ebslice.c12
-rw-r--r--decoder/svc/isvcd_parse_eislice.c10
-rw-r--r--decoder/svc/isvcd_parse_epslice.c11
-rw-r--r--decoder/svc/isvcd_parse_headers.c92
-rw-r--r--decoder/svc/isvcd_parse_slice.c38
-rw-r--r--decoder/svc/isvcd_process_epslice.c9
-rw-r--r--decoder/svc/isvcd_structs.h5
-rw-r--r--encoder/arm/svc/isvce_function_selector_a9q.c14
-rw-r--r--encoder/arm/svc/isvce_function_selector_av8.c16
-rw-r--r--encoder/ih264e_api.c104
-rw-r--r--encoder/ih264e_encode.c124
-rw-r--r--encoder/svc/isvce_api.c265
-rw-r--r--encoder/svc/isvce_encode.c33
-rw-r--r--encoder/svc/isvce_function_selector_generic.c4
-rw-r--r--encoder/svc/isvce_ilp_mv.c2
-rw-r--r--encoder/svc/isvce_structs.h8
-rw-r--r--encoder/svc/isvce_utils.c223
-rw-r--r--encoder/svc/isvce_utils.h2
-rw-r--r--encoder/x86/svc/isvce_function_selector_sse42.c7
35 files changed, 458 insertions, 1999 deletions
diff --git a/METADATA b/METADATA
index 04c2594..798232c 100644
--- a/METADATA
+++ b/METADATA
@@ -1,19 +1,19 @@
# This project was upgraded with external_updater.
-# Usage: tools/external_updater/updater.sh update libavc
+# Usage: tools/external_updater/updater.sh update external/libavc
# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
name: "libavc"
description: "Android fork of the libavc library."
third_party {
- url {
- type: GIT
- value: "https://github.com/ittiam-systems/libavc.git"
- }
- version: "v1.3.0"
license_type: NOTICE
last_upgrade_date {
- year: 2023
- month: 10
- day: 23
+ year: 2024
+ month: 4
+ day: 24
+ }
+ identifier {
+ type: "Git"
+ value: "https://github.com/ittiam-systems/libavc.git"
+ version: "v1.4.0"
}
}
diff --git a/common/arm/svc/isvc_iquant_itrans_recon_neon.c b/common/arm/svc/isvc_iquant_itrans_recon_neon.c
index 270adde..8a97fbc 100644
--- a/common/arm/svc/isvc_iquant_itrans_recon_neon.c
+++ b/common/arm/svc/isvc_iquant_itrans_recon_neon.c
@@ -587,193 +587,6 @@ void isvc_iquant_itrans_recon_4x4_with_res_accumulate_neon(
vreinterpret_u32_u8(pred23_un), 1);
}
-void isvc_iquant_itrans_recon_chroma_4x4_neon(
- buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
- buffer_container_t *ps_res, buffer_container_t *ps_rec,
- iq_it_res_rec_constants_t *ps_iq_it_res_rec_constants, WORD16 *pi2_tmp, WORD16 *pi2_dc_src,
- WORD32 i4_iq_start_idx, UWORD8 u1_res_accumulate)
-{
- WORD16 *pi2_src = (WORD16 *) ps_src->pv_data;
- UWORD8 *pu1_pred = (UWORD8 *) ps_pred->pv_data;
- UWORD8 *pu1_out = (UWORD8 *) ps_rec->pv_data;
- WORD32 i4_pred_stride = ps_pred->i4_data_stride;
- WORD32 i4_out_stride = ps_rec->i4_data_stride;
- const UWORD16 *pu2_iscal_mat = ps_iq_it_res_rec_constants->pu2_iscal_mat;
- const UWORD16 *pu2_weigh_mat = ps_iq_it_res_rec_constants->pu2_weigh_mat;
- UWORD32 u4_qp_div_6 = ps_iq_it_res_rec_constants->u4_qp_div_6;
-
- WORD16 i2_rnd_factor = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
-
- int16x4x4_t src_16x4x2;
- int16x4x4_t iscal_16x4x2;
- int16x4x4_t weigh_16x4x2;
-
- int16x4_t q0_16x4, q1_16x4, q2_16x4, q3_16x4;
- int32x4_t q0_32x4, q1_32x4, q2_32x4, q3_32x4;
- int16x4_t rq1_16x4, rq3_16x4;
- int16x4_t x0_16x4, x1_16x4, x2_16x4, x3_16x4;
- int16x8_t x0_16x8, x1_16x8, x2_16x8, x3_16x8;
- int16x4_t xx0_16x4, xx1_16x4, xx2_16x4, xx3_16x4;
- int16x4x2_t xx0_16x4x2, xx1_16x4x2;
- int32x2x2_t x0_32x2x2, x1_32x2x2;
- int16x4_t weigh0_16x4, weigh1_16x4, weigh2_16x4, weigh3_16x4;
-
- uint8x8_t pred0_in, pred1_in, pred2_in, pred3_in;
- int16x8_t pred0, pred1, pred2, pred3;
- int16x8_t rec0, rec1, rec2, rec3;
- uint8x8_t rec0_un, rec1_un, rec2_un, rec3_un;
- uint8x8_t out0, out1, out2, out3;
-
- uint8x8_t chroma_mask_8x8 = vreinterpret_u8_u16(vdup_n_u16(0x00ff));
-
- int16x4_t pos_255_16x4 = vdup_n_s16(((WORD16) UINT8_MAX));
- int16x4_t neg_255_16x4 = vdup_n_s16(-((WORD16) UINT8_MAX));
- int32x4_t qp_div_6_32x4 = vdupq_n_s32(u4_qp_div_6);
- int32x4_t rnd_fact = vdupq_n_s32(i2_rnd_factor);
-
- UNUSED(i4_iq_start_idx);
- UNUSED(ps_res);
- UNUSED(ps_res_pred);
- UNUSED(u1_res_accumulate);
-
- src_16x4x2 = vld4_s16(pi2_src);
- iscal_16x4x2 = vld4_s16((const int16_t *) pu2_iscal_mat);
- weigh_16x4x2 = vld4_s16((const int16_t *) pu2_weigh_mat);
-
- weigh0_16x4 = vmul_s16(weigh_16x4x2.val[0], iscal_16x4x2.val[0]);
- weigh1_16x4 = vmul_s16(weigh_16x4x2.val[1], iscal_16x4x2.val[1]);
- weigh2_16x4 = vmul_s16(weigh_16x4x2.val[2], iscal_16x4x2.val[2]);
- weigh3_16x4 = vmul_s16(weigh_16x4x2.val[3], iscal_16x4x2.val[3]);
-
- q0_32x4 = vmull_s16(weigh0_16x4, src_16x4x2.val[0]);
- q1_32x4 = vmull_s16(weigh1_16x4, src_16x4x2.val[1]);
- q2_32x4 = vmull_s16(weigh2_16x4, src_16x4x2.val[2]);
- q3_32x4 = vmull_s16(weigh3_16x4, src_16x4x2.val[3]);
-
- q0_32x4 = vaddq_s32(q0_32x4, rnd_fact);
- q1_32x4 = vaddq_s32(q1_32x4, rnd_fact);
- q2_32x4 = vaddq_s32(q2_32x4, rnd_fact);
- q3_32x4 = vaddq_s32(q3_32x4, rnd_fact);
-
- q0_32x4 = vshlq_s32(q0_32x4, qp_div_6_32x4);
- q1_32x4 = vshlq_s32(q1_32x4, qp_div_6_32x4);
- q2_32x4 = vshlq_s32(q2_32x4, qp_div_6_32x4);
- q3_32x4 = vshlq_s32(q3_32x4, qp_div_6_32x4);
-
- q0_16x4 = vqshrn_n_s32(q0_32x4, 4);
- q1_16x4 = vqshrn_n_s32(q1_32x4, 4);
- q2_16x4 = vqshrn_n_s32(q2_32x4, 4);
- q3_16x4 = vqshrn_n_s32(q3_32x4, 4);
-
- q0_16x4 = vset_lane_s16(pi2_dc_src[0], q0_16x4, 0);
-
- rq1_16x4 = vshr_n_s16(q1_16x4, 1);
- rq3_16x4 = vshr_n_s16(q3_16x4, 1);
-
- x0_16x4 = vadd_s16(q0_16x4, q2_16x4);
- x1_16x4 = vsub_s16(q0_16x4, q2_16x4);
- x2_16x4 = vsub_s16(rq1_16x4, q3_16x4);
- x3_16x4 = vadd_s16(q1_16x4, rq3_16x4);
-
- xx0_16x4 = vadd_s16(x0_16x4, x3_16x4);
- xx1_16x4 = vadd_s16(x1_16x4, x2_16x4);
- xx2_16x4 = vsub_s16(x1_16x4, x2_16x4);
- xx3_16x4 = vsub_s16(x0_16x4, x3_16x4);
-
- /* row 0 to row 3 */
- xx0_16x4x2 = vtrn_s16(xx0_16x4, xx1_16x4);
- xx1_16x4x2 = vtrn_s16(xx2_16x4, xx3_16x4);
- x0_32x2x2 =
- vzip_s32(vreinterpret_s32_s16(xx0_16x4x2.val[0]), vreinterpret_s32_s16(xx1_16x4x2.val[0]));
- x1_32x2x2 =
- vzip_s32(vreinterpret_s32_s16(xx0_16x4x2.val[1]), vreinterpret_s32_s16(xx1_16x4x2.val[1]));
-
- x0_16x4 = vreinterpret_s16_s32(x0_32x2x2.val[0]);
- x1_16x4 = vreinterpret_s16_s32(x1_32x2x2.val[0]);
- x2_16x4 = vreinterpret_s16_s32(x0_32x2x2.val[1]);
- x3_16x4 = vreinterpret_s16_s32(x1_32x2x2.val[1]);
-
- /* Store Horz transform output into temp */
- vst1_s16(pi2_tmp, x0_16x4);
- vst1_s16(pi2_tmp + 4, x1_16x4);
- vst1_s16(pi2_tmp + 8, x2_16x4);
- vst1_s16(pi2_tmp + 12, x3_16x4);
-
- /* vertical inverse transform */
- rq1_16x4 = vshr_n_s16(x1_16x4, 1);
- rq3_16x4 = vshr_n_s16(x3_16x4, 1);
-
- xx0_16x4 = vadd_s16(x0_16x4, x2_16x4);
- xx1_16x4 = vsub_s16(x0_16x4, x2_16x4);
- xx2_16x4 = vsub_s16(rq1_16x4, x3_16x4);
- xx3_16x4 = vadd_s16(x1_16x4, rq3_16x4);
-
- x0_16x4 = vadd_s16(xx0_16x4, xx3_16x4);
- x1_16x4 = vadd_s16(xx1_16x4, xx2_16x4);
- x2_16x4 = vsub_s16(xx1_16x4, xx2_16x4);
- x3_16x4 = vsub_s16(xx0_16x4, xx3_16x4);
-
- x0_16x4 = vrshr_n_s16(x0_16x4, 6);
- x1_16x4 = vrshr_n_s16(x1_16x4, 6);
- x2_16x4 = vrshr_n_s16(x2_16x4, 6);
- x3_16x4 = vrshr_n_s16(x3_16x4, 6);
-
- /* Saturate all values < -255 to -255 and retain the rest as it is */
- x0_16x4 = vmax_s16(x0_16x4, neg_255_16x4);
- x1_16x4 = vmax_s16(x1_16x4, neg_255_16x4);
- x2_16x4 = vmax_s16(x2_16x4, neg_255_16x4);
- x3_16x4 = vmax_s16(x3_16x4, neg_255_16x4);
-
- /* Saturate all values > 255 to 255 and retain the rest as it is */
- x0_16x4 = vmin_s16(x0_16x4, pos_255_16x4);
- x1_16x4 = vmin_s16(x1_16x4, pos_255_16x4);
- x2_16x4 = vmin_s16(x2_16x4, pos_255_16x4);
- x3_16x4 = vmin_s16(x3_16x4, pos_255_16x4);
-
- x0_16x8 = vreinterpretq_s16_s32(vmovl_s16(x0_16x4));
- x1_16x8 = vreinterpretq_s16_s32(vmovl_s16(x1_16x4));
- x2_16x8 = vreinterpretq_s16_s32(vmovl_s16(x2_16x4));
- x3_16x8 = vreinterpretq_s16_s32(vmovl_s16(x3_16x4));
-
- pred0_in = vld1_u8((uint8_t *) pu1_pred);
- pred1_in = vld1_u8((uint8_t *) pu1_pred + (i4_pred_stride));
- pred2_in = vld1_u8((uint8_t *) pu1_pred + (i4_pred_stride << 1));
- pred3_in = vld1_u8((uint8_t *) pu1_pred + (i4_pred_stride * 3));
-
- pred0 = vreinterpretq_s16_u16(vmovl_u8(pred0_in));
- pred1 = vreinterpretq_s16_u16(vmovl_u8(pred1_in));
- pred2 = vreinterpretq_s16_u16(vmovl_u8(pred2_in));
- pred3 = vreinterpretq_s16_u16(vmovl_u8(pred3_in));
-
- /* Out pixel = pred + res */
- rec0 = vaddq_s16(pred0, x0_16x8);
- rec1 = vaddq_s16(pred1, x1_16x8);
- rec2 = vaddq_s16(pred2, x2_16x8);
- rec3 = vaddq_s16(pred3, x3_16x8);
-
- out0 = vld1_u8(pu1_out);
- out1 = vld1_u8(pu1_out + i4_out_stride);
- out2 = vld1_u8(pu1_out + i4_out_stride * 2);
- out3 = vld1_u8(pu1_out + i4_out_stride * 3);
-
- /* Convert to 8 bit unsigned with saturation */
- rec0_un = vqmovun_s16(rec0);
- rec1_un = vqmovun_s16(rec1);
- rec2_un = vqmovun_s16(rec2);
- rec3_un = vqmovun_s16(rec3);
-
- /* Store in alternate postions */
- out0 = vbsl_u8(chroma_mask_8x8, rec0_un, out0);
- out1 = vbsl_u8(chroma_mask_8x8, rec1_un, out1);
- out2 = vbsl_u8(chroma_mask_8x8, rec2_un, out2);
- out3 = vbsl_u8(chroma_mask_8x8, rec3_un, out3);
-
- vst1_u8((pu1_out), out0);
- vst1_u8((pu1_out + i4_out_stride), out1);
- vst1_u8((pu1_out + (i4_out_stride << 1)), out2);
- vst1_u8((pu1_out + ((i4_out_stride << 1) + i4_out_stride)), out3);
-}
-
void isvc_iquant_itrans_recon_chroma_4x4_with_res_output_neon(
buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
buffer_container_t *ps_res, buffer_container_t *ps_rec,
@@ -1280,271 +1093,6 @@ void isvc_iquant_itrans_recon_4x4_dc_neon(buffer_container_t *ps_src, buffer_con
vst1_lane_u32((uint32_t *) (pu1_out + i4_out_stride * 3), vreinterpret_u32_u8(pred3_in), 0);
}
-void isvc_iquant_itrans_recon_4x4_dc_with_res_output_neon(
- buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
- buffer_container_t *ps_res, buffer_container_t *ps_rec,
- iq_it_res_rec_constants_t *ps_iq_it_res_rec_constants, WORD16 *pi2_tmp, WORD16 *pi2_dc_src,
- WORD32 i4_iq_start_idx, UWORD8 u1_res_accumulate)
-{
- WORD16 *pi2_src = (WORD16 *) ps_src->pv_data;
- WORD16 *pi2_res = (WORD16 *) ps_res->pv_data;
- UWORD8 *pu1_pred = (UWORD8 *) ps_pred->pv_data;
- UWORD8 *pu1_out = (UWORD8 *) ps_rec->pv_data;
- WORD32 i4_res_stride = ps_res->i4_data_stride;
- WORD32 i4_pred_stride = ps_pred->i4_data_stride;
- WORD32 i4_out_stride = ps_rec->i4_data_stride;
- const UWORD16 *pu2_iscal_mat = ps_iq_it_res_rec_constants->pu2_iscal_mat;
- const UWORD16 *pu2_weigh_mat = ps_iq_it_res_rec_constants->pu2_weigh_mat;
- UWORD32 u4_qp_div_6 = ps_iq_it_res_rec_constants->u4_qp_div_6;
- WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
-
- WORD16 i2_it_out;
- WORD32 i4_iq_out_temp;
- int16x8_t temp_0;
- int16x4_t residue_res;
- uint8x8_t pred0_in, pred1_in, pred2_in, pred3_in;
- int16x8_t pred0, pred1, pred2, pred3;
-
- UNUSED(pi2_tmp);
- UNUSED(ps_res_pred);
- UNUSED(u1_res_accumulate);
-
- if(i4_iq_start_idx == 0)
- {
- i4_iq_out_temp = pi2_src[0];
- INV_QUANT(i4_iq_out_temp, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
- }
- else
- {
- i4_iq_out_temp = pi2_dc_src[0];
- }
-
- i2_it_out = ((i4_iq_out_temp + 32) >> 6);
- temp_0 = vdupq_n_s16(i2_it_out);
- residue_res = vdup_n_s16(isvc_get_residue(i2_it_out, 0, 0));
-
- vst1_s16(pi2_res, residue_res);
- vst1_s16(pi2_res + i4_res_stride, residue_res);
- vst1_s16(pi2_res + (i4_res_stride << 1), residue_res);
- vst1_s16(pi2_res + (i4_res_stride << 1) + i4_res_stride, residue_res);
-
- pred0_in = vld1_u8(pu1_pred);
- pu1_pred = pu1_pred + i4_pred_stride;
- pred1_in = vld1_u8(pu1_pred);
- pu1_pred = pu1_pred + i4_pred_stride;
- pred2_in = vld1_u8(pu1_pred);
- pu1_pred = pu1_pred + i4_pred_stride;
- pred3_in = vld1_u8(pu1_pred);
-
- pred0 = vreinterpretq_s16_u16(vmovl_u8(pred0_in));
- pred1 = vreinterpretq_s16_u16(vmovl_u8(pred1_in));
- pred2 = vreinterpretq_s16_u16(vmovl_u8(pred2_in));
- pred3 = vreinterpretq_s16_u16(vmovl_u8(pred3_in));
-
- /* Out pixel = Res + pred */
- pred0 = vaddq_s16(pred0, temp_0);
- pred1 = vaddq_s16(pred1, temp_0);
- pred2 = vaddq_s16(pred2, temp_0);
- pred3 = vaddq_s16(pred3, temp_0);
-
- /* Convert to unsigned 8 bit with saturation */
- pred0_in = vqmovun_s16(pred0);
- pred1_in = vqmovun_s16(pred1);
- pred2_in = vqmovun_s16(pred2);
- pred3_in = vqmovun_s16(pred3);
-
- vst1_lane_u32((uint32_t *) (pu1_out), vreinterpret_u32_u8(pred0_in), 0);
- vst1_lane_u32((uint32_t *) (pu1_out + i4_out_stride), vreinterpret_u32_u8(pred1_in), 0);
- vst1_lane_u32((uint32_t *) (pu1_out + i4_out_stride * 2), vreinterpret_u32_u8(pred2_in), 0);
- vst1_lane_u32((uint32_t *) (pu1_out + i4_out_stride * 3), vreinterpret_u32_u8(pred3_in), 0);
-}
-
-void isvc_iquant_itrans_recon_4x4_dc_with_res_accumulate_neon(
- buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
- buffer_container_t *ps_res, buffer_container_t *ps_rec,
- iq_it_res_rec_constants_t *ps_iq_it_res_rec_constants, WORD16 *pi2_tmp, WORD16 *pi2_dc_src,
- WORD32 i4_iq_start_idx, UWORD8 u1_res_accumulate)
-{
- WORD16 *pi2_src = (WORD16 *) ps_src->pv_data;
- WORD16 *pi2_res = (WORD16 *) ps_res->pv_data;
- WORD16 *pi2_res_pred = (WORD16 *) ps_res_pred->pv_data;
- UWORD8 *pu1_pred = (UWORD8 *) ps_pred->pv_data;
- UWORD8 *pu1_out = (UWORD8 *) ps_rec->pv_data;
- WORD32 i4_res_stride = ps_res->i4_data_stride;
- WORD32 i4_res_pred_stride = ps_res_pred->i4_data_stride;
- WORD32 i4_pred_stride = ps_pred->i4_data_stride;
- WORD32 i4_out_stride = ps_rec->i4_data_stride;
- const UWORD16 *pu2_iscal_mat = ps_iq_it_res_rec_constants->pu2_iscal_mat;
- const UWORD16 *pu2_weigh_mat = ps_iq_it_res_rec_constants->pu2_weigh_mat;
- UWORD32 u4_qp_div_6 = ps_iq_it_res_rec_constants->u4_qp_div_6;
- WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
-
- WORD32 i4_iq_out_temp;
- int16x4_t temp_0;
- uint8x8_t pred0_in, pred1_in, pred2_in, pred3_in;
- int16x8_t pred0, pred1, pred2, pred3;
- int16x8_t pred01_in, pred23_in;
- uint8x8_t pred01_un, pred23_un;
-
- int16x4_t resd0_in, resd1_in, resd2_in, resd3_in;
- int16x8_t resd01_in, resd23_in;
- int16x4_t pos_255 = vdup_n_s16(((WORD16) UINT8_MAX));
- int16x4_t neg_255 = vdup_n_s16(-((WORD16) UINT8_MAX));
-
- UNUSED(pi2_tmp);
- UNUSED(u1_res_accumulate);
-
- if(i4_iq_start_idx == 0)
- {
- i4_iq_out_temp = pi2_src[0];
- INV_QUANT(i4_iq_out_temp, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
- }
- else
- {
- i4_iq_out_temp = pi2_dc_src[0];
- }
-
- temp_0 = vdup_n_s16((i4_iq_out_temp + 32) >> 6);
-
- resd0_in = vld1_s16((int16_t *) pi2_res_pred);
- resd1_in = vld1_s16((int16_t *) pi2_res_pred + i4_res_pred_stride);
- resd2_in = vld1_s16((int16_t *) pi2_res_pred + (i4_res_pred_stride * 2));
- resd3_in = vld1_s16((int16_t *) pi2_res_pred + (i4_res_pred_stride * 3));
-
- /* Add res pred to the res obtained */
- resd0_in = vadd_s16(resd0_in, temp_0);
- resd1_in = vadd_s16(resd1_in, temp_0);
- resd2_in = vadd_s16(resd2_in, temp_0);
- resd3_in = vadd_s16(resd3_in, temp_0);
-
- /* Saturate all values < -255 to -255 and retain the rest as it is */
- resd0_in = vmax_s16(resd0_in, neg_255);
- resd1_in = vmax_s16(resd1_in, neg_255);
- resd2_in = vmax_s16(resd2_in, neg_255);
- resd3_in = vmax_s16(resd3_in, neg_255);
-
- /* Saturate all values > 255 to 255 and retain the rest as it is */
- resd0_in = vmin_s16(resd0_in, pos_255);
- resd1_in = vmin_s16(resd1_in, pos_255);
- resd2_in = vmin_s16(resd2_in, pos_255);
- resd3_in = vmin_s16(resd3_in, pos_255);
-
- vst1_s16(pi2_res, resd0_in);
- vst1_s16(pi2_res + i4_res_stride, resd1_in);
- vst1_s16(pi2_res + (i4_res_stride << 1), resd2_in);
- vst1_s16(pi2_res + (i4_res_stride << 1) + i4_res_stride, resd3_in);
-
- resd01_in = vcombine_s16(resd0_in, resd1_in);
- resd23_in = vcombine_s16(resd2_in, resd3_in);
-
- pred0_in = vld1_u8(pu1_pred);
- pu1_pred = pu1_pred + i4_pred_stride;
- pred1_in = vld1_u8(pu1_pred);
- pu1_pred = pu1_pred + i4_pred_stride;
- pred2_in = vld1_u8(pu1_pred);
- pu1_pred = pu1_pred + i4_pred_stride;
- pred3_in = vld1_u8(pu1_pred);
-
- pred0 = vreinterpretq_s16_u16(vmovl_u8(pred0_in));
- pred1 = vreinterpretq_s16_u16(vmovl_u8(pred1_in));
- pred2 = vreinterpretq_s16_u16(vmovl_u8(pred2_in));
- pred3 = vreinterpretq_s16_u16(vmovl_u8(pred3_in));
-
- pred01_in = vcombine_s16(vget_low_s16(pred0), vget_low_s16(pred1));
- pred23_in = vcombine_s16(vget_low_s16(pred2), vget_low_s16(pred3));
-
- /* Out pixel = Res + pred */
- pred01_in = vaddq_s16(pred01_in, resd01_in);
- pred23_in = vaddq_s16(pred23_in, resd23_in);
-
- /* Convert to unsigned 8 bit with saturation */
- pred01_un = vqmovun_s16(pred01_in);
- pred23_un = vqmovun_s16(pred23_in);
-
- vst1_lane_u32((uint32_t *) (pu1_out), vreinterpret_u32_u8(pred01_un), 0);
- vst1_lane_u32((uint32_t *) (pu1_out + i4_out_stride), vreinterpret_u32_u8(pred01_un), 1);
- vst1_lane_u32((uint32_t *) (pu1_out + (i4_out_stride << 1)), vreinterpret_u32_u8(pred23_un), 0);
- vst1_lane_u32((uint32_t *) (pu1_out + ((i4_out_stride << 1) + i4_out_stride)),
- vreinterpret_u32_u8(pred23_un), 1);
-}
-
-void isvc_iquant_itrans_recon_chroma_4x4_dc_neon(
- buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
- buffer_container_t *ps_res, buffer_container_t *ps_rec,
- iq_it_res_rec_constants_t *ps_iq_it_res_rec_constants, WORD16 *pi2_tmp, WORD16 *pi2_dc_src,
- WORD32 i4_iq_start_idx, UWORD8 u1_res_accumulate)
-{
- WORD16 *pi2_src = (WORD16 *) ps_src->pv_data;
- UWORD8 *pu1_pred = (UWORD8 *) ps_pred->pv_data;
- UWORD8 *pu1_out = (UWORD8 *) ps_rec->pv_data;
- WORD32 i4_pred_stride = ps_pred->i4_data_stride;
- WORD32 i4_out_stride = ps_rec->i4_data_stride;
- const UWORD16 *pu2_iscal_mat = ps_iq_it_res_rec_constants->pu2_iscal_mat;
- const UWORD16 *pu2_weigh_mat = ps_iq_it_res_rec_constants->pu2_weigh_mat;
- UWORD32 u4_qp_div_6 = ps_iq_it_res_rec_constants->u4_qp_div_6;
-
- WORD32 i4_iq_out_temp;
- int16x8_t temp_0;
- uint8x8_t pred0_in, pred1_in, pred2_in, pred3_in;
- int16x8_t pred0, pred1, pred2, pred3;
- uint8x8_t i4_out_horz_8x8_r0, i4_out_horz_8x8_r1, i4_out_horz_8x8_r2, i4_out_horz_8x8_r3;
- uint8x8_t chroma_mask_8x8 = vreinterpret_u8_u16(vdup_n_u16(0x00ff));
-
- UNUSED(pi2_src);
- UNUSED(pu2_iscal_mat);
- UNUSED(pu2_weigh_mat);
- UNUSED(u4_qp_div_6);
- UNUSED(pi2_tmp);
- UNUSED(i4_iq_start_idx);
- UNUSED(ps_res);
- UNUSED(ps_res_pred);
- UNUSED(u1_res_accumulate);
-
- i4_iq_out_temp = pi2_dc_src[0];
- temp_0 = vdupq_n_s16((i4_iq_out_temp + 32) >> 6);
-
- pred0_in = vld1_u8(pu1_pred);
- pu1_pred = pu1_pred + i4_pred_stride;
- pred1_in = vld1_u8(pu1_pred);
- pu1_pred = pu1_pred + i4_pred_stride;
- pred2_in = vld1_u8(pu1_pred);
- pu1_pred = pu1_pred + i4_pred_stride;
- pred3_in = vld1_u8(pu1_pred);
-
- pred0 = vreinterpretq_s16_u16(vmovl_u8(pred0_in));
- pred1 = vreinterpretq_s16_u16(vmovl_u8(pred1_in));
- pred2 = vreinterpretq_s16_u16(vmovl_u8(pred2_in));
- pred3 = vreinterpretq_s16_u16(vmovl_u8(pred3_in));
-
- /* Out pixel = Res + pred */
- pred0 = vaddq_s16(pred0, temp_0);
- pred1 = vaddq_s16(pred1, temp_0);
- pred2 = vaddq_s16(pred2, temp_0);
- pred3 = vaddq_s16(pred3, temp_0);
-
- /* Convert to unsigned 8 bit with saturation */
- pred0_in = vqmovun_s16(pred0);
- pred1_in = vqmovun_s16(pred1);
- pred2_in = vqmovun_s16(pred2);
- pred3_in = vqmovun_s16(pred3);
-
- i4_out_horz_8x8_r0 = vld1_u8(pu1_out);
- i4_out_horz_8x8_r1 = vld1_u8(pu1_out + i4_out_stride);
- i4_out_horz_8x8_r2 = vld1_u8(pu1_out + i4_out_stride * 2);
- i4_out_horz_8x8_r3 = vld1_u8(pu1_out + i4_out_stride * 3);
-
- /* Store out pixels in alternate positions */
- i4_out_horz_8x8_r0 = vbsl_u8(chroma_mask_8x8, pred0_in, i4_out_horz_8x8_r0);
- i4_out_horz_8x8_r1 = vbsl_u8(chroma_mask_8x8, pred1_in, i4_out_horz_8x8_r1);
- i4_out_horz_8x8_r2 = vbsl_u8(chroma_mask_8x8, pred2_in, i4_out_horz_8x8_r2);
- i4_out_horz_8x8_r3 = vbsl_u8(chroma_mask_8x8, pred3_in, i4_out_horz_8x8_r3);
-
- vst1_u8((uint8_t *) (pu1_out), i4_out_horz_8x8_r0);
- vst1_u8((uint8_t *) (pu1_out + i4_out_stride), i4_out_horz_8x8_r1);
- vst1_u8((uint8_t *) (pu1_out + i4_out_stride * 2), i4_out_horz_8x8_r2);
- vst1_u8((uint8_t *) (pu1_out + i4_out_stride * 3), i4_out_horz_8x8_r3);
-}
-
void isvc_iquant_itrans_recon_chroma_4x4_dc_with_res_output_neon(
buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
buffer_container_t *ps_res, buffer_container_t *ps_rec,
diff --git a/common/svc/isvc_mem_fns.c b/common/svc/isvc_mem_fns.c
index 345715a..35a4c66 100644
--- a/common/svc/isvc_mem_fns.c
+++ b/common/svc/isvc_mem_fns.c
@@ -124,164 +124,6 @@ void isvc_memset_2d(UWORD8 *pu1_dst, WORD32 i4_dst_stride, UWORD8 u1_val, WORD32
*******************************************************************************
*
* @brief
- * Function for copying to an interleaved destination
- *
- * @par Description:
- * Copies the array of width 'wd' and height 'ht' from the location pointed
- * by 'src' to the location pointed by 'dst'
- *
- * @param[in] pu1_src
- * UWORD8 pointer to the source
- *
- * @param[out] pu1_dst
- * UWORD8 pointer to the destination
- *
- * @param[in] src_strd
- * integer source stride
- *
- * @param[in] dst_strd
- * integer destination stride
- *
- * @param[in] ht
- * integer height of the array
- *
- * @param[in] wd
- * integer width of the array
- *
- * @returns
- *
- * @remarks
- * The alternate elements of src will be copied to alternate locations in dsr
- * Other locations are not touched
- *
- *******************************************************************************
- */
-void isvc_interleaved_copy(UWORD8 *pu1_src, UWORD8 *pu1_dst, WORD32 src_strd, WORD32 dst_strd,
- WORD32 ht, WORD32 wd)
-{
- WORD32 row, col;
- wd *= 2;
-
- for(row = 0; row < ht; row++)
- {
- for(col = 0; col < wd; col += 2)
- {
- pu1_dst[col] = pu1_src[col];
- }
-
- pu1_src += src_strd;
- pu1_dst += dst_strd;
- }
-}
-
-/**
- *******************************************************************************
- *
- * @brief
- * Function for copying to an interleaved destination
- *
- * @par Description:
- * Copies the array of width 'wd' and height 'ht' from the location pointed
- * by 'src' to the location pointed by 'dst'
- *
- * @param[in] pu1_src
- * UWORD8 pointer to the source
- *
- * @param[out] pu1_dst
- * UWORD8 pointer to the destination
- *
- * @param[in] src_strd
- * integer source stride
- *
- * @param[in] dst_strd
- * integer destination stride
- *
- * @param[in] ht
- * integer height of the array
- *
- * @param[in] wd
- * integer width of the array
- *
- * @returns
- *
- * @remarks
- * The alternate elements of src will be copied to alternate locations in dsr
- * Other locations are not touched
- *
- *******************************************************************************
- */
-void isvc_16bit_interleaved_copy(WORD16 *pi2_src, WORD16 *pi2_dst, WORD32 src_strd, WORD32 dst_strd,
- WORD32 ht, WORD32 wd)
-{
- WORD32 row, col;
- wd *= 2;
-
- for(row = 0; row < ht; row++)
- {
- for(col = 0; col < wd; col += 2)
- {
- pi2_dst[col] = pi2_src[col];
- }
-
- pi2_src += src_strd;
- pi2_dst += dst_strd;
- }
-}
-
-/**
- *******************************************************************************
- *
- * @brief
- * Function for memsetting to an interleaved destination
- *
- * @par Description:
- * Memsets the array of width 'wd' and height 'ht' pointed by 'src'
- *
- * @param[in] pu1_src
- * UWORD8 pointer to the source
- *
- * @param[in] src_strd
- * integer source stride
- *
- * @param[in] value
- * Value to set
- *
- * @param[in] ht
- * integer height of the array
- *
- * @param[in] wd
- * integer width of the array
- *
- * @returns
- *
- * @remarks
- * The alternate elements of src will be copied to alternate locations in dsr
- * Other locations are not touched
- *
- *******************************************************************************
- */
-void isvc_16bit_interleaved_memset(WORD16 *pi2_src, WORD32 i4_src_strd, WORD16 i2_value,
- WORD32 i4_wd, WORD32 i4_ht)
-{
- WORD32 row, col;
-
- i4_wd *= 2;
-
- for(row = 0; row < i4_ht; row++)
- {
- for(col = 0; col < i4_wd; col += 2)
- {
- pi2_src[col] = i2_value;
- }
-
- pi2_src += i4_src_strd;
- }
-}
-
-/**
- *******************************************************************************
- *
- * @brief
* Checks if any pixel in a block is non-zero
*
* @param[in] pu1_data
diff --git a/common/svc/isvc_mem_fns.h b/common/svc/isvc_mem_fns.h
index a4d95f7..581e478 100644
--- a/common/svc/isvc_mem_fns.h
+++ b/common/svc/isvc_mem_fns.h
@@ -64,32 +64,24 @@ typedef UWORD8 FT_NONZERO_CHECKER(UWORD8 *pu1_data, WORD32 i4_data_strd, UWORD32
UWORD32 u4_ht);
/* C function declarations */
-extern FT_MEMCPY ih264_memcpy;
extern FT_MEMCPY ih264_memcpy_mul_8;
-extern FT_MEMSET ih264_memset;
extern FT_MEMSET ih264_memset_mul_8;
extern FT_MEMSET_16BIT ih264_memset_16bit;
extern FT_MEMSET_16BIT ih264_memset_16bit_mul_8;
extern FT_COPY_2D isvc_copy_2d;
extern FT_MEMSET_2D isvc_memset_2d;
-extern FT_16BIT_INTERLEAVED_COPY isvc_16bit_interleaved_copy;
-extern FT_16BIT_INTERLEAVED_MEMSET isvc_16bit_interleaved_memset;
extern FT_NONZERO_CHECKER isvc_is_nonzero_blk;
extern FT_MEM_ALLOC isvc_memory_alloc;
extern FT_MEM_FREE isvc_memory_free;
/* A9 Q function declarations */
-extern FT_MEMCPY isvc_memcpy_a9q;
extern FT_MEMCPY ih264_memcpy_mul_8_a9q;
-extern FT_MEMSET ih264_memset_a9q;
extern FT_MEMSET ih264_memset_mul_8_a9q;
extern FT_MEMSET_16BIT ih264_memset_16bit_a9q;
extern FT_MEMSET_16BIT ih264_memset_16bit_mul_8_a9q;
/* AV8 function declarations */
-extern FT_MEMCPY ih264_memcpy_av8;
extern FT_MEMCPY ih264_memcpy_mul_8_av8;
-extern FT_MEMSET ih264_memset_av8;
extern FT_MEMSET ih264_memset_mul_8_av8;
extern FT_MEMSET_16BIT ih264_memset_16bit_av8;
extern FT_MEMSET_16BIT ih264_memset_16bit_mul_8_av8;
diff --git a/common/svc/isvc_trans_quant_itrans_iquant.h b/common/svc/isvc_trans_quant_itrans_iquant.h
index fd15dcc..7ded811 100644
--- a/common/svc/isvc_trans_quant_itrans_iquant.h
+++ b/common/svc/isvc_trans_quant_itrans_iquant.h
@@ -195,15 +195,11 @@ extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_4x4_sse42;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_res_4x4_sse42;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_res_4x4_with_res_acc_sse42;
-extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_chroma_4x4_sse42;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_res_chroma_4x4_sse42;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_res_chroma_4x4_with_res_acc_sse42;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_dc_4x4_sse42;
-extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_res_dc_4x4_sse42;
-extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_res_dc_with_res_acc_4x4_sse42;
-extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_chroma_4x4_dc_sse42;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_res_chroma_4x4_dc_sse42;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_res_chroma_4x4_dc_with_res_acc_sse42;
@@ -217,15 +213,11 @@ extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_4x4_neon;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_4x4_with_res_output_neon;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_4x4_with_res_accumulate_neon;
-extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_chroma_4x4_neon;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_chroma_4x4_with_res_output_neon;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_chroma_4x4_with_res_accumulate_neon;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_4x4_dc_neon;
-extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_4x4_dc_with_res_output_neon;
-extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_4x4_dc_with_res_accumulate_neon;
-extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_chroma_4x4_dc_neon;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_chroma_4x4_dc_with_res_output_neon;
extern FT_IQ_IT_RECON isvc_iquant_itrans_recon_chroma_4x4_dc_with_res_accumulate_neon;
diff --git a/common/x86/svc/isvc_iquant_itrans_recon_sse42.c b/common/x86/svc/isvc_iquant_itrans_recon_sse42.c
index 829952b..f86ebc7 100644
--- a/common/x86/svc/isvc_iquant_itrans_recon_sse42.c
+++ b/common/x86/svc/isvc_iquant_itrans_recon_sse42.c
@@ -1034,356 +1034,6 @@ void isvc_iquant_itrans_recon_res_4x4_with_res_acc_sse42(
*(pu4_out) = _mm_cvtsi128_si32(resq_r3);
}
-/*
- ********************************************************************************
- *
- * @brief This function reconstructs a 4x4 sub block from quantized chroma
- *resiude and prediction buffer
- *
- * @par Description:
- * The quantized residue is first inverse quantized, then inverse transformed.
- * This inverse transformed content is added to the prediction buffer to recon-
- * struct the end output
- *
- * @param[in] pi2_src
- * quantized 4x4 block
- *
- * @param[in] pu1_pred
- * prediction 4x4 block
- *
- * @param[out] pu1_out
- * reconstructed 4x4 block
- *
- * @param[in] src_strd
- * quantization buffer stride
- *
- * @param[in] i4_pred_stride,
- * Prediction buffer stride
- *
- * @param[in] i4_out_stride
- * recon buffer Stride
- *
- * @param[in] pu2_scaling_list
- * pointer to scaling list
- *
- * @param[in] pu2_norm_adjust
- * pointer to inverse scale matrix
- *
- * @param[in] u4_qp_div_6
- * Floor (qp/6)
- *
- * @param[in] pi4_tmp
- * temporary buffer of size 1*16
- *
- * @returns none
- *
- * @remarks none
- *
- *******************************************************************************
- */
-void isvc_iquant_itrans_recon_chroma_4x4_sse42(
- buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
- buffer_container_t *ps_res, buffer_container_t *ps_rec,
- iq_it_res_rec_constants_t *ps_iq_it_res_rec_constants, WORD16 *pi2_tmp, WORD16 *pi2_dc_src,
- WORD32 i4_iq_start_idx, UWORD8 u1_res_accumulate)
-{
- WORD16 *pi2_src = (WORD16 *) ps_src->pv_data;
- UWORD8 *pu1_pred = (UWORD8 *) ps_pred->pv_data;
- UWORD8 *pu1_out = (UWORD8 *) ps_rec->pv_data;
- WORD32 i4_src_stride = ps_src->i4_data_stride;
- WORD32 i4_pred_stride = ps_pred->i4_data_stride;
- WORD32 i4_out_stride = ps_rec->i4_data_stride;
- const UWORD16 *pu2_iscal_mat = ps_iq_it_res_rec_constants->pu2_iscal_mat;
- const UWORD16 *pu2_weigh_mat = ps_iq_it_res_rec_constants->pu2_weigh_mat;
- UWORD32 u4_qp_div_6 = ps_iq_it_res_rec_constants->u4_qp_div_6;
- __m128i src_r0_r1, src_r2_r3;
- __m128i src_r0, src_r1, src_r2, src_r3;
- __m128i scalemat_r0_r1, scalemat_r2_r3;
- __m128i pred_r0, pred_r1, pred_r2, pred_r3;
- __m128i sign_reg, dequant_r0_r1, dequant_r2_r3;
- /* all bits reset to zero */
- __m128i zero_8x16b = _mm_setzero_si128();
- __m128i neg_255_8x16b = _mm_set1_epi16(-((WORD16) UINT8_MAX));
- __m128i pos_255_8x16b = _mm_set1_epi16(((WORD16) UINT8_MAX));
- __m128i temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
- __m128i resq_r0, resq_r1, resq_r2, resq_r3;
- __m128i add_rshift = _mm_set1_epi32((u4_qp_div_6 < 4) ? (1 << (3 - u4_qp_div_6)) : 0);
- __m128i value_32 = _mm_set1_epi32(32);
- __m128i chroma_mask = _mm_set1_epi16(0xFF);
- __m128i out_r0, out_r1, out_r2, out_r3;
-
- ASSERT(4 == i4_src_stride);
- ASSERT(0 == u1_res_accumulate);
-
- UNUSED(i4_src_stride);
- UNUSED(u1_res_accumulate);
- UNUSED(ps_res);
- UNUSED(ps_res_pred);
- UNUSED(i4_iq_start_idx);
-
- /*************************************************************/
- /* Dequantization of coefficients. Will be replaced by SIMD */
- /* operations on platform */
- /*************************************************************/
- /* a00 a01 a02 a03 a10 a11 a12 a13 -- the source
- matrix 0th,1st row */
- src_r0_r1 = _mm_loadu_si128((__m128i *) (pi2_src));
-
- /* a20 a21 a22 a23 a30 a31 a32 a33 -- the
- source matrix 2nd,3rd row */
- src_r2_r3 = _mm_loadu_si128((__m128i *) (pi2_src + 8));
-
- /* b00 b01 b02 b03 b10 b11 b12 b13 -- the
- scaling matrix 0th,1st row */
- scalemat_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat));
-
- /* b20 b21 b22 b23 b30 b31 b32 b33 --b12 b13 -- the
- the scaling matrix 2nd,3rd row */
- scalemat_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat + 8));
-
- /* q00 q01 q02 q03 q10 q11
- q12 q13 -- all 16 bits */
- dequant_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat));
-
- /* q20 q21 q22 q23 q30 q31
- q32 q33 -- all 16 bits */
- dequant_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat + 8));
-
- temp0 = _mm_mullo_epi16(scalemat_r0_r1,
- dequant_r0_r1); // b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11
- // b12*q12 b13*q13 -- 16 bit result
-
- temp1 = _mm_mullo_epi16(scalemat_r2_r3, dequant_r2_r3);
-
- /* b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long */
- temp4 = _mm_unpacklo_epi16(temp0, zero_8x16b);
-
- /* b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long */
- temp5 = _mm_unpackhi_epi16(temp0, zero_8x16b);
-
- /* b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long */
- temp6 = _mm_unpacklo_epi16(temp1, zero_8x16b);
-
- /* b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long */
- temp7 = _mm_unpackhi_epi16(temp1, zero_8x16b);
-
- /* a00 0 a01 0 a02 0 a03 0 -- 16 bit long */
- src_r0 = _mm_unpacklo_epi16(src_r0_r1, zero_8x16b);
- /* a10 0 a11 0 a12 0 a13 0 -- 16 bit long */
- src_r1 = _mm_unpackhi_epi16(src_r0_r1, zero_8x16b);
- /* a20 0 a21 0 a22 0 a23 0 -- 16 bit long */
- src_r2 = _mm_unpacklo_epi16(src_r2_r3, zero_8x16b);
- /* a30 0 a31 0 a32 0 a33 0 -- 16 bit long */
- src_r3 = _mm_unpackhi_epi16(src_r2_r3, zero_8x16b);
-
- temp4 = _mm_madd_epi16(src_r0, temp4);
- temp5 = _mm_madd_epi16(src_r1, temp5);
- temp6 = _mm_madd_epi16(src_r2, temp6);
- temp7 = _mm_madd_epi16(src_r3, temp7);
-
- if(u4_qp_div_6 >= 4)
- {
- resq_r0 = _mm_slli_epi32(temp4, u4_qp_div_6 - 4);
- resq_r1 = _mm_slli_epi32(temp5, u4_qp_div_6 - 4);
- resq_r2 = _mm_slli_epi32(temp6, u4_qp_div_6 - 4);
- resq_r3 = _mm_slli_epi32(temp7, u4_qp_div_6 - 4);
- }
- else
- {
- temp4 = _mm_add_epi32(temp4, add_rshift);
- temp5 = _mm_add_epi32(temp5, add_rshift);
- temp6 = _mm_add_epi32(temp6, add_rshift);
- temp7 = _mm_add_epi32(temp7, add_rshift);
- resq_r0 = _mm_srai_epi32(temp4, 4 - u4_qp_div_6);
- resq_r1 = _mm_srai_epi32(temp5, 4 - u4_qp_div_6);
- resq_r2 = _mm_srai_epi32(temp6, 4 - u4_qp_div_6);
- resq_r3 = _mm_srai_epi32(temp7, 4 - u4_qp_div_6);
- }
-
- resq_r0 = _mm_insert_epi32(resq_r0, (WORD32) pi2_dc_src[0], 0);
- /* Perform Inverse transform */
- /*-------------------------------------------------------------*/
- /* IDCT [ Horizontal transformation ] */
- /*-------------------------------------------------------------*/
- // Matrix transpose
- /*
- * a0 a1 a2 a3
- * b0 b1 b2 b3
- * c0 c1 c2 c3
- * d0 d1 d2 d3
- */
- /* a0 b0 a1 b1 */
- temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);
- /* c0 d0 c1 d1 */
- temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);
- /* a2 b2 a3 b3 */
- temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);
- /* c2 d2 c3 d3 */
- temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);
- /* a0 b0 c0 d0 */
- resq_r0 = _mm_unpacklo_epi64(temp1, temp3);
- /* a1 b1 c1 d1 */
- resq_r1 = _mm_unpackhi_epi64(temp1, temp3);
- /* a2 b2 c2 d2 */
- resq_r2 = _mm_unpacklo_epi64(temp2, temp4);
- /* a3 b3 c3 d3 */
- resq_r3 = _mm_unpackhi_epi64(temp2, temp4);
- /* Transform starts -- horizontal transform */
-
- /*------------------------------------------------------------------*/
- /* z0 = w0 + w2 */
- temp0 = _mm_add_epi32(resq_r0, resq_r2);
- /* z1 = w0 - w2 */
- temp1 = _mm_sub_epi32(resq_r0, resq_r2);
- /* z2 = (w1 >> 1) - w3 */
- temp2 = _mm_srai_epi32(resq_r1, 1);
- temp2 = _mm_sub_epi32(temp2, resq_r3);
- /* z3 = w1 + (w3 >> 1) */
- temp3 = _mm_srai_epi32(resq_r3, 1); //(w3>>1) + w1
- temp3 = _mm_add_epi32(temp3, resq_r1);
- /*----------------------------------------------------------*/
- /* x0 = z0 + z3 */
- resq_r0 = _mm_add_epi32(temp0, temp3);
- /* x1 = z1 + z2 */
- resq_r1 = _mm_add_epi32(temp1, temp2);
- /* x2 = z1 - z2 */
- resq_r2 = _mm_sub_epi32(temp1, temp2);
- /* x3 = z0 - z3 */
- resq_r3 = _mm_sub_epi32(temp0, temp3);
- // Matrix transpose
- /*
- * a0 b0 c0 d0
- * a1 b1 c1 d1
- * a2 b2 c2 d2
- * a3 b3 c3 d3
- */
- /* a0 a1 b0 b1 */
- temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);
- /* a2 a3 b2 b3 */
- temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);
- /* c0 c1 d0 d1 */
- temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);
- /* c2 c3 d2 d3 */
- temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);
- /* a0 a1 a2 a3 */
- resq_r0 = _mm_unpacklo_epi64(temp1, temp3);
- /* b0 b1 b2 b3 */
- resq_r1 = _mm_unpackhi_epi64(temp1, temp3);
- /* c0 c1 c2 c3 */
- resq_r2 = _mm_unpacklo_epi64(temp2, temp4);
- /* d0 d1 d2 d3 */
- resq_r3 = _mm_unpackhi_epi64(temp2, temp4);
- /* Transform ends -- horizontal transform */
-
- temp0 = _mm_packs_epi32(resq_r0, resq_r1);
- temp1 = _mm_packs_epi32(resq_r2, resq_r3);
-
- _mm_storeu_si128((__m128i *) (&pi2_tmp[0]), temp0);
- _mm_storeu_si128((__m128i *) (&pi2_tmp[2 * 4]), temp1);
-
- /* Load pred buffer */
- pred_r0 = _mm_loadl_epi64((__m128i *) (&pu1_pred[0]));
- pred_r1 = _mm_loadl_epi64((__m128i *) (&pu1_pred[i4_pred_stride]));
- pred_r2 = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * i4_pred_stride]));
- pred_r3 = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * i4_pred_stride]));
-
- pred_r0 = _mm_and_si128(pred_r0, chroma_mask);
- pred_r1 = _mm_and_si128(pred_r1, chroma_mask);
- pred_r2 = _mm_and_si128(pred_r2, chroma_mask);
- pred_r3 = _mm_and_si128(pred_r3, chroma_mask);
-
- pred_r0 = _mm_unpacklo_epi64(pred_r0, pred_r1);
- pred_r1 = _mm_unpacklo_epi64(pred_r2, pred_r3);
-
- /*--------------------------------------------------------------*/
- /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6 */
- /* */
- /* Add the prediction and store it back to same buffer */
- /*--------------------------------------------------------------*/
- /* z0j = y0j + y2j */
- temp0 = _mm_add_epi32(resq_r0, resq_r2);
- /* z1j = y0j - y2j */
- temp1 = _mm_sub_epi32(resq_r0, resq_r2);
- /* z2j = (y1j>>1) - y3j */
- temp2 = _mm_srai_epi32(resq_r1, 1);
- temp2 = _mm_sub_epi32(temp2, resq_r3);
- /* z3j = y1j + (y3j>>1) */
- temp3 = _mm_srai_epi32(resq_r3, 1);
- temp3 = _mm_add_epi32(temp3, resq_r1);
-
- /* x0j = z0j + z3j */
- temp4 = _mm_add_epi32(temp0, temp3);
- temp4 = _mm_add_epi32(temp4, value_32);
- temp4 = _mm_srai_epi32(temp4, 6);
- /* x1j = z1j + z2j */
- temp5 = _mm_add_epi32(temp1, temp2);
- temp5 = _mm_add_epi32(temp5, value_32);
- temp5 = _mm_srai_epi32(temp5, 6);
- /* x2j = z1j - z2j */
- temp6 = _mm_sub_epi32(temp1, temp2);
- temp6 = _mm_add_epi32(temp6, value_32);
- temp6 = _mm_srai_epi32(temp6, 6);
- /* x3j = z0j - z3j */
- temp7 = _mm_sub_epi32(temp0, temp3);
- temp7 = _mm_add_epi32(temp7, value_32);
- temp7 = _mm_srai_epi32(temp7, 6);
-
- /* 32-bit to 16-bit conversion */
- temp0 = _mm_packs_epi32(temp4, temp5);
- temp1 = _mm_packs_epi32(temp6, temp7);
-
- /* Saturate all values < -255 to -255 and retain the rest as it is */
- temp4 = _mm_max_epi16(temp0, neg_255_8x16b);
- /* Saturate all values > 255 to 255 and retain the rest as it is */
- temp4 = _mm_min_epi16(temp4, pos_255_8x16b);
-
- /* Saturate all values < -255 to -255 and retain the rest as it is */
- temp5 = _mm_max_epi16(temp1, neg_255_8x16b);
- /* Saturate all values > 255 to 255 and retain the rest as it is */
- temp5 = _mm_min_epi16(temp5, pos_255_8x16b);
-
- temp0 = _mm_add_epi16(temp4, pred_r0);
- temp1 = _mm_add_epi16(temp5, pred_r1);
-
- /*------------------------------------------------------------------*/
- /* Clipping the results to 8 bits */
- sign_reg = _mm_cmpgt_epi16(temp0, zero_8x16b);
- temp0 = _mm_and_si128(temp0, sign_reg);
- sign_reg = _mm_cmpgt_epi16(temp1, zero_8x16b);
- temp1 = _mm_and_si128(temp1, sign_reg);
-
- resq_r0 = _mm_packus_epi16(temp0, temp1);
- resq_r1 = _mm_srli_si128(resq_r0, 4);
- resq_r2 = _mm_srli_si128(resq_r1, 4);
- resq_r3 = _mm_srli_si128(resq_r2, 4);
-
- resq_r0 = _mm_cvtepu8_epi16(resq_r0);
- resq_r1 = _mm_cvtepu8_epi16(resq_r1);
- resq_r2 = _mm_cvtepu8_epi16(resq_r2);
- resq_r3 = _mm_cvtepu8_epi16(resq_r3);
-
- chroma_mask = _mm_set1_epi16(0xFF00);
- out_r0 = _mm_loadl_epi64((__m128i *) (&pu1_out[0]));
- out_r1 = _mm_loadl_epi64((__m128i *) (&pu1_out[i4_out_stride]));
- out_r2 = _mm_loadl_epi64((__m128i *) (&pu1_out[2 * i4_out_stride]));
- out_r3 = _mm_loadl_epi64((__m128i *) (&pu1_out[3 * i4_out_stride]));
-
- out_r0 = _mm_and_si128(out_r0, chroma_mask);
- out_r1 = _mm_and_si128(out_r1, chroma_mask);
- out_r2 = _mm_and_si128(out_r2, chroma_mask);
- out_r3 = _mm_and_si128(out_r3, chroma_mask);
-
- out_r0 = _mm_add_epi8(out_r0, resq_r0);
- out_r1 = _mm_add_epi8(out_r1, resq_r1);
- out_r2 = _mm_add_epi8(out_r2, resq_r2);
- out_r3 = _mm_add_epi8(out_r3, resq_r3);
-
- _mm_storel_epi64((__m128i *) (&pu1_out[0]), out_r0);
- _mm_storel_epi64((__m128i *) (&pu1_out[i4_out_stride]), out_r1);
- _mm_storel_epi64((__m128i *) (&pu1_out[2 * i4_out_stride]), out_r2);
- _mm_storel_epi64((__m128i *) (&pu1_out[3 * i4_out_stride]), out_r3);
-}
-
void isvc_iquant_itrans_recon_res_chroma_4x4_sse42(
buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
buffer_container_t *ps_res, buffer_container_t *ps_rec,
@@ -2191,337 +1841,6 @@ void isvc_iquant_itrans_recon_dc_4x4_sse42(buffer_container_t *ps_src, buffer_co
*(pu4_out) = _mm_cvtsi128_si32(temp7);
}
-void isvc_iquant_itrans_recon_res_dc_4x4_sse42(
- buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
- buffer_container_t *ps_res, buffer_container_t *ps_rec,
- iq_it_res_rec_constants_t *ps_iq_it_res_rec_constants, WORD16 *pi2_tmp, WORD16 *pi2_dc_src,
- WORD32 i4_iq_start_idx, UWORD8 u1_res_accumulate)
-{
- WORD16 *pi2_res = (WORD16 *) ps_res->pv_data;
- WORD16 *pi2_res_ptr = pi2_res;
- UWORD8 *pu1_pred = (UWORD8 *) ps_pred->pv_data;
- UWORD8 *pu1_out = (UWORD8 *) ps_rec->pv_data;
- WORD32 i4_res_stride = ps_res->i4_data_stride;
- WORD32 i4_pred_stride = ps_pred->i4_data_stride;
- WORD32 i4_out_stride = ps_rec->i4_data_stride;
- const UWORD16 *pu2_iscal_mat = ps_iq_it_res_rec_constants->pu2_iscal_mat;
- const UWORD16 *pu2_weigh_mat = ps_iq_it_res_rec_constants->pu2_weigh_mat;
- UWORD32 u4_qp_div_6 = ps_iq_it_res_rec_constants->u4_qp_div_6;
- UWORD32 *pu4_out = (UWORD32 *) pu1_out;
- WORD32 q0 = ((WORD16 *) (ps_src->pv_data))[0];
- WORD16 i_macro, rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
-
- __m128i pred_r0, pred_r1, pred_r2, pred_r3;
- __m128i sign_reg;
- /* all bits reset to zero */
- __m128i zero_8x16b = _mm_setzero_si128();
- __m128i temp4, temp5, temp6, temp7;
- __m128i value_add;
-
- ASSERT(0 == u1_res_accumulate);
-
- UNUSED(pi2_tmp);
- UNUSED(ps_res_pred);
- UNUSED(u1_res_accumulate);
-
- INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
-
- /* Restoring dc value for intra case */
- if(i4_iq_start_idx != 0) q0 = pi2_dc_src[0];
-
- i_macro = ((q0 + 32) >> 6);
-
- value_add = _mm_set1_epi16(isvc_get_residue(i_macro, 0, 0));
-
- zero_8x16b = _mm_setzero_si128();
-
- /* Load pred buffer */
-
- /* p00 p01 p02 p03 0 0 0 0 -- all 8 bits */
- pred_r0 = _mm_loadl_epi64((__m128i *) (&pu1_pred[0]));
-
- /* p10 p11 p12 p13 0 0 0 0 -- all 8 bits */
- pred_r1 = _mm_loadl_epi64((__m128i *) (&pu1_pred[i4_pred_stride]));
-
- /* p20 p21 p22 p23 0 0 0 0 -- all 8 bits */
- pred_r2 = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * i4_pred_stride]));
-
- /* p30 p31 p32 p33 0 0 0 0 -- all 8 bits */
- pred_r3 = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * i4_pred_stride]));
-
- pred_r0 = _mm_cvtepu8_epi16(pred_r0);
- pred_r1 = _mm_cvtepu8_epi16(pred_r1);
- pred_r2 = _mm_cvtepu8_epi16(pred_r2);
- pred_r3 = _mm_cvtepu8_epi16(pred_r3);
-
- pred_r0 = _mm_unpacklo_epi64(pred_r0, pred_r1);
- pred_r2 = _mm_unpacklo_epi64(pred_r2, pred_r3);
-
- temp4 = _mm_add_epi16(value_add, pred_r0);
- temp5 = _mm_add_epi16(value_add, pred_r2);
-
- _mm_storeu_si128((__m128i *) (&pi2_res_ptr[0]), value_add);
- _mm_storeu_si128((__m128i *) (&pi2_res_ptr[i4_res_stride]), value_add);
- _mm_storeu_si128((__m128i *) (&pi2_res_ptr[2 * i4_res_stride]), value_add);
- _mm_storeu_si128((__m128i *) (&pi2_res_ptr[3 * i4_res_stride]), value_add);
- /*------------------------------------------------------------------*/
- /* Clipping the results to 8 bits */
- sign_reg = _mm_cmpgt_epi16(temp4, zero_8x16b);
- temp4 = _mm_and_si128(temp4, sign_reg);
- sign_reg = _mm_cmpgt_epi16(temp5, zero_8x16b);
- temp5 = _mm_and_si128(temp5, sign_reg);
-
- temp4 = _mm_packus_epi16(temp4, temp5);
- temp5 = _mm_srli_si128(temp4, 4);
- temp6 = _mm_srli_si128(temp5, 4);
- temp7 = _mm_srli_si128(temp6, 4);
-
- *pu4_out = _mm_cvtsi128_si32(temp4);
- pu1_out += i4_out_stride;
- pu4_out = (UWORD32 *) (pu1_out);
- *(pu4_out) = _mm_cvtsi128_si32(temp5);
- pu1_out += i4_out_stride;
- pu4_out = (UWORD32 *) (pu1_out);
- *(pu4_out) = _mm_cvtsi128_si32(temp6);
- pu1_out += i4_out_stride;
- pu4_out = (UWORD32 *) (pu1_out);
- *(pu4_out) = _mm_cvtsi128_si32(temp7);
-}
-
-void isvc_iquant_itrans_recon_res_dc_with_res_acc_4x4_sse42(
- buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
- buffer_container_t *ps_res, buffer_container_t *ps_rec,
- iq_it_res_rec_constants_t *ps_iq_it_res_rec_constants, WORD16 *pi2_tmp, WORD16 *pi2_dc_src,
- WORD32 i4_iq_start_idx, UWORD8 u1_res_accumulate)
-{
- WORD16 *pi2_res = (WORD16 *) ps_res->pv_data;
- WORD16 *pi2_res_ptr = pi2_res;
- WORD16 *pi2_res_pred = (WORD16 *) ps_res_pred->pv_data;
- WORD16 *pi2_res_pred_ptr = pi2_res_pred;
- UWORD8 *pu1_pred = (UWORD8 *) ps_pred->pv_data;
- UWORD8 *pu1_out = (UWORD8 *) ps_rec->pv_data;
- WORD32 i4_res_stride = ps_res->i4_data_stride;
- WORD32 i4_res_pred_stride = ps_res_pred->i4_data_stride;
- WORD32 i4_pred_stride = ps_pred->i4_data_stride;
- WORD32 i4_out_stride = ps_rec->i4_data_stride;
- const UWORD16 *pu2_iscal_mat = ps_iq_it_res_rec_constants->pu2_iscal_mat;
- const UWORD16 *pu2_weigh_mat = ps_iq_it_res_rec_constants->pu2_weigh_mat;
- UWORD32 u4_qp_div_6 = ps_iq_it_res_rec_constants->u4_qp_div_6;
- UWORD32 *pu4_out = (UWORD32 *) pu1_out;
- WORD32 q0 = ((WORD16 *) (ps_src->pv_data))[0];
- WORD16 i_macro, rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
-
- __m128i pred_r0, pred_r1, pred_r2, pred_r3;
- __m128i sign_reg;
- /* all bits reset to zero */
- __m128i zero_8x16b = _mm_setzero_si128();
- __m128i temp4, temp5, temp6, temp7;
- __m128i value_add;
- __m128i res_pred_r0, res_pred_r1, res_pred_r2, res_pred_r3;
- __m128i temp0, temp1;
- __m128i neg_255_8x16b = _mm_set1_epi16(-((WORD16) UINT8_MAX));
- __m128i pos_255_8x16b = _mm_set1_epi16(((WORD16) UINT8_MAX));
-
- ASSERT(1 == u1_res_accumulate);
-
- UNUSED(pi2_tmp);
- UNUSED(u1_res_accumulate);
-
- INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
-
- /* Restoring dc value for intra case */
- if(i4_iq_start_idx != 0) q0 = pi2_dc_src[0];
-
- i_macro = ((q0 + 32) >> 6);
-
- value_add = _mm_set1_epi16(i_macro);
-
- zero_8x16b = _mm_setzero_si128();
-
- /* Load pred buffer */
-
- /* p00 p01 p02 p03 0 0 0 0 -- all 8 bits */
- pred_r0 = _mm_loadl_epi64((__m128i *) (&pu1_pred[0]));
-
- /* p10 p11 p12 p13 0 0 0 0 -- all 8 bits */
- pred_r1 = _mm_loadl_epi64((__m128i *) (&pu1_pred[i4_pred_stride]));
-
- /* p20 p21 p22 p23 0 0 0 0 -- all 8 bits */
- pred_r2 = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * i4_pred_stride]));
-
- /* p30 p31 p32 p33 0 0 0 0 -- all 8 bits */
- pred_r3 = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * i4_pred_stride]));
-
- pred_r0 = _mm_cvtepu8_epi16(pred_r0);
- pred_r1 = _mm_cvtepu8_epi16(pred_r1);
- pred_r2 = _mm_cvtepu8_epi16(pred_r2);
- pred_r3 = _mm_cvtepu8_epi16(pred_r3);
-
- pred_r0 = _mm_unpacklo_epi64(pred_r0, pred_r1);
- pred_r2 = _mm_unpacklo_epi64(pred_r2, pred_r3);
-
- /* Accumulating res */
- res_pred_r0 = _mm_loadl_epi64((__m128i *) &pi2_res_pred_ptr[0]);
- res_pred_r1 = _mm_loadl_epi64((__m128i *) &pi2_res_pred_ptr[i4_res_pred_stride]);
- res_pred_r2 = _mm_loadl_epi64((__m128i *) &pi2_res_pred_ptr[2 * i4_res_pred_stride]);
- res_pred_r3 = _mm_loadl_epi64((__m128i *) &pi2_res_pred_ptr[3 * i4_res_pred_stride]);
-
- res_pred_r0 = _mm_unpacklo_epi64(res_pred_r0, res_pred_r1);
- res_pred_r1 = _mm_unpacklo_epi64(res_pred_r2, res_pred_r3);
-
- temp0 = _mm_add_epi16(value_add, res_pred_r0);
- temp1 = _mm_add_epi16(value_add, res_pred_r1);
-
- /* Saturate all values < -255 to -255 and retain the rest as it is */
- temp0 = _mm_max_epi16(temp0, neg_255_8x16b);
- /* Saturate all values > 255 to 255 and retain the rest as it is */
- temp0 = _mm_min_epi16(temp0, pos_255_8x16b);
-
- /* Saturate all values < -255 to -255 and retain the rest as it is */
- temp1 = _mm_max_epi16(temp1, neg_255_8x16b);
- /* Saturate all values > 255 to 255 and retain the rest as it is */
- temp1 = _mm_min_epi16(temp1, pos_255_8x16b);
-
- _mm_storeu_si128((__m128i *) (&pi2_res_ptr[0]), temp0);
- _mm_storeu_si128((__m128i *) (&pi2_res_ptr[2 * i4_res_stride]), temp1);
-
- temp4 = _mm_add_epi16(temp0, pred_r0);
- temp5 = _mm_add_epi16(temp1, pred_r2);
-
- temp0 = _mm_srli_si128(temp0, 8);
- temp1 = _mm_srli_si128(temp1, 8);
-
- _mm_storeu_si128((__m128i *) (&pi2_res_ptr[i4_res_stride]), temp0);
- _mm_storeu_si128((__m128i *) (&pi2_res_ptr[3 * i4_res_stride]), temp1);
-
- /*------------------------------------------------------------------*/
- /* Clipping the results to 8 bits */
- sign_reg = _mm_cmpgt_epi16(temp4, zero_8x16b);
- temp4 = _mm_and_si128(temp4, sign_reg);
- sign_reg = _mm_cmpgt_epi16(temp5, zero_8x16b);
- temp5 = _mm_and_si128(temp5, sign_reg);
-
- temp4 = _mm_packus_epi16(temp4, temp5);
- temp5 = _mm_srli_si128(temp4, 4);
- temp6 = _mm_srli_si128(temp5, 4);
- temp7 = _mm_srli_si128(temp6, 4);
-
- *pu4_out = _mm_cvtsi128_si32(temp4);
- pu1_out += i4_out_stride;
- pu4_out = (UWORD32 *) (pu1_out);
- *(pu4_out) = _mm_cvtsi128_si32(temp5);
- pu1_out += i4_out_stride;
- pu4_out = (UWORD32 *) (pu1_out);
- *(pu4_out) = _mm_cvtsi128_si32(temp6);
- pu1_out += i4_out_stride;
- pu4_out = (UWORD32 *) (pu1_out);
- *(pu4_out) = _mm_cvtsi128_si32(temp7);
-}
-
-void isvc_iquant_itrans_recon_chroma_4x4_dc_sse42(
- buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
- buffer_container_t *ps_res, buffer_container_t *ps_rec,
- iq_it_res_rec_constants_t *ps_iq_it_res_rec_constants, WORD16 *pi2_tmp, WORD16 *pi2_dc_src,
- WORD32 i4_iq_start_idx, UWORD8 u1_res_accumulate)
-{
- WORD16 *pi2_src = (WORD16 *) ps_src->pv_data;
- UWORD8 *pu1_pred = (UWORD8 *) ps_pred->pv_data;
- UWORD8 *pu1_out = (UWORD8 *) ps_rec->pv_data;
- WORD32 i4_pred_stride = ps_pred->i4_data_stride;
- WORD32 i4_out_stride = ps_rec->i4_data_stride;
- const UWORD16 *pu2_iscal_mat = ps_iq_it_res_rec_constants->pu2_iscal_mat;
- const UWORD16 *pu2_weigh_mat = ps_iq_it_res_rec_constants->pu2_weigh_mat;
- UWORD32 u4_qp_div_6 = ps_iq_it_res_rec_constants->u4_qp_div_6;
- /* DC value won't be dequantized for chroma
- inverse transform */
- WORD16 q0 = pi2_dc_src[0];
- WORD16 i_macro = ((q0 + 32) >> 6);
-
- __m128i pred_r0, pred_r1, pred_r2, pred_r3;
- /* all bits reset to zero */
- __m128i zero_8x16b = _mm_setzero_si128();
- __m128i chroma_mask = _mm_set1_epi16(0xFF);
- __m128i value_add = _mm_set1_epi16(i_macro);
- __m128i out_r0, out_r1, out_r2, out_r3;
-
- ASSERT(0 == u1_res_accumulate);
-
- UNUSED(pi2_src);
- UNUSED(pu2_iscal_mat);
- UNUSED(pu2_weigh_mat);
- UNUSED(u4_qp_div_6);
- UNUSED(pi2_tmp);
- UNUSED(ps_res_pred);
- UNUSED(ps_res);
- UNUSED(i4_iq_start_idx);
- UNUSED(u1_res_accumulate);
-
- /* Load pred buffer */
- pred_r0 = _mm_loadl_epi64((__m128i *) (&pu1_pred[0]));
-
- pred_r1 = _mm_loadl_epi64((__m128i *) (&pu1_pred[i4_pred_stride]));
-
- pred_r2 = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * i4_pred_stride]));
-
- pred_r3 = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * i4_pred_stride]));
-
- /* Mask alternate pred values from the interleaved pred buf */
- pred_r0 = _mm_and_si128(pred_r0, chroma_mask);
- pred_r1 = _mm_and_si128(pred_r1, chroma_mask);
- pred_r2 = _mm_and_si128(pred_r2, chroma_mask);
- pred_r3 = _mm_and_si128(pred_r3, chroma_mask);
-
- /* Pack the first four 16 bit values of 2 regs into a single reg*/
- pred_r0 = _mm_unpacklo_epi64(pred_r0, pred_r1);
- pred_r2 = _mm_unpacklo_epi64(pred_r2, pred_r3);
-
- /* Compute out pixel by adding res to pred */
- pred_r0 = _mm_add_epi16(value_add, pred_r0);
- pred_r2 = _mm_add_epi16(value_add, pred_r2);
- /*------------------------------------------------------------------*/
- /* Clipping the results to 8 bits */
- pred_r0 = _mm_packus_epi16(pred_r0, pred_r2);
- pred_r1 = _mm_srli_si128(pred_r0, 4);
- pred_r2 = _mm_srli_si128(pred_r1, 4);
- pred_r3 = _mm_srli_si128(pred_r2, 4);
-
- /* p00 p01 p02 p03 -- all 16 bits */
- pred_r0 = _mm_unpacklo_epi8(pred_r0, zero_8x16b);
- /* p10 p11 p12 p13 -- all 16 bits */
- pred_r1 = _mm_unpacklo_epi8(pred_r1, zero_8x16b);
- /* p20 p21 p22 p23 -- all 16 bits */
- pred_r2 = _mm_unpacklo_epi8(pred_r2, zero_8x16b);
- /* p30 p31 p32 p33 -- all 16 bits */
- pred_r3 = _mm_unpacklo_epi8(pred_r3, zero_8x16b);
-
- /* Load interleaved out buffer */
- out_r0 = _mm_loadl_epi64((__m128i *) (&pu1_out[0]));
- out_r1 = _mm_loadl_epi64((__m128i *) (&pu1_out[i4_out_stride]));
- out_r2 = _mm_loadl_epi64((__m128i *) (&pu1_out[2 * i4_out_stride]));
- out_r3 = _mm_loadl_epi64((__m128i *) (&pu1_out[3 * i4_out_stride]));
-
- /* Mask the interleaved out buf in order to save the U/V out pixel computed in
- this function call without thrashing the U/V out pixel that was saved
- during an earlier function call */
- chroma_mask = _mm_set1_epi16(0xFF00);
-
- out_r0 = _mm_and_si128(out_r0, chroma_mask);
- out_r1 = _mm_and_si128(out_r1, chroma_mask);
- out_r2 = _mm_and_si128(out_r2, chroma_mask);
- out_r3 = _mm_and_si128(out_r3, chroma_mask);
-
- /* Save the out pixels in alternate locations */
- out_r0 = _mm_add_epi8(out_r0, pred_r0);
- out_r1 = _mm_add_epi8(out_r1, pred_r1);
- out_r2 = _mm_add_epi8(out_r2, pred_r2);
- out_r3 = _mm_add_epi8(out_r3, pred_r3);
-
- _mm_storel_epi64((__m128i *) (&pu1_out[0]), out_r0);
- _mm_storel_epi64((__m128i *) (&pu1_out[i4_out_stride]), out_r1);
- _mm_storel_epi64((__m128i *) (&pu1_out[2 * i4_out_stride]), out_r2);
- _mm_storel_epi64((__m128i *) (&pu1_out[3 * i4_out_stride]), out_r3);
-}
-
void isvc_iquant_itrans_recon_res_chroma_4x4_dc_sse42(
buffer_container_t *ps_src, buffer_container_t *ps_pred, buffer_container_t *ps_res_pred,
buffer_container_t *ps_res, buffer_container_t *ps_rec,
diff --git a/decoder/ih264d_parse_headers.c b/decoder/ih264d_parse_headers.c
index b25af69..a92ad8a 100644
--- a/decoder/ih264d_parse_headers.c
+++ b/decoder/ih264d_parse_headers.c
@@ -1095,6 +1095,20 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
ret = ih264d_parse_vui_parametres(&ps_seq->s_vui, ps_bitstrm);
if(ret != OK)
return ret;
+
+ if (ps_dec->pu1_bits_buf_dynamic != NULL) {
+ vui_t *ps_vui = &ps_seq->s_vui;
+ dec_seq_params_t *ps_sps_old = ps_dec->ps_sps;
+ vui_t *ps_vui_old = &ps_sps_old->s_vui;
+
+ if (ps_vui->u1_video_full_range_flag != ps_vui_old->u1_video_full_range_flag ||
+ ps_vui->u1_colour_primaries != ps_vui_old->u1_colour_primaries ||
+ ps_vui->u1_tfr_chars != ps_vui_old->u1_tfr_chars ||
+ ps_vui->u1_matrix_coeffs != ps_vui_old->u1_matrix_coeffs) {
+ ps_dec->u1_res_changed = 1;
+ return IVD_RES_CHANGED;
+ }
+ }
}
/* Compare older num_reorder_frames with the new one if header is already decoded */
diff --git a/decoder/ih264d_sei.c b/decoder/ih264d_sei.c
index 079f036..e7d436c 100644
--- a/decoder/ih264d_sei.c
+++ b/decoder/ih264d_sei.c
@@ -853,6 +853,14 @@ WORD32 ih264d_parse_fgc(dec_bit_stream_t *ps_bitstrm, dec_struct_t *ps_dec,
for(i = 0; i <= ps_sei->s_sei_fgc_params.au1_num_intensity_intervals_minus1[c]; i++)
{
+ /* Although the fag end of both the NALU and the bitstream buffer */
+ /* is being parsed, not all FGC SEI symbols would have been */
+ /* decoded semantically. The code below detects this condition */
+ if((ps_bitstrm->u4_ofst + 8 + 8) >= ps_bitstrm->u4_max_ofst)
+ {
+ return ERROR_INV_SEI_FGC_PARAMS;
+ }
+
ps_sei->s_sei_fgc_params.au1_intensity_interval_lower_bound[c][i] =
(UWORD8) ih264d_get_bits_h264(ps_bitstrm, 8);
diff --git a/decoder/ih264d_utils.c b/decoder/ih264d_utils.c
index 9d616d3..ffb575a 100644
--- a/decoder/ih264d_utils.c
+++ b/decoder/ih264d_utils.c
@@ -1599,9 +1599,10 @@ WORD32 ih264d_decode_gaps_in_frame_num(dec_struct_t *ps_dec,
if(ps_dec->u2_prev_ref_frame_num == u2_frame_num)
return 0;
}
+ ps_pic_params = ps_dec->ps_cur_pps;
u4_next_frm_num = ps_dec->u2_prev_ref_frame_num + 1;
- u4_max_frm_num = ps_dec->ps_cur_sps->u2_u4_max_pic_num_minus1 + 1;
+ u4_max_frm_num = ps_pic_params->ps_sps->u2_u4_max_pic_num_minus1 + 1;
// check
if(u4_next_frm_num >= u4_max_frm_num)
@@ -1630,7 +1631,6 @@ WORD32 ih264d_decode_gaps_in_frame_num(dec_struct_t *ps_dec,
s_tmp_poc.i4_delta_pic_order_cnt[1] = 0;
ps_cur_slice = ps_dec->ps_cur_slice;
- ps_pic_params = ps_dec->ps_cur_pps;
i4_frame_gaps = 0;
ps_dpb_mgr = ps_dec->ps_dpb_mgr;
diff --git a/decoder/mvc/imvcd_api.c b/decoder/mvc/imvcd_api.c
index 45fffd1..1026fc8 100644
--- a/decoder/mvc/imvcd_api.c
+++ b/decoder/mvc/imvcd_api.c
@@ -731,17 +731,27 @@ static IV_API_CALL_STATUS_T imvcd_view_decode(iv_obj_t *ps_dec_hdl, imvcd_video_
return IV_FAIL;
}
- /* Ignore bytes beyond the allocated size of intermediate buffer */
- /* Since 8 bytes are read ahead, ensure 8 bytes are free at the
- end of the buffer, which will be memset to 0 after emulation prevention */
- i4_nalu_length = MIN((UWORD32) i4_nalu_length, u4_bitstream_buf_size - 8);
-
if(i4_nalu_length)
{
+ UWORD32 u4_nalu_buf_size = ((UWORD32) i4_nalu_length) + 8;
+
+ if(u4_nalu_buf_size > u4_bitstream_buf_size)
+ {
+ /* 64 extra bytes to account for OOB accesses during SEI parsing in */
+ /* some fuzzer bitstreams */
+ if(IV_SUCCESS != imvcd_bitstream_buf_realloc(ps_view_ctxt, u4_nalu_buf_size + 64))
+ {
+ return IV_FAIL;
+ }
+
+ pu1_bitstream_buf = ps_view_ctxt->pu1_bits_buf_dynamic;
+ u4_bitstream_buf_size = ps_view_ctxt->u4_dynamic_bits_buf_size;
+ }
+
memcpy(pu1_bitstream_buf, pu1_input_buffer + u4_length_of_start_code, i4_nalu_length);
/* Decoder may read extra 8 bytes near end of the frame */
- if(((UWORD32) (i4_nalu_length + 8)) < u4_bitstream_buf_size)
+ if(u4_nalu_buf_size < u4_bitstream_buf_size)
{
memset(pu1_bitstream_buf + i4_nalu_length, 0, 8 * sizeof(pu1_bitstream_buf[0]));
}
diff --git a/decoder/mvc/imvcd_api_utils.c b/decoder/mvc/imvcd_api_utils.c
index 7d1f309..3a40d3b 100644
--- a/decoder/mvc/imvcd_api_utils.c
+++ b/decoder/mvc/imvcd_api_utils.c
@@ -391,3 +391,19 @@ void imvcd_bitsteam_buf_free(dec_struct_t *ps_view_ctxt)
{
PS_DEC_ALIGNED_FREE(ps_view_ctxt, ps_view_ctxt->pu1_bits_buf_dynamic);
}
+
+IV_API_CALL_STATUS_T imvcd_bitstream_buf_realloc(dec_struct_t *ps_view_ctxt, UWORD32 u4_size)
+{
+ imvcd_bitsteam_buf_free(ps_view_ctxt);
+
+ u4_size = MAX(MIN_BITSTREAMS_BUF_SIZE, u4_size);
+
+ ps_view_ctxt->pu1_bits_buf_dynamic =
+ ps_view_ctxt->pf_aligned_alloc(ps_view_ctxt->pv_mem_ctxt, 128, u4_size);
+ RETURN_IF((NULL == ps_view_ctxt->pu1_bits_buf_dynamic), IV_FAIL);
+
+ memset(ps_view_ctxt->pu1_bits_buf_dynamic, 0, u4_size);
+ ps_view_ctxt->u4_dynamic_bits_buf_size = u4_size;
+
+ return IV_SUCCESS;
+}
diff --git a/decoder/mvc/imvcd_api_utils.h b/decoder/mvc/imvcd_api_utils.h
index 0707f45..8b025b2 100644
--- a/decoder/mvc/imvcd_api_utils.h
+++ b/decoder/mvc/imvcd_api_utils.h
@@ -53,6 +53,9 @@ extern IV_API_CALL_STATUS_T imvcd_bitstream_buf_alloc(dec_struct_t *ps_view_ctxt
extern void imvcd_bitsteam_buf_free(dec_struct_t *ps_view_ctxt);
+extern IV_API_CALL_STATUS_T imvcd_bitstream_buf_realloc(dec_struct_t *ps_view_ctxt,
+ UWORD32 u4_size);
+
extern void imvcd_convert_to_app_disp_buf(mvc_dec_ctxt_t *ps_mvcd_ctxt,
iv_yuv_buf_t *ps_view_disp_bufs);
#endif
diff --git a/decoder/mvc/imvcd_defs.h b/decoder/mvc/imvcd_defs.h
index 0b8c976..2bf5e54 100644
--- a/decoder/mvc/imvcd_defs.h
+++ b/decoder/mvc/imvcd_defs.h
@@ -34,14 +34,6 @@
is still greater than any possible value of u1_pic_buf_id */
#define IVP_PIC_BUF_ID UINT8_MAX
-/* In FGC SEI
- - Worst-case bits for all elements before 'num_intensity_intervals_minus1' = 47
- - Worst-case bits for all elements before 'film_grain_characteristics_repetition_period', not
- including elements from previous line = 3 * (8 + 3 + 256 * (8 + 8 + 8 * 16)) = 110625
- - Worst-case bits for 'film_grain_characteristics_repetition_period' = 30
- Total of (47 + 110625 + 30) = 110702 byte */
-#define MAX_FGC_SEI_SIZE 110702
-
-#define MIN_BITSTREAMS_BUF_SIZE (MAX_FGC_SEI_SIZE + 256000)
+#define MIN_BITSTREAMS_BUF_SIZE 256000
#endif
diff --git a/decoder/svc/isvcd_api.c b/decoder/svc/isvcd_api.c
index c449fba..c789785 100644
--- a/decoder/svc/isvcd_api.c
+++ b/decoder/svc/isvcd_api.c
@@ -2619,7 +2619,7 @@ WORD32 isvcd_allocate_static_bufs(iv_obj_t **dec_hdl, void *pv_api_ip, void *pv_
ps_svc_lyr_dec->u1_dyadic_flag = 1;
ps_svc_lyr_dec->u1_restricted_res_change_flag = 1;
ps_svc_lyr_dec->u1_base_res_flag = 1;
- ps_svc_lyr_dec->u1_ref_layer_id = 0;
+ ps_svc_lyr_dec->u1_ref_layer_id = u1_layer_id - 1;
ps_svc_lyr_dec->ps_dec_svc_ref_layer =
&ps_svcd_ctxt->ps_svc_dec_lyr[ps_svc_lyr_dec->u1_ref_layer_id];
ps_svc_lyr_dec->u4_pps_id_for_layer = UINT32_MAX;
@@ -4435,6 +4435,15 @@ WORD32 isvcd_dec_non_vcl(void *pv_out_non_vcl, void *pv_seq_params, void *pv_pic
{
ps_dec->i4_header_decoded |= 0x1;
ps_svcd_ctxt->u4_num_sps_ctr++;
+
+ if(ps_svcd_ctxt->pic_width < ps_svc_lyr_dec->pic_width)
+ {
+ ps_svcd_ctxt->pic_width = ps_svc_lyr_dec->pic_width;
+ }
+ if(ps_svcd_ctxt->pic_height < ps_svc_lyr_dec->pic_height)
+ {
+ ps_svcd_ctxt->pic_height = ps_svc_lyr_dec->pic_height;
+ }
}
if(i_status) return i_status;
@@ -4448,6 +4457,15 @@ WORD32 isvcd_dec_non_vcl(void *pv_out_non_vcl, void *pv_seq_params, void *pv_pic
{
ps_svcd_ctxt->u4_num_sps_ctr++;
ps_dec->i4_header_decoded |= 0x1;
+
+ if(ps_svcd_ctxt->pic_width < ps_svc_lyr_dec->pic_width)
+ {
+ ps_svcd_ctxt->pic_width = ps_svc_lyr_dec->pic_width;
+ }
+ if(ps_svcd_ctxt->pic_height < ps_svc_lyr_dec->pic_height)
+ {
+ ps_svcd_ctxt->pic_height = ps_svc_lyr_dec->pic_height;
+ }
}
if(i_status) return i_status;
@@ -5183,6 +5201,7 @@ WORD32 isvcd_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
UWORD8 u1_layer_nal_data_present = 0;
ps_svcd_ctxt->u1_cur_layer_id = u1_res_id;
ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr + u1_res_id;
+ ps_svc_lyr_dec->u1_res_init_done = 0;
ps_dec = &ps_svc_lyr_dec->s_dec;
ps_dec->i4_decode_header = ps_dec_zero_lyr->i4_decode_header;
@@ -5319,7 +5338,7 @@ WORD32 isvcd_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
ps_dec = &ps_svc_lyr_dec->s_dec;
if((0 == ps_svcd_ctxt->u4_num_sps_ctr) || (0 == ps_svcd_ctxt->u4_num_pps_ctr) ||
- (NULL == ps_dec->ps_cur_pps))
+ (NULL == ps_dec->ps_cur_pps) || (ps_svc_lyr_dec->u1_res_init_done == 0))
{
ps_svcd_ctxt->u1_exit_till_next_IDR = 1;
ps_dec_op->u4_error_code = ERROR_UNKNOWN_NAL;
@@ -6085,16 +6104,8 @@ WORD32 isvcd_get_buf_info(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
if(ps_dec->i4_header_decoded == 3)
{
- if(0 == ps_dec->u4_share_disp_buf)
- {
- pic_wd = ps_dec->u2_disp_width;
- pic_ht = ps_dec->u2_disp_height;
- }
- else
- {
- pic_wd = ps_dec->u2_frm_wd_y;
- pic_ht = ps_dec->u2_frm_ht_y;
- }
+ pic_wd = ps_svcd_ctxt->pic_width;
+ pic_ht = ps_svcd_ctxt->pic_height;
}
for(i = 0; i < ps_ctl_op->u4_min_num_in_bufs; i++)
diff --git a/decoder/svc/isvcd_intra_resamp.c b/decoder/svc/isvcd_intra_resamp.c
index 34e3779..326dd5c 100644
--- a/decoder/svc/isvcd_intra_resamp.c
+++ b/decoder/svc/isvcd_intra_resamp.c
@@ -4959,6 +4959,45 @@ void isvcd_crop_wnd_flag_res_int(void *pv_svc_dec)
/* 26 08 2021 vijayakumar creation */
/* */
/*****************************************************************************/
+void isvcd_intra_resamp_res_init_update_flags(void *pv_svc_dec)
+{
+ intra_sampling_ctxt_t *ps_ctxt;
+ intra_samp_lyr_ctxt *ps_lyr_ctxt;
+ svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) pv_svc_dec;
+
+ ps_ctxt = (intra_sampling_ctxt_t *) ps_svc_lyr_dec->pv_intra_sample_ctxt;;
+ /* get the current layer ctxt */
+ ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_svc_lyr_dec->u1_layer_id - 1];
+
+ ps_lyr_ctxt->i1_constrained_intra_rsmpl_flag =
+ ps_svc_lyr_dec->s_svc_slice_params.u1_constrained_intra_resampling_flag;
+}
+
+/*****************************************************************************/
+/* */
+/* Function Name : isvcd_intra_resamp_res_init */
+/* */
+/* Description : this function calculates the scale factors and initialise*/
+/* the context structure */
+/* */
+/* Inputs : pv_intra_samp_ctxt: handle to private structure */
+/* ps_curr_lyr_res_prms: pointer to current resolution */
+/* params */
+/* ps_ref_lyr_res_prms : pointer to ref resolution params */
+/* Globals : none */
+/* Processing : it stores the layer dimensions */
+/* */
+/* Outputs : none */
+/* Returns : none */
+/* */
+/* Issues : none */
+/* */
+/* Revision History: */
+/* */
+/* DD MM YYYY Author(s) Changes (Describe the changes made) */
+/* 26 08 2021 vijayakumar creation */
+/* */
+/*****************************************************************************/
WORD32 isvcd_intra_resamp_res_init(void *pv_svc_dec)
{
intra_sampling_ctxt_t *ps_ctxt;
diff --git a/decoder/svc/isvcd_intra_resamp.h b/decoder/svc/isvcd_intra_resamp.h
index 9b15a6d..7f09117 100644
--- a/decoder/svc/isvcd_intra_resamp.h
+++ b/decoder/svc/isvcd_intra_resamp.h
@@ -628,4 +628,6 @@ void isvcd_crop_wnd_flag_res_int(void *ps_svc_dec);
WORD32 isvcd_intra_resamp_res_init(void *ps_svc_dec);
+void isvcd_intra_resamp_res_init_update_flags(void *ps_svc_dec);
+
#endif /* _ISVCD_INTRA_RESAMPLE_H_ */
diff --git a/decoder/svc/isvcd_parse_ebslice.c b/decoder/svc/isvcd_parse_ebslice.c
index d805764..b1807ea 100644
--- a/decoder/svc/isvcd_parse_ebslice.c
+++ b/decoder/svc/isvcd_parse_ebslice.c
@@ -622,6 +622,7 @@ WORD32 isvcd_mv_pred_ref_tfr_nby2_ebmb(dec_struct_t *ps_dec, UWORD8 u1_mb_idx, U
}
}
}
+
return OK;
}
@@ -1790,12 +1791,6 @@ WORD32 isvcd_parse_ebslice(svc_dec_lyr_struct_t *ps_svc_lyr_dec, UWORD16 u2_firs
return ERROR_INV_SLICE_HDR_T;
}
- ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
- if(ret != OK)
- {
- return ERROR_CORRUPTED_SLICE;
- }
-
ps_dec->u1_slice_header_done = 2;
if(!ps_svc_slice_params->u1_slice_skip_flag)
{
@@ -2130,11 +2125,6 @@ WORD32 isvcd_parse_bslice(svc_dec_lyr_struct_t *ps_svc_lyr_dec, UWORD16 u2_first
ps_slice->i1_slice_beta_offset = 0;
}
- ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
- if(ret != OK)
- {
- return ERROR_CORRUPTED_SLICE;
- }
ps_dec->u1_slice_header_done = 2;
if(ps_pps->u1_entropy_coding_mode)
diff --git a/decoder/svc/isvcd_parse_eislice.c b/decoder/svc/isvcd_parse_eislice.c
index 4b3728c..c412fc5 100644
--- a/decoder/svc/isvcd_parse_eislice.c
+++ b/decoder/svc/isvcd_parse_eislice.c
@@ -1127,11 +1127,6 @@ WORD32 isvcd_parse_eislice(svc_dec_lyr_struct_t *ps_svc_lyr_dec, UWORD16 u2_firs
ps_dec->u2_mv_2mb[0] = 0;
ps_dec->u2_mv_2mb[1] = 0;
- ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
- if(ret != OK)
- {
- return ERROR_CORRUPTED_SLICE;
- }
/*set slice header cone to 2 ,to indicate correct header*/
ps_dec->u1_slice_header_done = 2;
@@ -2064,11 +2059,6 @@ WORD32 isvcd_parse_islice(svc_dec_lyr_struct_t *ps_svc_lyr_dec, UWORD16 u2_first
ps_dec->u2_mv_2mb[0] = 0;
ps_dec->u2_mv_2mb[1] = 0;
- ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
- if(ret != OK)
- {
- return ERROR_CORRUPTED_SLICE;
- }
/*set slice header cone to 2 ,to indicate correct header*/
ps_dec->u1_slice_header_done = 2;
if(ps_pps->u1_entropy_coding_mode)
diff --git a/decoder/svc/isvcd_parse_epslice.c b/decoder/svc/isvcd_parse_epslice.c
index bfd32bb..36621ba 100644
--- a/decoder/svc/isvcd_parse_epslice.c
+++ b/decoder/svc/isvcd_parse_epslice.c
@@ -425,11 +425,6 @@ WORD32 isvcd_parse_epslice(svc_dec_lyr_struct_t *ps_svc_lyr_dec, UWORD16 u2_firs
return ERROR_INV_SLICE_HDR_T;
}
- ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
- if(ret != OK)
- {
- return ERROR_CORRUPTED_SLICE;
- }
ps_dec->u1_slice_header_done = 2;
if(!ps_svc_slice_params->u1_slice_skip_flag)
@@ -3188,6 +3183,8 @@ WORD32 isvcd_parse_interlayer_resamp_func_init(svc_dec_lyr_struct_t *ps_svc_lyr_
dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
dec_slice_params_t *ps_slice = ps_dec->ps_cur_slice;
WORD32 ret = OK;
+ if(ps_svc_lyr_dec->u1_res_init_done == 1)
+ return ret;
if(TARGET_LAYER != ps_svc_lyr_dec->u1_layer_identifier)
{
@@ -3209,6 +3206,8 @@ WORD32 isvcd_parse_interlayer_resamp_func_init(svc_dec_lyr_struct_t *ps_svc_lyr_
if(ret != OK) return NOT_OK;
ret = isvcd_residual_samp_res_init(ps_svc_lyr_dec);
if(ret != OK) return NOT_OK;
+
+ ps_svc_lyr_dec->u1_res_init_done = 1;
}
return ret;
@@ -3461,8 +3460,6 @@ WORD32 isvcd_parse_pslice(svc_dec_lyr_struct_t *ps_svc_lyr_dec, UWORD16 u2_first
ps_cur_slice->i1_slice_beta_offset = 0;
}
- isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
-
ps_dec->u1_slice_header_done = 2;
if(ps_pps->u1_entropy_coding_mode)
{
diff --git a/decoder/svc/isvcd_parse_headers.c b/decoder/svc/isvcd_parse_headers.c
index abf4a1b..d137040 100644
--- a/decoder/svc/isvcd_parse_headers.c
+++ b/decoder/svc/isvcd_parse_headers.c
@@ -193,14 +193,6 @@ WORD32 isvcd_parse_subset_sps(svc_dec_lyr_struct_t *ps_svc_lyr_dec, dec_bit_stre
ps_seq = ps_dec->pv_scratch_sps_pps;
memset(ps_seq, 0, sizeof(dec_seq_params_t));
- if(ps_dec->i4_header_decoded & 1)
- {
- if(NULL != ps_dec->ps_cur_sps)
- *ps_seq = *ps_dec->ps_cur_sps;
- else
- return ERROR_INV_SPS_PPS_T;
- }
-
ps_seq->u1_profile_idc = u1_profile_idc;
ps_seq->u1_level_idc = u1_level_idc;
ps_seq->u1_seq_parameter_set_id = u1_seq_parameter_set_id;
@@ -414,6 +406,15 @@ WORD32 isvcd_parse_subset_sps(svc_dec_lyr_struct_t *ps_svc_lyr_dec, dec_bit_stre
u2_pic_wd = (u4_pic_width_in_mbs << 4);
u2_pic_ht = (u4_pic_height_in_map_units << 4);
+ if(ps_svc_lyr_dec->pic_width < u2_pic_wd)
+ {
+ ps_svc_lyr_dec->pic_width = u2_pic_wd;
+ }
+ if(ps_svc_lyr_dec->pic_height < u2_pic_ht)
+ {
+ ps_svc_lyr_dec->pic_height = u2_pic_ht;
+ }
+
/*--------------------------------------------------------------------*/
/* Get the value of MaxMbAddress and Number of bits needed for it */
/*--------------------------------------------------------------------*/
@@ -850,35 +851,6 @@ WORD32 isvcd_parse_subset_sps(svc_dec_lyr_struct_t *ps_svc_lyr_dec, dec_bit_stre
ps_subset_seq->u2_crop_offset_y = u2_crop_offset_y;
ps_subset_seq->u2_crop_offset_uv = u2_crop_offset_uv;
- if(((ps_dec->u2_pic_wd * ps_dec->u2_pic_ht) <
- (ps_subset_seq->u2_pic_wd * ps_subset_seq->u2_pic_ht)) ||
- (ps_dec->i4_reorder_depth < ps_subset_seq->i4_reorder_depth))
- {
- ps_dec->i4_reorder_depth = ps_subset_seq->i4_reorder_depth;
-
- ps_dec->u2_disp_height = ps_subset_seq->u2_disp_height;
- ps_dec->u2_disp_width = ps_subset_seq->u2_disp_width;
-
- ps_dec->u2_pic_wd = ps_subset_seq->u2_pic_wd;
- ps_dec->u2_pic_ht = ps_subset_seq->u2_pic_ht;
- ps_dec->u4_total_mbs = ps_seq->u2_total_num_of_mbs << (1 - ps_seq->u1_frame_mbs_only_flag);
-
- /* Determining the Width and Height of Frame from that of Picture */
- ps_dec->u2_frm_wd_y = ps_subset_seq->u2_frm_wd_y;
- ps_dec->u2_frm_ht_y = ps_subset_seq->u2_frm_ht_y;
- ps_dec->u2_frm_wd_uv = ps_subset_seq->u2_frm_wd_uv;
- ps_dec->u2_frm_ht_uv = ps_subset_seq->u2_frm_ht_uv;
-
- ps_dec->s_pad_mgr.u1_pad_len_y_v = ps_subset_seq->u1_pad_len_y_v;
- ps_dec->s_pad_mgr.u1_pad_len_cr_v = ps_subset_seq->u1_pad_len_cr_v;
-
- ps_dec->u2_frm_wd_in_mbs = ps_seq->u2_frm_wd_in_mbs;
- ps_dec->u2_frm_ht_in_mbs = ps_seq->u2_frm_ht_in_mbs;
-
- ps_dec->u2_crop_offset_y = ps_subset_seq->u2_crop_offset_y;
- ps_dec->u2_crop_offset_uv = ps_subset_seq->u2_crop_offset_uv;
- }
-
ps_seq->u1_is_valid = TRUE;
ps_dec->ps_sps[u1_seq_parameter_set_id] = *ps_seq;
if(NULL != ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].s_sps_svc_ext.ps_svc_vui_ext)
@@ -887,7 +859,6 @@ WORD32 isvcd_parse_subset_sps(svc_dec_lyr_struct_t *ps_svc_lyr_dec, dec_bit_stre
ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].s_sps_svc_ext.ps_svc_vui_ext;
}
ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id] = *ps_subset_seq;
- ps_dec->ps_cur_sps = &ps_dec->ps_sps[u1_seq_parameter_set_id];
ps_svc_lyr_dec->ps_cur_subset_sps = &ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id];
return OK;
@@ -1186,14 +1157,6 @@ WORD32 isvcd_parse_sps(svc_dec_lyr_struct_t *ps_svc_lyr_dec, dec_bit_stream_t *p
ps_seq = ps_dec->pv_scratch_sps_pps;
memset(ps_seq, 0, sizeof(dec_seq_params_t));
- if(ps_dec->i4_header_decoded & 1)
- {
- if(ps_dec->ps_cur_sps != NULL)
- *ps_seq = *ps_dec->ps_cur_sps;
- else
- return ERROR_INV_SPS_PPS_T;
- }
-
if((ps_dec->i4_header_decoded & 1) &&
(1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
(ps_dec->ps_sps[u1_seq_parameter_set_id].u1_profile_idc != u1_profile_idc))
@@ -1404,6 +1367,15 @@ WORD32 isvcd_parse_sps(svc_dec_lyr_struct_t *ps_svc_lyr_dec, dec_bit_stream_t *p
ps_seq->u2_frm_ht_in_mbs = u4_pic_height_in_map_units;
u2_pic_wd = (u4_pic_width_in_mbs << 4);
u2_pic_ht = (u4_pic_height_in_map_units << 4);
+ if(ps_svc_lyr_dec->pic_width < u2_pic_wd)
+ {
+ ps_svc_lyr_dec->pic_width = u2_pic_wd;
+ }
+ if(ps_svc_lyr_dec->pic_height < u2_pic_ht)
+ {
+ ps_svc_lyr_dec->pic_height = u2_pic_ht;
+ }
+
/*--------------------------------------------------------------------*/
/* Get the value of MaxMbAddress and Number of bits needed for it */
/*--------------------------------------------------------------------*/
@@ -1639,37 +1611,9 @@ WORD32 isvcd_parse_sps(svc_dec_lyr_struct_t *ps_svc_lyr_dec, dec_bit_stream_t *p
ps_subset_seq->u2_crop_offset_y = u2_crop_offset_y;
ps_subset_seq->u2_crop_offset_uv = u2_crop_offset_uv;
- if(((ps_dec->u2_pic_wd * ps_dec->u2_pic_ht) <
- (ps_subset_seq->u2_pic_wd * ps_subset_seq->u2_pic_ht)) ||
- (ps_dec->i4_reorder_depth < ps_subset_seq->i4_reorder_depth))
- {
- ps_dec->i4_reorder_depth = ps_subset_seq->i4_reorder_depth;
-
- ps_dec->u2_disp_height = ps_subset_seq->u2_disp_height;
- ps_dec->u2_disp_width = ps_subset_seq->u2_disp_width;
- ps_dec->u2_pic_wd = ps_subset_seq->u2_pic_wd;
- ps_dec->u2_pic_ht = ps_subset_seq->u2_pic_ht;
- ps_dec->u4_total_mbs = ps_seq->u2_total_num_of_mbs << (1 - ps_seq->u1_frame_mbs_only_flag);
-
- /* Determining the Width and Height of Frame from that of Picture */
- ps_dec->u2_frm_wd_y = ps_subset_seq->u2_frm_wd_y;
- ps_dec->u2_frm_ht_y = ps_subset_seq->u2_frm_ht_y;
- ps_dec->u2_frm_wd_uv = ps_subset_seq->u2_frm_wd_uv;
- ps_dec->u2_frm_ht_uv = ps_subset_seq->u2_frm_ht_uv;
-
- ps_dec->s_pad_mgr.u1_pad_len_y_v = ps_subset_seq->u1_pad_len_y_v;
- ps_dec->s_pad_mgr.u1_pad_len_cr_v = ps_subset_seq->u1_pad_len_cr_v;
-
- ps_dec->u2_frm_wd_in_mbs = ps_seq->u2_frm_wd_in_mbs;
- ps_dec->u2_frm_ht_in_mbs = ps_seq->u2_frm_ht_in_mbs;
- ps_dec->u2_crop_offset_y = ps_subset_seq->u2_crop_offset_y;
- ps_dec->u2_crop_offset_uv = ps_subset_seq->u2_crop_offset_uv;
- }
-
ps_seq->u1_is_valid = TRUE;
ps_dec->ps_sps[u1_seq_parameter_set_id] = *ps_seq;
ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id] = *ps_subset_seq;
- ps_dec->ps_cur_sps = &ps_dec->ps_sps[u1_seq_parameter_set_id];
ps_svc_lyr_dec->ps_cur_subset_sps = &ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id];
return OK;
diff --git a/decoder/svc/isvcd_parse_slice.c b/decoder/svc/isvcd_parse_slice.c
index f8270b6..226a6e4 100644
--- a/decoder/svc/isvcd_parse_slice.c
+++ b/decoder/svc/isvcd_parse_slice.c
@@ -703,6 +703,14 @@ WORD32 isvcd_parse_decode_slice_ext_nal(UWORD8 u1_is_idr_slice, UWORD8 u1_nal_re
return ERROR_CORRUPTED_SLICE;
}
+ if(ps_dec->u4_first_slice_in_pic == 1)
+ {
+ if(u2_first_mb_in_slice != 0)
+ {
+ return ERROR_CORRUPTED_SLICE;
+ }
+ }
+
COPYTHECONTEXT("Slice Header SVC ext: first_mb_in_slice", u2_first_mb_in_slice);
u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
@@ -1202,8 +1210,13 @@ WORD32 isvcd_parse_decode_slice_ext_nal(UWORD8 u1_is_idr_slice, UWORD8 u1_nal_re
else
ps_dec->u4_output_present = 1;
}
+ ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
+ if(ret != OK)
+ {
+ return ERROR_CORRUPTED_SLICE;
+ }
if((ps_dec->u1_separate_parse == 1) &&
- (ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER))
+ (ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER) && (ps_svc_lyr_dec->u1_res_init_done == 1))
{
if(ps_dec->u4_dec_thread_created == 0)
{
@@ -1635,11 +1648,14 @@ WORD32 isvcd_parse_slice_header(svc_dec_lyr_struct_t *ps_svc_lyr_dec)
{
return ERROR_INV_SLICE_HDR_T;
}
+ /* Reference layer id update is taken care during resolution init */
+ /*
ps_svc_lyr_dec->u1_ref_layer_id = ps_svc_slice_params->u4_ref_layer_dq_id >> 4;
if(ps_svc_lyr_dec->u1_ref_layer_id >= ps_svc_lyr_dec->u1_layer_id)
{
return ERROR_INV_SLICE_HDR_T;
}
+ */
ps_svc_lyr_dec->ps_dec_svc_ref_layer =
&ps_svcd_ctxt->ps_svc_dec_lyr[ps_svc_lyr_dec->u1_ref_layer_id];
@@ -1684,6 +1700,11 @@ WORD32 isvcd_parse_slice_header(svc_dec_lyr_struct_t *ps_svc_lyr_dec)
ps_svc_slice_params->u1_constrained_intra_resampling_flag = ih264d_get_bit_h264(ps_bitstrm);
COPYTHECONTEXT("Slice Header SVC ext: u1_constrained_intra_resampling_flag",
ps_svc_slice_params->u1_constrained_intra_resampling_flag);
+
+ ps_svc_lyr_dec->s_res_prms.i1_constrained_intra_rsmpl_flag =
+ ps_svc_lyr_dec->s_svc_slice_params.u1_constrained_intra_resampling_flag;
+ isvcd_intra_resamp_res_init_update_flags(ps_svc_lyr_dec);
+
if(2 == ps_sps_svc_ext->u1_extended_spatial_scalability_idc)
{
/* ChromaArrayType = i4_chroma_format_idc if separate_colour_plane_flag
@@ -1926,6 +1947,14 @@ WORD32 isvcd_parse_decode_slice(UWORD8 u1_is_idr_slice, UWORD8 u1_nal_ref_idc,
return ERROR_CORRUPTED_SLICE;
}
+ if(ps_dec->u4_first_slice_in_pic == 1)
+ {
+ if(u2_first_mb_in_slice != 0)
+ {
+ return ERROR_CORRUPTED_SLICE;
+ }
+ }
+
COPYTHECONTEXT("SH: first_mb_in_slice", u2_first_mb_in_slice);
u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
@@ -2421,7 +2450,12 @@ WORD32 isvcd_parse_decode_slice(UWORD8 u1_is_idr_slice, UWORD8 u1_nal_ref_idc,
else
ps_dec->u4_output_present = 1;
}
- if(ps_dec->u1_separate_parse == 1)
+ ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
+ if(ret != OK)
+ {
+ return ERROR_CORRUPTED_SLICE;
+ }
+ if((ps_dec->u1_separate_parse == 1) && (ps_svc_lyr_dec->u1_res_init_done == 1))
{
if(ps_dec->u4_dec_thread_created == 0)
{
diff --git a/decoder/svc/isvcd_process_epslice.c b/decoder/svc/isvcd_process_epslice.c
index cbcce8c..b351319 100644
--- a/decoder/svc/isvcd_process_epslice.c
+++ b/decoder/svc/isvcd_process_epslice.c
@@ -158,11 +158,13 @@ WORD32 isvcd_interlyr_motion_mode_pred(svc_dec_lyr_struct_t *ps_svc_lyr_dec,
/* get the current layer ctxt */
ps_lyr_mem = &ps_ctxt->as_res_lyr_mem[ps_ctxt->i4_res_id];
- ps_ctxt->i4_listx = i4_listx;
+ {
+ ps_ctxt->i4_listx = i4_listx;
- i4_mb_mode =
- ps_lyr_mem->pf_inter_lyr_pred(ps_svc_lyr_dec->pv_mode_mv_sample_ctxt, ps_cur_mb_info,
+ i4_mb_mode =
+ ps_lyr_mem->pf_inter_lyr_pred(ps_svc_lyr_dec->pv_mode_mv_sample_ctxt, ps_cur_mb_info,
ps_svc_cur_mb_info, ps_dec, ps_mb_part_info, ps_part);
+ }
}
return i4_mb_mode;
}
@@ -485,6 +487,7 @@ WORD32 isvcd_mv_pred_ref_tfr_nby2_epmb(dec_struct_t *ps_dec, UWORD8 u1_mb_idx, U
}
}
}
+
return OK;
}
/*!
diff --git a/decoder/svc/isvcd_structs.h b/decoder/svc/isvcd_structs.h
index 1959202..85f1295 100644
--- a/decoder/svc/isvcd_structs.h
+++ b/decoder/svc/isvcd_structs.h
@@ -660,6 +660,9 @@ typedef struct _SvcDecLyrStruct
WORD32 i4_frm_svc_base_mode_cabac_size;
UWORD32 u4_pps_id_for_layer;
UWORD8 u1_error_in_cur_frame;
+ UWORD8 u1_res_init_done;
+ WORD32 pic_width;
+ WORD32 pic_height;
} svc_dec_lyr_struct_t;
typedef struct
@@ -719,6 +722,8 @@ typedef struct
UWORD8 u1_parse_nal_unit_error;
UWORD8 u1_exit_till_next_IDR;
UWORD8 u1_pre_parse_in_flush;
+ WORD32 pic_width;
+ WORD32 pic_height;
} svc_dec_ctxt_t;
#endif /*_ISVCD_STRUCTS_H_*/ \ No newline at end of file
diff --git a/encoder/arm/svc/isvce_function_selector_a9q.c b/encoder/arm/svc/isvce_function_selector_a9q.c
index b5f8ba4..6a1abb1 100644
--- a/encoder/arm/svc/isvce_function_selector_a9q.c
+++ b/encoder/arm/svc/isvce_function_selector_a9q.c
@@ -161,35 +161,23 @@ void isvce_init_function_ptr_neon_a9q(isvce_codec_t *ps_codec)
isvc_resi_trans_quant_chroma_4x4_with_residual_sub_neon;
/* Init inverse transform fn ptr */
- ps_enc_loop_fxns->apf_iquant_itrans_recon_8x8[0] = isvc_iquant_itrans_recon_8x8;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_8x8[1] = isvc_iquant_itrans_recon_8x8;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_8x8[2] = isvc_iquant_itrans_recon_8x8;
-
ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4[0] =
isvc_iquant_itrans_recon_4x4_with_res_output_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4[1] =
isvc_iquant_itrans_recon_4x4_with_res_accumulate_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4[2] = isvc_iquant_itrans_recon_4x4_neon;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[0] =
- isvc_iquant_itrans_recon_4x4_dc_with_res_output_neon;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[1] =
- isvc_iquant_itrans_recon_4x4_dc_with_res_accumulate_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[2] = isvc_iquant_itrans_recon_4x4_dc_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[0] =
isvc_iquant_itrans_recon_chroma_4x4_with_res_output_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[1] =
isvc_iquant_itrans_recon_chroma_4x4_with_res_accumulate_neon;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[2] =
- isvc_iquant_itrans_recon_chroma_4x4_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[0] =
isvc_iquant_itrans_recon_chroma_4x4_dc_with_res_output_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[1] =
isvc_iquant_itrans_recon_chroma_4x4_dc_with_res_accumulate_neon;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[2] =
- isvc_iquant_itrans_recon_chroma_4x4_dc_neon;
ps_enc_loop_fxns->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_a9;
ps_enc_loop_fxns->pf_ihadamard_scaling_2x2_uv = ih264_ihadamard_scaling_2x2_uv_a9;
@@ -243,9 +231,7 @@ void isvce_init_function_ptr_neon_a9q(isvce_codec_t *ps_codec)
ps_codec->pf_compute_sad_16x8 = ime_compute_sad_16x8_a9q;
/* memor handling operations */
- ps_mem_fxns->pf_mem_cpy = ih264_memcpy_a9q;
ps_mem_fxns->pf_mem_cpy_mul8 = ih264_memcpy_mul_8_a9q;
- ps_mem_fxns->pf_mem_set = ih264_memset_a9q;
ps_mem_fxns->pf_mem_set_mul8 = ih264_memset_mul_8_a9q;
/* sad me level functions */
diff --git a/encoder/arm/svc/isvce_function_selector_av8.c b/encoder/arm/svc/isvce_function_selector_av8.c
index 16c08bb..c517c03 100644
--- a/encoder/arm/svc/isvce_function_selector_av8.c
+++ b/encoder/arm/svc/isvce_function_selector_av8.c
@@ -161,35 +161,23 @@ void isvce_init_function_ptr_neon_av8(isvce_codec_t *ps_codec)
isvc_resi_trans_quant_chroma_4x4_with_residual_sub_neon;
/* Init inverse transform fn ptr */
- ps_enc_loop_fxns->apf_iquant_itrans_recon_8x8[0] = isvc_iquant_itrans_recon_8x8;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_8x8[1] = isvc_iquant_itrans_recon_8x8;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_8x8[2] = isvc_iquant_itrans_recon_8x8;
-
ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4[0] =
isvc_iquant_itrans_recon_4x4_with_res_output_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4[1] =
isvc_iquant_itrans_recon_4x4_with_res_accumulate_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4[2] = isvc_iquant_itrans_recon_4x4_neon;
-
- ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[0] =
- isvc_iquant_itrans_recon_4x4_dc_with_res_output_neon;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[1] =
- isvc_iquant_itrans_recon_4x4_dc_with_res_accumulate_neon;
+ ;
ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[2] = isvc_iquant_itrans_recon_4x4_dc_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[0] =
isvc_iquant_itrans_recon_chroma_4x4_with_res_output_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[1] =
isvc_iquant_itrans_recon_chroma_4x4_with_res_accumulate_neon;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[2] =
- isvc_iquant_itrans_recon_chroma_4x4_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[0] =
isvc_iquant_itrans_recon_chroma_4x4_dc_with_res_output_neon;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[1] =
isvc_iquant_itrans_recon_chroma_4x4_dc_with_res_accumulate_neon;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[2] =
- isvc_iquant_itrans_recon_chroma_4x4_dc_neon;
ps_enc_loop_fxns->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_av8;
ps_enc_loop_fxns->pf_ihadamard_scaling_2x2_uv = ih264_ihadamard_scaling_2x2_uv_av8;
@@ -243,9 +231,7 @@ void isvce_init_function_ptr_neon_av8(isvce_codec_t *ps_codec)
ps_codec->pf_compute_sad_16x8 = ime_compute_sad_16x8_av8;
/* memor handling operations */
- ps_mem_fxns->pf_mem_cpy = ih264_memcpy_av8;
ps_mem_fxns->pf_mem_cpy_mul8 = ih264_memcpy_mul_8_av8;
- ps_mem_fxns->pf_mem_set = ih264_memset_av8;
ps_mem_fxns->pf_mem_set_mul8 = ih264_memset_mul_8_av8;
/* sad me level functions */
diff --git a/encoder/ih264e_api.c b/encoder/ih264e_api.c
index f76fbd1..c952225 100644
--- a/encoder/ih264e_api.c
+++ b/encoder/ih264e_api.c
@@ -139,101 +139,6 @@
*******************************************************************************
*
* @brief
-* Used to test validity of input dimensions
-*
-* @par Description:
-* Dimensions of the input buffer passed to encode call are validated
-*
-* @param[in] ps_codec
-* Codec context
-*
-* @param[in] ps_ip
-* Pointer to input structure
-*
-* @param[out] ps_op
-* Pointer to output structure
-*
-* @returns error status
-*
-* @remarks none
-*
-*******************************************************************************
-*/
-static IV_STATUS_T api_check_input_dimensions(codec_t *ps_codec,
- ih264e_video_encode_ip_t *ps_ip,
- ih264e_video_encode_op_t *ps_op)
-{
- UWORD32 u4_wd, u4_ht;
- cfg_params_t *ps_curr_cfg = &ps_codec->s_cfg;
- iv_raw_buf_t *ps_inp_buf = &ps_ip->s_ive_ip.s_inp_buf;
-
- u4_wd = ps_inp_buf->au4_wd[0];
- u4_ht = ps_inp_buf->au4_ht[0];
- switch (ps_inp_buf->e_color_fmt)
- {
- case IV_YUV_420P:
- if (((ps_inp_buf->au4_wd[0] / 2) != ps_inp_buf->au4_wd[1]) ||
- ((ps_inp_buf->au4_wd[0] / 2) != ps_inp_buf->au4_wd[2]) ||
- (ps_inp_buf->au4_wd[1] != ps_inp_buf->au4_wd[2]))
- {
- ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
- ps_op->s_ive_op.u4_error_code |= IH264E_WIDTH_NOT_SUPPORTED;
- return (IV_FAIL);
- }
- if (((ps_inp_buf->au4_ht[0] / 2) != ps_inp_buf->au4_ht[1]) ||
- ((ps_inp_buf->au4_ht[0] / 2) != ps_inp_buf->au4_ht[2]) ||
- (ps_inp_buf->au4_ht[1] != ps_inp_buf->au4_ht[2]))
- {
- ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
- ps_op->s_ive_op.u4_error_code |= IH264E_HEIGHT_NOT_SUPPORTED;
- return (IV_FAIL);
- }
- break;
- case IV_YUV_420SP_UV:
- case IV_YUV_420SP_VU:
- if (ps_inp_buf->au4_wd[0] != ps_inp_buf->au4_wd[1])
- {
- ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
- ps_op->s_ive_op.u4_error_code |= IH264E_WIDTH_NOT_SUPPORTED;
- return (IV_FAIL);
- }
- if ((ps_inp_buf->au4_ht[0] / 2) != ps_inp_buf->au4_ht[1])
- {
- ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
- ps_op->s_ive_op.u4_error_code |= IH264E_HEIGHT_NOT_SUPPORTED;
- return (IV_FAIL);
- }
- break;
- case IV_YUV_422ILE:
- u4_wd = ps_inp_buf->au4_wd[0] / 2;
- break;
- default:
- ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
- ps_op->s_ive_op.u4_error_code |= IH264E_INPUT_CHROMA_FORMAT_NOT_SUPPORTED;
- return (IV_FAIL);
- }
-
- if (u4_wd != ps_curr_cfg->u4_disp_wd)
- {
- ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
- ps_op->s_ive_op.u4_error_code |= IH264E_WIDTH_NOT_SUPPORTED;
- return (IV_FAIL);
- }
-
- if (u4_ht != ps_curr_cfg->u4_disp_ht)
- {
- ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
- ps_op->s_ive_op.u4_error_code |= IH264E_HEIGHT_NOT_SUPPORTED;
- return (IV_FAIL);
- }
-
- return IV_SUCCESS;
-}
-
-/**
-*******************************************************************************
-*
-* @brief
* Used to test arguments for corresponding API call
*
* @par Description:
@@ -910,7 +815,6 @@ static IV_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
case IVE_CMD_VIDEO_ENCODE:
{
- codec_t *ps_codec = (codec_t *) (ps_handle->pv_codec_handle);
ih264e_video_encode_ip_t *ps_ip = pv_api_ip;
ih264e_video_encode_op_t *ps_op = pv_api_op;
@@ -930,14 +834,6 @@ static IV_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
return (IV_FAIL);
}
- if (NULL != ps_ip->s_ive_ip.s_inp_buf.apv_bufs[0] &&
- ps_codec->i4_header_mode != 1 &&
- IV_SUCCESS != api_check_input_dimensions(ps_codec, ps_ip, ps_op))
- {
- ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
- ps_op->s_ive_op.u4_error_code |= IVE_ERR_OP_ENCODE_API_STRUCT_SIZE_INCORRECT;
- return (IV_FAIL);
- }
break;
}
diff --git a/encoder/ih264e_encode.c b/encoder/ih264e_encode.c
index f5d14d2..1613e77 100644
--- a/encoder/ih264e_encode.c
+++ b/encoder/ih264e_encode.c
@@ -184,6 +184,101 @@ IH264E_ERROR_T ih264e_wait_for_thread(UWORD32 sleep_us)
}
/**
+*******************************************************************************
+*
+* @brief
+* Used to test validity of input dimensions
+*
+* @par Description:
+* Dimensions of the input buffer passed to encode call are validated
+*
+* @param[in] ps_codec
+* Codec context
+*
+* @param[in] ps_ip
+* Pointer to input structure
+*
+* @param[out] ps_op
+* Pointer to output structure
+*
+* @returns error status
+*
+* @remarks none
+*
+*******************************************************************************
+*/
+static IV_STATUS_T api_check_input_dimensions(codec_t *ps_codec,
+ ih264e_video_encode_ip_t *ps_ip,
+ ih264e_video_encode_op_t *ps_op)
+{
+ UWORD32 u4_wd, u4_ht;
+ cfg_params_t *ps_curr_cfg = &ps_codec->s_cfg;
+ iv_raw_buf_t *ps_inp_buf = &ps_ip->s_ive_ip.s_inp_buf;
+
+ u4_wd = ps_inp_buf->au4_wd[0];
+ u4_ht = ps_inp_buf->au4_ht[0];
+ switch (ps_inp_buf->e_color_fmt)
+ {
+ case IV_YUV_420P:
+ if (((ps_inp_buf->au4_wd[0] / 2) != ps_inp_buf->au4_wd[1]) ||
+ ((ps_inp_buf->au4_wd[0] / 2) != ps_inp_buf->au4_wd[2]) ||
+ (ps_inp_buf->au4_wd[1] != ps_inp_buf->au4_wd[2]))
+ {
+ ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
+ ps_op->s_ive_op.u4_error_code |= IH264E_WIDTH_NOT_SUPPORTED;
+ return (IV_FAIL);
+ }
+ if (((ps_inp_buf->au4_ht[0] / 2) != ps_inp_buf->au4_ht[1]) ||
+ ((ps_inp_buf->au4_ht[0] / 2) != ps_inp_buf->au4_ht[2]) ||
+ (ps_inp_buf->au4_ht[1] != ps_inp_buf->au4_ht[2]))
+ {
+ ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
+ ps_op->s_ive_op.u4_error_code |= IH264E_HEIGHT_NOT_SUPPORTED;
+ return (IV_FAIL);
+ }
+ break;
+ case IV_YUV_420SP_UV:
+ case IV_YUV_420SP_VU:
+ if (ps_inp_buf->au4_wd[0] != ps_inp_buf->au4_wd[1])
+ {
+ ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
+ ps_op->s_ive_op.u4_error_code |= IH264E_WIDTH_NOT_SUPPORTED;
+ return (IV_FAIL);
+ }
+ if ((ps_inp_buf->au4_ht[0] / 2) != ps_inp_buf->au4_ht[1])
+ {
+ ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
+ ps_op->s_ive_op.u4_error_code |= IH264E_HEIGHT_NOT_SUPPORTED;
+ return (IV_FAIL);
+ }
+ break;
+ case IV_YUV_422ILE:
+ u4_wd = ps_inp_buf->au4_wd[0] / 2;
+ break;
+ default:
+ ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
+ ps_op->s_ive_op.u4_error_code |= IH264E_INPUT_CHROMA_FORMAT_NOT_SUPPORTED;
+ return (IV_FAIL);
+ }
+
+ if (u4_wd != ps_curr_cfg->u4_disp_wd)
+ {
+ ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
+ ps_op->s_ive_op.u4_error_code |= IH264E_WIDTH_NOT_SUPPORTED;
+ return (IV_FAIL);
+ }
+
+ if (u4_ht != ps_curr_cfg->u4_disp_ht)
+ {
+ ps_op->s_ive_op.u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
+ ps_op->s_ive_op.u4_error_code |= IH264E_HEIGHT_NOT_SUPPORTED;
+ return (IV_FAIL);
+ }
+
+ return IV_SUCCESS;
+}
+
+/**
******************************************************************************
*
* @brief
@@ -427,24 +522,33 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
}
}
#endif
- /******************************************************************
- * INSERT LOGO
- *****************************************************************/
-#ifdef LOGO_EN
- if (s_inp_buf.s_raw_buf.apv_bufs[0] != NULL &&
+
+ if (ps_video_encode_ip->s_ive_ip.s_inp_buf.apv_bufs[0] != NULL &&
ps_codec->i4_header_mode != 1)
{
- ih264e_insert_logo(s_inp_buf.s_raw_buf.apv_bufs[0],
- s_inp_buf.s_raw_buf.apv_bufs[1],
- s_inp_buf.s_raw_buf.apv_bufs[2],
- s_inp_buf.s_raw_buf.au4_strd[0],
+ if (IV_SUCCESS != api_check_input_dimensions(ps_codec, pv_api_ip, pv_api_op))
+ {
+ error_status = IH264E_FAIL;
+ SET_ERROR_ON_RETURN(error_status,
+ IVE_FATALERROR,
+ ps_video_encode_op->s_ive_op.u4_error_code,
+ IV_FAIL);
+ }
+ /******************************************************************
+ * INSERT LOGO
+ *****************************************************************/
+#ifdef LOGO_EN
+ ih264e_insert_logo(ps_video_encode_ip->s_ive_ip.s_inp_buf.apv_bufs[0],
+ ps_video_encode_ip->s_ive_ip.s_inp_buf.apv_bufs[1],
+ ps_video_encode_ip->s_ive_ip.s_inp_buf.apv_bufs[2],
+ ps_video_encode_ip->s_ive_ip.s_inp_buf.au4_strd[0],
0,
0,
ps_codec->s_cfg.e_inp_color_fmt,
ps_codec->s_cfg.u4_disp_wd,
ps_codec->s_cfg.u4_disp_ht);
- }
#endif /*LOGO_EN*/
+ }
/* In case of alt ref and B pics we will have non reference frame in stream */
if (ps_codec->s_cfg.u4_enable_alt_ref || ps_codec->s_cfg.u4_num_bframes)
diff --git a/encoder/svc/isvce_api.c b/encoder/svc/isvce_api.c
index 2004dba..d44d7e7 100644
--- a/encoder/svc/isvce_api.c
+++ b/encoder/svc/isvce_api.c
@@ -3342,10 +3342,14 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
WORD32 max_wd_luma, max_ht_luma;
WORD32 max_mb_rows, max_mb_cols, max_mb_cnt;
- /* temp var */
WORD32 i, j;
WORD32 status = IV_SUCCESS;
+ if(MAX_CTXT_SETS != 1)
+ {
+ return IV_FAIL;
+ }
+
/* mem records */
ps_mem_rec_base = ps_ip->s_ive_ip.ps_mem_rec;
@@ -3493,117 +3497,59 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
ps_mem_rec = &ps_mem_rec_base[ISVCE_MEM_REC_ENTROPY];
{
/* temp var */
- WORD32 size = 0, offset;
+ WORD32 size = 0;
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- /* base ptr */
- UWORD8 *pu1_buf = ps_mem_rec->pv_base;
-
- /* reset size */
- size = 0;
-
- /* skip mb run */
- ps_codec->as_process[i].s_entropy.pi4_mb_skip_run = (WORD32 *) (pu1_buf + size);
- size += sizeof(WORD32);
- size = ALIGN8(size);
-
- /* entropy map */
- ps_codec->as_process[i].s_entropy.pu1_entropy_map =
- (UWORD8 *) (pu1_buf + size + max_mb_cols);
- /* size in bytes to store entropy status of an entire frame */
- size += (max_mb_cols * max_mb_rows);
- /* add an additional 1 row of bytes to evade the special case of row 0
- */
- size += max_mb_cols;
- size = ALIGN128(size);
-
- /* bit stream ptr */
- ps_codec->as_process[i].s_entropy.ps_bitstrm = (bitstrm_t *) (pu1_buf + size);
- size += sizeof(ps_codec->as_process[i].s_entropy.ps_bitstrm[0]);
- size = ALIGN128(size);
-
-#if ENABLE_RE_ENC_AS_SKIP
- ps_codec->as_process[i].s_entropy.ps_bitstrm_after_slice_hdr =
- (bitstrm_t *) (pu1_buf + size);
- size += sizeof(ps_codec->as_process[i].s_entropy.ps_bitstrm_after_slice_hdr[0]);
- size = ALIGN128(size);
-#endif
-
- /* nnz luma */
- ps_codec->as_process[i].s_entropy.pu1_top_nnz_luma = (UWORD8(*)[4])(pu1_buf + size);
- size += (max_mb_cols * 4 * sizeof(UWORD8));
- size = ALIGN128(size);
-
- /* nnz chroma */
- ps_codec->as_process[i].s_entropy.pu1_top_nnz_cbcr = (UWORD8(*)[4])(pu1_buf + size);
- size += (max_mb_cols * 4 * sizeof(UWORD8));
- size = ALIGN128(size);
-
- /* ps_mb_qp_ctxt */
- ps_codec->as_process[i].s_entropy.ps_mb_qp_ctxt = (mb_qp_ctxt_t *) (pu1_buf + size);
- size += ALIGN128(sizeof(ps_codec->as_process[i].s_entropy.ps_mb_qp_ctxt[0]));
-
- offset = size;
-
- /* cabac Context */
- ps_codec->as_process[i].s_entropy.ps_cabac = ps_cabac;
- }
- else
- {
- /* base ptr */
- UWORD8 *pu1_buf = ps_mem_rec->pv_base;
-
- /* reset size */
- size = offset;
-
- /* skip mb run */
- ps_codec->as_process[i].s_entropy.pi4_mb_skip_run = (WORD32 *) (pu1_buf + size);
- size += sizeof(WORD32);
- size = ALIGN8(size);
-
- /* entropy map */
- ps_codec->as_process[i].s_entropy.pu1_entropy_map =
- (UWORD8 *) (pu1_buf + size + max_mb_cols);
- /* size in bytes to store entropy status of an entire frame */
- size += (max_mb_cols * max_mb_rows);
- /* add an additional 1 row of bytes to evade the special case of row 0
- */
- size += max_mb_cols;
- size = ALIGN128(size);
-
- /* bit stream ptr */
- ps_codec->as_process[i].s_entropy.ps_bitstrm = (bitstrm_t *) (pu1_buf + size);
- size += sizeof(ps_codec->as_process[i].s_entropy.ps_bitstrm[0]);
- size = ALIGN128(size);
+ /* base ptr */
+ UWORD8 *pu1_buf = ps_mem_rec->pv_base;
+
+ /* reset size */
+ size = 0;
+
+ /* skip mb run */
+ ps_codec->as_process[i].s_entropy.pi4_mb_skip_run = (WORD32 *) (pu1_buf + size);
+ size += sizeof(WORD32);
+ size = ALIGN8(size);
+
+ /* entropy map */
+ ps_codec->as_process[i].s_entropy.pu1_entropy_map =
+ (UWORD8 *) (pu1_buf + size + max_mb_cols);
+ /* size in bytes to store entropy status of an entire frame */
+ size += (max_mb_cols * max_mb_rows);
+ /* add an additional 1 row of bytes to evade the special case of row 0
+ */
+ size += max_mb_cols;
+ size = ALIGN128(size);
+
+ /* bit stream ptr */
+ ps_codec->as_process[i].s_entropy.ps_bitstrm = (bitstrm_t *) (pu1_buf + size);
+ size += sizeof(ps_codec->as_process[i].s_entropy.ps_bitstrm[0]);
+ size = ALIGN128(size);
#if ENABLE_RE_ENC_AS_SKIP
- ps_codec->as_process[i].s_entropy.ps_bitstrm_after_slice_hdr =
- (bitstrm_t *) (pu1_buf + size);
- size += sizeof(ps_codec->as_process[i].s_entropy.ps_bitstrm_after_slice_hdr[0]);
- size = ALIGN128(size);
+ ps_codec->as_process[i].s_entropy.ps_bitstrm_after_slice_hdr =
+ (bitstrm_t *) (pu1_buf + size);
+ size += sizeof(ps_codec->as_process[i].s_entropy.ps_bitstrm_after_slice_hdr[0]);
+ size = ALIGN128(size);
#endif
- /* nnz luma */
- ps_codec->as_process[i].s_entropy.pu1_top_nnz_luma =
- (UWORD8(*)[4])(UWORD8(*)[4])(pu1_buf + size);
- size += (max_mb_cols * 4 * sizeof(UWORD8));
- size = ALIGN128(size);
+ /* nnz luma */
+ ps_codec->as_process[i].s_entropy.pu1_top_nnz_luma = (UWORD8(*)[4])(pu1_buf + size);
+ size += (max_mb_cols * 4 * sizeof(UWORD8));
+ size = ALIGN128(size);
- /* nnz chroma */
- ps_codec->as_process[i].s_entropy.pu1_top_nnz_cbcr = (UWORD8(*)[4])(pu1_buf + size);
- size += (max_mb_cols * 4 * sizeof(UWORD8));
- size = ALIGN128(size);
+ /* nnz chroma */
+ ps_codec->as_process[i].s_entropy.pu1_top_nnz_cbcr = (UWORD8(*)[4])(pu1_buf + size);
+ size += (max_mb_cols * 4 * sizeof(UWORD8));
+ size = ALIGN128(size);
- /* ps_mb_qp_ctxt */
- ps_codec->as_process[i].s_entropy.ps_mb_qp_ctxt = (mb_qp_ctxt_t *) (pu1_buf + size);
- size = ALIGN128(sizeof(ps_codec->as_process[i].s_entropy.ps_mb_qp_ctxt[0]));
+ /* ps_mb_qp_ctxt */
+ ps_codec->as_process[i].s_entropy.ps_mb_qp_ctxt = (mb_qp_ctxt_t *) (pu1_buf + size);
+ size += ALIGN128(sizeof(ps_codec->as_process[i].s_entropy.ps_mb_qp_ctxt[0]));
- /* cabac Context */
- ps_codec->as_process[i].s_entropy.ps_cabac = ps_cabac;
- }
+ /* cabac Context */
+ ps_codec->as_process[i].s_entropy.ps_cabac = ps_cabac;
}
ps_codec->as_process[0].s_entropy.ps_cabac->ps_mb_map_ctxt_inc_base = ps_mb_map_ctxt_inc;
}
@@ -3631,16 +3577,8 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- ps_codec->as_process[i].pv_pic_mb_coeff_data = pu1_buf;
- ps_codec->as_process[i].s_entropy.pv_pic_mb_coeff_data = pu1_buf;
- }
- else
- {
- ps_codec->as_process[i].pv_pic_mb_coeff_data = pu1_buf + size;
- ps_codec->as_process[i].s_entropy.pv_pic_mb_coeff_data = pu1_buf + size;
- }
+ ps_codec->as_process[i].pv_pic_mb_coeff_data = pu1_buf;
+ ps_codec->as_process[i].s_entropy.pv_pic_mb_coeff_data = pu1_buf;
}
}
@@ -3667,16 +3605,8 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- ps_codec->as_process[i].pv_pic_mb_header_data = pu1_buf;
- ps_codec->as_process[i].s_entropy.pv_pic_mb_header_data = pu1_buf;
- }
- else
- {
- ps_codec->as_process[i].pv_pic_mb_header_data = pu1_buf + size;
- ps_codec->as_process[i].s_entropy.pv_pic_mb_header_data = pu1_buf + size;
- }
+ ps_codec->as_process[i].pv_pic_mb_header_data = pu1_buf;
+ ps_codec->as_process[i].s_entropy.pv_pic_mb_header_data = pu1_buf;
}
}
@@ -3729,17 +3659,7 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- ps_codec->as_process[i].ps_svc_nalu_ext_base = ps_mem_rec->pv_base;
- }
- else
- {
- WORD32 size = SVC_MAX_SLICE_HDR_CNT * sizeof(slice_header_t);
- void *pv_buf = (UWORD8 *) ps_mem_rec->pv_base + size;
-
- ps_codec->as_process[i].ps_svc_nalu_ext_base = pv_buf;
- }
+ ps_codec->as_process[i].ps_svc_nalu_ext_base = ps_mem_rec->pv_base;
}
}
@@ -3757,18 +3677,7 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- ps_codec->as_process[i].ps_slice_hdr_base = ps_mem_rec->pv_base;
- }
- else
- {
- /* temp var */
- WORD32 size = SVC_MAX_SLICE_HDR_CNT * sizeof(slice_header_t);
- void *pv_buf = (UWORD8 *) ps_mem_rec->pv_base + size;
-
- ps_codec->as_process[i].ps_slice_hdr_base = pv_buf;
- }
+ ps_codec->as_process[i].ps_slice_hdr_base = ps_mem_rec->pv_base;
}
}
@@ -3789,14 +3698,7 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- ps_codec->as_process[i].pu1_is_intra_coded = pu1_buf;
- }
- else
- {
- ps_codec->as_process[i].pu1_is_intra_coded = pu1_buf + max_mb_cnt;
- }
+ ps_codec->as_process[i].pu1_is_intra_coded = pu1_buf;
}
ps_codec->pu2_intr_rfrsh_map = (UWORD16 *) (pu1_buf + max_mb_cnt * MAX_CTXT_SETS);
@@ -3805,22 +3707,14 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
ps_mem_rec = &ps_mem_rec_base[ISVCE_MEM_REC_SLICE_MAP];
{
/* pointer to storage space */
- UWORD8 *pu1_buf_ping, *pu1_buf_pong;
+ UWORD8 *pu1_buf_ping;
/* init pointer */
pu1_buf_ping = ps_mem_rec->pv_base;
- pu1_buf_pong = pu1_buf_ping + ALIGN64(max_mb_cnt);
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- ps_codec->as_process[i].pu1_slice_idx = pu1_buf_ping;
- }
- else
- {
- ps_codec->as_process[i].pu1_slice_idx = pu1_buf_pong;
- }
+ ps_codec->as_process[i].pu1_slice_idx = pu1_buf_ping;
}
}
@@ -3862,25 +3756,9 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
/* pointer to storage space */
UWORD8 *pu1_buf = ps_mem_rec->pv_base;
- /* total size of the mem record */
- WORD32 total_size = 0;
-
- /* size in bytes to mb core coding status of an entire frame */
- total_size = max_mb_cnt;
-
- /* add an additional 1 row of bytes to evade the special case of row 0 */
- total_size += max_mb_cols;
-
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- ps_codec->as_process[i].pu1_proc_map = pu1_buf + max_mb_cols;
- }
- else
- {
- ps_codec->as_process[i].pu1_proc_map = pu1_buf + total_size + max_mb_cols;
- }
+ ps_codec->as_process[i].pu1_proc_map = pu1_buf + max_mb_cols;
}
}
@@ -3903,14 +3781,7 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- ps_codec->as_process[i].pu1_deblk_map = pu1_buf + max_mb_cols;
- }
- else
- {
- ps_codec->as_process[i].pu1_deblk_map = pu1_buf + total_size + max_mb_cols;
- }
+ ps_codec->as_process[i].pu1_deblk_map = pu1_buf + max_mb_cols;
}
}
@@ -3919,25 +3790,9 @@ static WORD32 isvce_init_mem_rec(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *
/* pointer to storage space */
UWORD8 *pu1_buf = (UWORD8 *) ps_mem_rec->pv_base;
- /* total size of the mem record */
- WORD32 total_size = 0;
-
- /* size in bytes to mb core coding status of an entire frame */
- total_size = max_mb_cnt;
-
- /* add an additional 1 row of bytes to evade the special case of row 0 */
- total_size += max_mb_cols;
-
for(i = 0; i < MAX_PROCESS_CTXT; i++)
{
- if(i < MAX_PROCESS_CTXT / MAX_CTXT_SETS)
- {
- ps_codec->as_process[i].pu1_me_map = pu1_buf + max_mb_cols;
- }
- else
- {
- ps_codec->as_process[i].pu1_me_map = pu1_buf + total_size + max_mb_cols;
- }
+ ps_codec->as_process[i].pu1_me_map = pu1_buf + max_mb_cols;
}
}
diff --git a/encoder/svc/isvce_encode.c b/encoder/svc/isvce_encode.c
index 8c6aa11..7d57ced 100644
--- a/encoder/svc/isvce_encode.c
+++ b/encoder/svc/isvce_encode.c
@@ -111,39 +111,6 @@
/**
******************************************************************************
*
-* @brief This function puts the current thread to sleep for a duration
-* of sleep_us
-*
-* @par Description
-* ithread_yield() method causes the calling thread to yield execution to
-*another thread that is ready to run on the current processor. The operating
-*system selects the thread to yield to. ithread_usleep blocks the current thread
-*for the specified number of milliseconds. In other words, yield just says, end
-*my timeslice prematurely, look around for other threads to run. If there is
-*nothing better than me, continue. Sleep says I don't want to run for x
-* milliseconds. Even if no other thread wants to run, don't make me run.
-*
-* @param[in] sleep_us
-* thread sleep duration
-*
-* @returns error_status
-*
-******************************************************************************
-*/
-IH264E_ERROR_T isvce_wait_for_thread(UWORD32 sleep_us)
-{
- /* yield thread */
- ithread_yield();
-
- /* put thread to sleep */
- ithread_sleep(sleep_us);
-
- return IH264E_SUCCESS;
-}
-
-/**
-******************************************************************************
-*
* @brief
* Encodes in synchronous api mode
*
diff --git a/encoder/svc/isvce_function_selector_generic.c b/encoder/svc/isvce_function_selector_generic.c
index 044bbeb..c3a48bf 100644
--- a/encoder/svc/isvce_function_selector_generic.c
+++ b/encoder/svc/isvce_function_selector_generic.c
@@ -265,14 +265,10 @@ void isvce_init_function_ptr_generic(isvce_codec_t *ps_codec)
ps_codec->pf_compute_sad_16x8 = ime_compute_sad_16x8;
/* memory handling operations */
- ps_mem_fxns->pf_mem_cpy = ih264_memcpy;
ps_mem_fxns->pf_mem_cpy_mul8 = ih264_memcpy_mul_8;
- ps_mem_fxns->pf_mem_set = ih264_memset;
ps_mem_fxns->pf_mem_set_mul8 = ih264_memset_mul_8;
ps_mem_fxns->pf_copy_2d = isvc_copy_2d;
ps_mem_fxns->pf_memset_2d = isvc_memset_2d;
- ps_mem_fxns->pf_16bit_interleaved_copy = isvc_16bit_interleaved_copy;
- ps_mem_fxns->pf_16bit_interleaved_memset = isvc_16bit_interleaved_memset;
ps_mem_fxns->pf_nonzero_checker = isvc_is_nonzero_blk;
/* sad me level functions */
diff --git a/encoder/svc/isvce_ilp_mv.c b/encoder/svc/isvce_ilp_mv.c
index 9aa45a3..e9a7c17 100644
--- a/encoder/svc/isvce_ilp_mv.c
+++ b/encoder/svc/isvce_ilp_mv.c
@@ -204,7 +204,7 @@ void isvce_ilp_mv_ctxt_init(isvce_codec_t *ps_codec, iv_mem_rec_t *ps_mem_rec)
if(u1_num_spatial_layers > 1)
{
- ilp_mv_layer_state_t *ps_layer_states;
+ ilp_mv_layer_state_t *ps_layer_states = NULL;
ilp_mv_mb_state_t *aps_luma_mb_states[MAX_NUM_SPATIAL_LAYERS];
DOUBLE d_spatial_res_ratio = ps_codec->s_cfg.s_svc_params.d_spatial_res_ratio;
diff --git a/encoder/svc/isvce_structs.h b/encoder/svc/isvce_structs.h
index 9d8f6c5..68619bc 100644
--- a/encoder/svc/isvce_structs.h
+++ b/encoder/svc/isvce_structs.h
@@ -1958,10 +1958,6 @@ typedef struct inter_pred_fxns_t
typedef struct mem_fxns_t
{
- FT_MEMCPY *pf_mem_cpy;
-
- FT_MEMSET *pf_mem_set;
-
FT_MEMCPY *pf_mem_cpy_mul8;
FT_MEMSET *pf_mem_set_mul8;
@@ -1970,10 +1966,6 @@ typedef struct mem_fxns_t
FT_MEMSET_2D *pf_memset_2d;
- FT_16BIT_INTERLEAVED_COPY *pf_16bit_interleaved_copy;
-
- FT_16BIT_INTERLEAVED_MEMSET *pf_16bit_interleaved_memset;
-
FT_NONZERO_CHECKER *pf_nonzero_checker;
} mem_fxns_t;
diff --git a/encoder/svc/isvce_utils.c b/encoder/svc/isvce_utils.c
index 485a52e..81ec2c0 100644
--- a/encoder/svc/isvce_utils.c
+++ b/encoder/svc/isvce_utils.c
@@ -528,7 +528,7 @@ WORD32 isvce_svc_inp_params_validate(isvce_init_ip_t *ps_ip, isvce_cfg_params_t
*
*******************************************************************************
*/
-WORD32 isvce_svc_rc_params_validate(isvce_cfg_params_t *ps_cfg)
+static WORD32 isvce_svc_rc_params_validate(isvce_cfg_params_t *ps_cfg)
{
WORD32 i;
@@ -3449,6 +3449,82 @@ void isvce_derive_nghbr_avbl_of_mbs(isvce_process_ctxt_t *ps_proc)
}
}
+static IH264E_ERROR_T isvce_rc_init_wrapper(isvce_codec_t *ps_codec)
+{
+ WORD32 i;
+
+ isvce_cfg_params_t *ps_cfg = &ps_codec->s_cfg;
+
+ IH264E_ERROR_T err = isvce_svc_rc_params_validate(ps_cfg);
+
+ if(IH264E_SUCCESS != err)
+ {
+ return err;
+ }
+
+ for(i = 0; i < ps_cfg->s_svc_params.u1_num_spatial_layers; i++)
+ {
+ UWORD8 au1_init_qp[MAX_PIC_TYPE];
+ UWORD8 au1_min_max_qp[2 * MAX_PIC_TYPE];
+
+ au1_init_qp[0] = gau1_h264_to_mpeg2_qmap[ps_cfg->au4_i_qp[i]];
+ au1_init_qp[1] = gau1_h264_to_mpeg2_qmap[ps_cfg->au4_p_qp[i]];
+ au1_init_qp[2] = gau1_h264_to_mpeg2_qmap[ps_cfg->au4_b_qp[i]];
+
+ au1_min_max_qp[2 * I_PIC] = gau1_h264_to_mpeg2_qmap[ps_cfg->au4_i_qp_min[i]];
+ au1_min_max_qp[2 * I_PIC + 1] = gau1_h264_to_mpeg2_qmap[ps_cfg->au4_i_qp_max[i]];
+
+ au1_min_max_qp[2 * P_PIC] = gau1_h264_to_mpeg2_qmap[ps_cfg->au4_p_qp_min[i]];
+ au1_min_max_qp[2 * P_PIC + 1] = gau1_h264_to_mpeg2_qmap[ps_cfg->au4_p_qp_max[i]];
+
+ au1_min_max_qp[2 * B_PIC] = gau1_h264_to_mpeg2_qmap[ps_cfg->au4_b_qp_min[i]];
+ au1_min_max_qp[2 * B_PIC + 1] = gau1_h264_to_mpeg2_qmap[ps_cfg->au4_b_qp_max[i]];
+
+ switch(ps_cfg->e_rc_mode)
+ {
+ case IVE_RC_STORAGE:
+ {
+ ps_codec->s_rate_control.e_rc_type = VBR_STORAGE;
+ break;
+ }
+ case IVE_RC_CBR_NON_LOW_DELAY:
+ {
+ ps_codec->s_rate_control.e_rc_type = CBR_NLDRC;
+ break;
+ }
+ case IVE_RC_CBR_LOW_DELAY:
+ {
+ ps_codec->s_rate_control.e_rc_type = CBR_LDRC;
+ break;
+ }
+ case IVE_RC_NONE:
+ {
+ ps_codec->s_rate_control.e_rc_type = CONST_QP;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ for(i = 0; i < MAX_NUM_SPATIAL_LAYERS; i++)
+ {
+ isvce_rc_init(ps_codec->s_rate_control.apps_rate_control_api[i],
+ ps_codec->s_rate_control.pps_frame_time,
+ ps_codec->s_rate_control.pps_time_stamp,
+ ps_codec->s_rate_control.pps_pd_frm_rate, ps_cfg->u4_max_framerate,
+ ps_cfg->u4_src_frame_rate, ps_cfg->u4_tgt_frame_rate,
+ ps_codec->s_rate_control.e_rc_type, ps_cfg->au4_target_bitrate[i],
+ ps_cfg->au4_max_bitrate[i], ps_cfg->au4_vbv_buffer_delay[i],
+ ps_cfg->u4_i_frm_interval, ps_cfg->u4_num_bframes + 1, au1_init_qp,
+ ps_cfg->u4_num_bframes + 2, au1_min_max_qp, ps_cfg->u4_max_level);
+ }
+ }
+
+ return IH264E_SUCCESS;
+}
+
/**
*******************************************************************************
*
@@ -3576,7 +3652,7 @@ IH264E_ERROR_T isvce_codec_init(isvce_codec_t *ps_codec)
}
{
- WORD32 i4_err_code = isvce_svc_rc_params_validate(&ps_codec->s_cfg);
+ WORD32 i4_err_code = isvce_rc_init_wrapper(ps_codec);
if(IH264E_SUCCESS != i4_err_code)
{
@@ -3584,82 +3660,6 @@ IH264E_ERROR_T isvce_codec_init(isvce_codec_t *ps_codec)
}
}
- /****************************************************/
- /* INITIALIZE RATE CONTROL */
- /****************************************************/
- {
- for(i = 0; i < MAX_NUM_SPATIAL_LAYERS; i++)
- {
- UWORD8 au1_init_qp[MAX_PIC_TYPE];
- UWORD8 au1_min_max_qp[2 * MAX_PIC_TYPE];
- UWORD8 au1_min_max_avc_qp[2 * MAX_PIC_TYPE];
-
- /* update rc lib with modified qp */
- au1_init_qp[0] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_i_qp[i]];
- au1_init_qp[1] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_p_qp[i]];
- au1_init_qp[2] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_b_qp[i]];
-
- au1_min_max_qp[2 * I_PIC] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_i_qp_min[i]];
- au1_min_max_qp[2 * I_PIC + 1] =
- gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_i_qp_max[i]];
-
- au1_min_max_qp[2 * P_PIC] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_p_qp_min[i]];
- au1_min_max_qp[2 * P_PIC + 1] =
- gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_p_qp_max[i]];
-
- au1_min_max_qp[2 * B_PIC] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_b_qp_min[i]];
- au1_min_max_qp[2 * B_PIC + 1] =
- gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_b_qp_max[i]];
-
- /* get rc mode */
- switch(ps_codec->s_cfg.e_rc_mode)
- {
- case IVE_RC_STORAGE:
- ps_codec->s_rate_control.e_rc_type = VBR_STORAGE;
- break;
- case IVE_RC_CBR_NON_LOW_DELAY:
- ps_codec->s_rate_control.e_rc_type = CBR_NLDRC;
- break;
- case IVE_RC_CBR_LOW_DELAY:
- ps_codec->s_rate_control.e_rc_type = CBR_LDRC;
- break;
- case IVE_RC_NONE:
- ps_codec->s_rate_control.e_rc_type = CONST_QP;
- break;
- default:
- break;
- }
-
- ps_codec->u1_enable_init_qp = DEFAULT_INIT_QP;
-
- /* init rate control */
- isvce_rc_init(
- ps_codec->s_rate_control.apps_rate_control_api[i],
- ps_codec->s_rate_control.pps_frame_time, ps_codec->s_rate_control.pps_time_stamp,
- ps_codec->s_rate_control.pps_pd_frm_rate, ps_codec->s_cfg.u4_max_framerate,
- ps_codec->s_cfg.u4_src_frame_rate, ps_codec->s_cfg.u4_tgt_frame_rate,
- ps_codec->s_rate_control.e_rc_type, ps_codec->s_cfg.au4_target_bitrate[i],
- ps_codec->s_cfg.au4_max_bitrate[i], ps_codec->s_cfg.au4_vbv_buffer_delay[i],
- ps_codec->s_cfg.u4_i_frm_interval, ps_codec->s_cfg.u4_num_bframes + 1, au1_init_qp,
- ps_codec->s_cfg.u4_num_bframes + 2, au1_min_max_qp,
- MAX(ps_codec->s_cfg.u4_max_level,
- (UWORD32) ih264e_get_min_level(ps_codec->s_cfg.u4_max_wd,
- ps_codec->s_cfg.u4_max_ht)));
-
- au1_min_max_avc_qp[2 * I_PIC] = ps_codec->s_cfg.au4_i_qp_min[i];
- au1_min_max_avc_qp[2 * I_PIC + 1] = ps_codec->s_cfg.au4_i_qp_max[i];
-
- au1_min_max_avc_qp[2 * P_PIC] = ps_codec->s_cfg.au4_p_qp_min[i];
- au1_min_max_avc_qp[2 * P_PIC + 1] = ps_codec->s_cfg.au4_p_qp_max[i];
-
- au1_min_max_avc_qp[2 * B_PIC] = ps_codec->s_cfg.au4_b_qp_min[i];
- au1_min_max_avc_qp[2 * B_PIC + 1] = ps_codec->s_cfg.au4_b_qp_max[i];
-
- irc_change_qp_constraints(ps_codec->s_rate_control.apps_rate_control_api[i],
- au1_min_max_qp, au1_min_max_avc_qp);
- }
- }
-
/* recon stride */
ps_codec->i4_rec_strd = ALIGN16(ps_codec->s_cfg.u4_max_wd) + PAD_WD;
@@ -3774,7 +3774,6 @@ IH264E_ERROR_T isvce_codec_update_config(isvce_codec_t *ps_codec, isvce_cfg_para
}
else if(ps_cfg->e_cmd == ISVCE_CMD_CTL_SET_FRAMERATE)
{
- /* temp var */
UWORD32 u4_src_ticks, u4_tgt_ticks;
u4_src_ticks = ih264e_frame_time_get_src_ticks(ps_codec->s_rate_control.pps_frame_time);
@@ -4122,71 +4121,7 @@ IH264E_ERROR_T isvce_codec_update_config(isvce_codec_t *ps_codec, isvce_cfg_para
/* reset RC model */
if(u4_init_rc)
{
- for(i = 0; i < ps_cfg->s_svc_params.u1_num_spatial_layers; i++)
- {
- /* init qp */
- UWORD8 au1_init_qp[MAX_PIC_TYPE];
-
- /* min max qp */
- UWORD8 au1_min_max_qp[2 * MAX_PIC_TYPE];
-
- /* init i,p,b qp */
- au1_init_qp[0] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_i_qp[i]];
- au1_init_qp[1] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_p_qp[i]];
- au1_init_qp[2] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_b_qp[i]];
-
- /* init min max qp */
- au1_min_max_qp[2 * I_PIC] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_i_qp_min[i]];
- au1_min_max_qp[2 * I_PIC + 1] =
- gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_i_qp_max[i]];
-
- au1_min_max_qp[2 * P_PIC] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_p_qp_min[i]];
- au1_min_max_qp[2 * P_PIC + 1] =
- gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_p_qp_max[i]];
-
- au1_min_max_qp[2 * B_PIC] = gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_b_qp_min[i]];
- au1_min_max_qp[2 * B_PIC + 1] =
- gau1_h264_to_mpeg2_qmap[ps_codec->s_cfg.au4_b_qp_max[i]];
-
- /* get rc mode */
- switch(ps_codec->s_cfg.e_rc_mode)
- {
- case IVE_RC_STORAGE:
- ps_codec->s_rate_control.e_rc_type = VBR_STORAGE;
- break;
-
- case IVE_RC_CBR_NON_LOW_DELAY:
- ps_codec->s_rate_control.e_rc_type = CBR_NLDRC;
- break;
-
- case IVE_RC_CBR_LOW_DELAY:
- ps_codec->s_rate_control.e_rc_type = CBR_LDRC;
- break;
-
- case IVE_RC_NONE:
- ps_codec->s_rate_control.e_rc_type = CONST_QP;
- break;
-
- default:
- break;
- }
-
- /* init rate control */
- for(i = 0; i < MAX_NUM_SPATIAL_LAYERS; i++)
- {
- isvce_rc_init(
- ps_codec->s_rate_control.apps_rate_control_api[i],
- ps_codec->s_rate_control.pps_frame_time,
- ps_codec->s_rate_control.pps_time_stamp,
- ps_codec->s_rate_control.pps_pd_frm_rate, ps_codec->s_cfg.u4_max_framerate,
- ps_codec->s_cfg.u4_src_frame_rate, ps_codec->s_cfg.u4_tgt_frame_rate,
- ps_codec->s_rate_control.e_rc_type, ps_codec->s_cfg.au4_target_bitrate[i],
- ps_codec->s_cfg.au4_max_bitrate[i], ps_codec->s_cfg.au4_vbv_buffer_delay[i],
- ps_codec->s_cfg.u4_i_frm_interval, ps_codec->s_cfg.u4_num_bframes + 1,
- au1_init_qp, ps_codec->s_cfg.u4_num_bframes + 2, au1_min_max_qp,
- ps_codec->s_cfg.u4_max_level);
- }
- }
+ err = isvce_rc_init_wrapper(ps_codec);
}
return err;
diff --git a/encoder/svc/isvce_utils.h b/encoder/svc/isvce_utils.h
index 497809e..ad14446 100644
--- a/encoder/svc/isvce_utils.h
+++ b/encoder/svc/isvce_utils.h
@@ -180,8 +180,6 @@ extern WORD32 isvce_svc_au_props_validate(svc_inp_params_t *ps_svc_inp_params, U
extern WORD32 isvce_svc_inp_params_validate(isvce_init_ip_t *ps_ip, isvce_cfg_params_t *ps_cfg);
-extern WORD32 isvce_svc_rc_params_validate(isvce_cfg_params_t *ps_cfg);
-
extern WORD32 isvce_svc_frame_params_validate(
rate_control_api_t *aps_rate_control_api[MAX_NUM_SPATIAL_LAYERS], UWORD8 u1_num_spatial_layers);
diff --git a/encoder/x86/svc/isvce_function_selector_sse42.c b/encoder/x86/svc/isvce_function_selector_sse42.c
index 709155f..03f1cf0 100644
--- a/encoder/x86/svc/isvce_function_selector_sse42.c
+++ b/encoder/x86/svc/isvce_function_selector_sse42.c
@@ -128,20 +128,13 @@ void isvce_init_function_ptr_sse42(isvce_codec_t *ps_codec)
isvc_iquant_itrans_recon_res_chroma_4x4_sse42;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[1] =
isvc_iquant_itrans_recon_res_chroma_4x4_with_res_acc_sse42;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[2] =
- isvc_iquant_itrans_recon_chroma_4x4_sse42;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[0] = isvc_iquant_itrans_recon_res_dc_4x4_sse42;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[1] =
- isvc_iquant_itrans_recon_res_dc_with_res_acc_4x4_sse42;
ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[2] = isvc_iquant_itrans_recon_dc_4x4_sse42;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[0] =
isvc_iquant_itrans_recon_res_chroma_4x4_dc_sse42;
ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[1] =
isvc_iquant_itrans_recon_res_chroma_4x4_dc_with_res_acc_sse42;
- ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[2] =
- isvc_iquant_itrans_recon_chroma_4x4_dc_sse42;
ps_enc_loop_fxns->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_sse42;