@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Parag Salasakar (Parag.Salasakar@imgtec.com)
+ * Copyright (c) 2015 - 2017 Parag Salasakar
+ (Parag.Salasakar@imgtec.com)
*
* This file is part of FFmpeg.
*
@@ -644,96 +644,69 @@ static void avc_loopfilter_luma_intra_edge_hor_msa(uint8_t *data,
uint8_t beta_in,
uint32_t img_width) {
- v16u8 p2_asub_p0, q2_asub_q0, p0_asub_q0;
- v16u8 alpha, beta;
- v16u8 is_less_than, is_less_than_beta, negate_is_less_than_beta;
- v16u8 p2, p1, p0, q0, q1, q2;
- v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org;
- v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;
- v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l;
- v8i16 p2_r = { 0 };
- v8i16 p1_r = { 0 };
- v8i16 p0_r = { 0 };
- v8i16 q0_r = { 0 };
- v8i16 q1_r = { 0 };
- v8i16 q2_r = { 0 };
- v8i16 p2_l = { 0 };
- v8i16 p1_l = { 0 };
- v8i16 p0_l = { 0 };
- v8i16 q0_l = { 0 };
- v8i16 q1_l = { 0 };
- v8i16 q2_l = { 0 };
- v16u8 tmp_flag;
- v16i8 zero = { 0 };
-
- alpha = (v16u8) __msa_fill_b(alpha_in);
- beta = (v16u8) __msa_fill_b(beta_in);
+ v16u8 p0_asub_q0, p1_asub_p0, q1_asub_q0;
+ v16u8 is_less_than, is_less_than_beta, is_less_than_alpha;
+ v16u8 p1_org, p0_org, q0_org, q1_org;
LD_UB4(data - (img_width << 1), img_width, p1_org, p0_org, q0_org, q1_org);
- {
- v16u8 p1_asub_p0, q1_asub_q0, is_less_than_alpha;
-
- p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);
- p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);
- q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);
+ p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);
+ p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);
+ q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);
- is_less_than_alpha = (p0_asub_q0 < alpha);
- is_less_than_beta = (p1_asub_p0 < beta);
- is_less_than = is_less_than_beta & is_less_than_alpha;
- is_less_than_beta = (q1_asub_q0 < beta);
- is_less_than = is_less_than_beta & is_less_than;
- }
+ is_less_than_alpha = (p0_asub_q0 < alpha_in);
+ is_less_than_beta = (p1_asub_p0 < beta_in);
+ is_less_than = is_less_than_beta & is_less_than_alpha;
+ is_less_than_beta = (q1_asub_q0 < beta_in);
+ is_less_than = is_less_than_beta & is_less_than;
if (!__msa_test_bz_v(is_less_than)) {
- q2_org = LD_UB(data + (2 * img_width));
- p3_org = LD_UB(data - (img_width << 2));
- p2_org = LD_UB(data - (3 * img_width));
+ v16u8 p2_asub_p0, q2_asub_q0, p0, q0, negate_is_less_than_beta;
+ v8i16 p0_r = { 0 };
+ v8i16 q0_r = { 0 };
+ v8i16 p0_l = { 0 };
+ v8i16 q0_l = { 0 };
+ v16i8 zero = { 0 };
+ v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;
+ v8i16 p1_org_l, p0_org_l, q0_org_l, q1_org_l;
+ v16u8 q2_org = LD_UB(data + (2 * img_width));
+ v16u8 p2_org = LD_UB(data - (3 * img_width));
+ v16u8 tmp_flag = (v16u8)__msa_fill_b((alpha_in >> 2) + 2);
UNPCK_UB_SH(p1_org, p1_org_r, p1_org_l);
UNPCK_UB_SH(p0_org, p0_org_r, p0_org_l);
UNPCK_UB_SH(q0_org, q0_org_r, q0_org_l);
- tmp_flag = alpha >> 2;
- tmp_flag = tmp_flag + 2;
tmp_flag = (p0_asub_q0 < tmp_flag);
p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org);
- is_less_than_beta = (p2_asub_p0 < beta);
+ is_less_than_beta = (p2_asub_p0 < beta_in);
is_less_than_beta = is_less_than_beta & tmp_flag;
negate_is_less_than_beta = __msa_xori_b(is_less_than_beta, 0xff);
is_less_than_beta = is_less_than_beta & is_less_than;
negate_is_less_than_beta = negate_is_less_than_beta & is_less_than;
- {
- v8u16 is_less_than_beta_l, is_less_than_beta_r;
-
- q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);
-
- is_less_than_beta_r =
- (v8u16) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8);
- if (!__msa_test_bz_v((v16u8) is_less_than_beta_r)) {
- v8i16 p3_org_r;
-
- ILVR_B2_SH(zero, p3_org, zero, p2_org, p3_org_r, p2_r);
- AVC_LPF_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r, q0_org_r, p1_org_r,
- p2_r, q1_org_r, p0_r, p1_r, p2_r);
- }
-
- q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org);
- is_less_than_beta_l =
- (v8u16) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8);
+ q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);
+ q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org);
- if (!__msa_test_bz_v((v16u8) is_less_than_beta_l)) {
- v8i16 p3_org_l;
-
- ILVL_B2_SH(zero, p3_org, zero, p2_org, p3_org_l, p2_l);
- AVC_LPF_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l, q0_org_l, p1_org_l,
- p2_l, q1_org_l, p0_l, p1_l, p2_l);
- }
- }
/* combine and store */
if (!__msa_test_bz_v(is_less_than_beta)) {
+ v8i16 p3_org_l, p3_org_r;
+ v16u8 p3_org = LD_UB(data - (img_width << 2));
+ v16u8 p2, p1;
+ v8i16 p2_r = { 0 };
+ v8i16 p2_l = { 0 };
+ v8i16 p1_r = { 0 };
+ v8i16 p1_l = { 0 };
+
+ ILVR_B2_SH(zero, p3_org, zero, p2_org, p3_org_r, p2_r);
+ AVC_LPF_P0P1P2_OR_Q0Q1Q2(p3_org_r, p0_org_r, q0_org_r, p1_org_r,
+ p2_r, q1_org_r, p0_r, p1_r, p2_r);
+
+ ILVL_B2_SH(zero, p3_org, zero, p2_org, p3_org_l, p2_l);
+ AVC_LPF_P0P1P2_OR_Q0Q1Q2(p3_org_l, p0_org_l, q0_org_l, p1_org_l,
+ p2_l, q1_org_l, p0_l, p1_l, p2_l);
+
PCKEV_B3_UB(p0_l, p0_r, p1_l, p1_r, p2_l, p2_r, p0, p1, p2);
p0_org = __msa_bmnz_v(p0_org, p0, is_less_than_beta); @@ -743,62 +716,42 @@ static void avc_loopfilter_luma_intra_edge_hor_msa(uint8_t *data,
ST_UB(p1_org, data - (2 * img_width));