@@ -1878,23 +1878,25 @@ static void hevc_sao_edge_filter_45degree_4width_msa(uint8_t *dst,
int32_t height) {
uint8_t *src_orig;
- int32_t h_cnt;
uint32_t dst_val0, dst_val1;
- v8i16 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0 };
+ v16i8 edge_idx = { 1, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
v16u8 const1 = (v16u8) __msa_ldi_b(1);
- v16i8 zero = { 0 };
+ v16i8 offset, sao_offset = LD_SB(sao_offset_val);
v16u8 cmp_minus10, diff_minus10, src_minus10, cmp_minus11, diff_minus11;
v16u8 src_minus11, src10, src11;
v16i8 src_plus0, src_zero0, src_plus1, src_zero1, dst0;
- v8i16 sao_offset, src00, src01, offset_mask0, offset_mask1;
+ v8i16 offset_mask0, offset_mask1;
- sao_offset = LD_SH(sao_offset_val);
+ sao_offset = __msa_pckev_b(sao_offset, sao_offset);
src_orig = src - 1;
+
+ /* load in advance */
LD_UB2(src_orig - src_stride, src_stride, src_minus10, src_minus11);
+ LD_UB2(src_orig + src_stride, src_stride, src10, src11);
- for (h_cnt = (height >> 1); h_cnt--;) {
- LD_UB2(src_orig + src_stride, src_stride, src10, src11);
+ for (height -= 2; height; height -= 2) {
+ src_orig += (src_stride << 1);
SLDI_B2_0_SB(src_minus11, src10, src_zero0, src_zero1, 1);
SLDI_B2_0_SB(src10, src11, src_plus0, src_plus1, 2); @@ -1917,20 +1919,22 @@ static void hevc_sao_edge_filter_45degree_4width_msa(uint8_t *dst,
offset_mask0 = (v8i16) (__msa_hadd_u_h(diff_minus10, diff_minus10) + 2);