Use shifts rather than multiply, and save one instruction.
Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -84,33 +84,35 @@ av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c) · 83 unmodified lines | |||
| 84 | c->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_rvv; | 84 | c->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_rvv; |
| 85 | c->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_rvv; | 85 | c->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_rvv; |
| 86 | 86 | ||
| 87 | c->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_rvv; | 87 | if (flags & AV_CPU_FLAG_RVB_ADDR) { |
| 88 | c->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_rvv; | 88 | c->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_rvv; |
| 89 | c->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_rvv; | 89 | c->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_rvv; |
| 90 | c->put_vp8_epel_pixels_tab[0][0][1] = ff_put_vp8_epel16_h4_rvv; | 90 | c->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_rvv; |
| 91 | c->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_rvv; | 91 | c->put_vp8_epel_pixels_tab[0][0][1] = ff_put_vp8_epel16_h4_rvv; |
| 92 | c->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_rvv; | 92 | c->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_rvv; |
| 93 | c->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_rvv; | ||
| 93 | 94 | ||
| 94 | c->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_rvv; | 95 | c->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_rvv; |
| 95 | c->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_rvv; | 96 | c->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_rvv; |
| 96 | c->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_rvv; | 97 | c->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_rvv; |
| 97 | c->put_vp8_epel_pixels_tab[0][1][0] = ff_put_vp8_epel16_v4_rvv; | 98 | c->put_vp8_epel_pixels_tab[0][1][0] = ff_put_vp8_epel16_v4_rvv; |
| 98 | c->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_rvv; | 99 | c->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_rvv; |
| 99 | c->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_rvv; | 100 | c->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_rvv; |
| 100 | #if __riscv_xlen <= 64 | 101 | #if __riscv_xlen <= 64 |
| 101 | c->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_rvv; | 102 | c->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_rvv; |
| 102 | c->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_rvv; | 103 | c->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_rvv; |
| 103 | c->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_rvv; | 104 | c->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_rvv; |
| 104 | c->put_vp8_epel_pixels_tab[0][2][1] = ff_put_vp8_epel16_h4v6_rvv; | 105 | c->put_vp8_epel_pixels_tab[0][2][1] = ff_put_vp8_epel16_h4v6_rvv; |
| 105 | c->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_rvv; | 106 | c->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_rvv; |
| 106 | c->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_rvv; | 107 | c->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_rvv; |
| 107 | c->put_vp8_epel_pixels_tab[0][1][1] = ff_put_vp8_epel16_h4v4_rvv; | 108 | c->put_vp8_epel_pixels_tab[0][1][1] = ff_put_vp8_epel16_h4v4_rvv; |
| 108 | c->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_rvv; | 109 | c->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_rvv; |
| 109 | c->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_rvv; | 110 | c->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_rvv; |
| 110 | c->put_vp8_epel_pixels_tab[0][1][2] = ff_put_vp8_epel16_h6v4_rvv; | 111 | c->put_vp8_epel_pixels_tab[0][1][2] = ff_put_vp8_epel16_h6v4_rvv; |
| 111 | c->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_rvv; | 112 | c->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_rvv; |
| 112 | c->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_rvv; | 113 | c->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_rvv; |
| 113 | #endif | 114 | #endif |
| 115 | } | ||
| 114 | } | 116 | } |
| 115 | #endif | 117 | #endif |
| 116 | #endif | 118 | #endif |
| @@ -182,15 +182,14 @@ const subpel_filters · 181 unmodified lines | |||
| 182 | endconst | 182 | endconst |
| 183 | 183 | ||
| 184 | .macro epel_filter size type regtype | 184 | .macro epel_filter size type regtype |
| 185 | lla \regtype\()2, subpel_filters | ||
| 186 | .ifc \type,v | 185 | .ifc \type,v |
| 187 | addi \regtype\()0, a6, -1 | 186 | addi \regtype\()0, a6, -1 |
| 188 | .else | 187 | .else |
| 189 | addi \regtype\()0, a5, -1 | 188 | addi \regtype\()0, a5, -1 |
| 190 | .endif | 189 | .endif |
| 191 | li \regtype\()1, 6 | 190 | lla \regtype\()2, subpel_filters |
| 192 | mul \regtype\()0, \regtype\()0, \regtype\()1 | 191 | sh1add \regtype\()0, \regtype\()0, \regtype\()0 |
| 193 | add \regtype\()0, \regtype\()0, \regtype\()2 | 192 | sh1add \regtype\()0, \regtype\()0, \regtype\()2 |
| 194 | .irp n,1,2,3,4 | 193 | .irp n,1,2,3,4 |
| 195 | lb \regtype\n, \n(\regtype\()0) | 194 | lb \regtype\n, \n(\regtype\()0) |
| 196 | .endr | 195 | .endr |