2 * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "libavutil/attributes.h"
24 #include "libavutil/cpu.h"
25 #include "libavutil/riscv/cpu.h"
26 #include "libavcodec/vc1.h"
28 void ff_vc1_inv_trans_8x8_dc_rvv(uint8_t *dest
, ptrdiff_t stride
, int16_t *block
);
29 void ff_vc1_inv_trans_4x8_dc_rvv(uint8_t *dest
, ptrdiff_t stride
, int16_t *block
);
30 void ff_vc1_inv_trans_8x4_dc_rvv(uint8_t *dest
, ptrdiff_t stride
, int16_t *block
);
31 void ff_vc1_inv_trans_4x4_dc_rvv(uint8_t *dest
, ptrdiff_t stride
, int16_t *block
);
32 void ff_put_pixels16x16_rvi(uint8_t *dst
, const uint8_t *src
, ptrdiff_t line_size
, int rnd
);
33 void ff_put_pixels8x8_rvi(uint8_t *dst
, const uint8_t *src
, ptrdiff_t line_size
, int rnd
);
34 void ff_avg_pixels16x16_rvv(uint8_t *dst
, const uint8_t *src
, ptrdiff_t line_size
, int rnd
);
35 void ff_avg_pixels8x8_rvv(uint8_t *dst
, const uint8_t *src
, ptrdiff_t line_size
, int rnd
);
36 int ff_startcode_find_candidate_rvb(const uint8_t *, int);
37 int ff_startcode_find_candidate_rvv(const uint8_t *, int);
38 int ff_vc1_unescape_buffer_rvv(const uint8_t *, int, uint8_t *);
40 av_cold
void ff_vc1dsp_init_riscv(VC1DSPContext
*dsp
)
43 int flags
= av_get_cpu_flags();
45 # if __riscv_xlen >= 64
46 if (flags
& AV_CPU_FLAG_RVI
) {
47 dsp
->put_vc1_mspel_pixels_tab
[1][0] = ff_put_pixels8x8_rvi
;
48 dsp
->put_vc1_mspel_pixels_tab
[0][0] = ff_put_pixels16x16_rvi
;
51 if (flags
& AV_CPU_FLAG_RVB_BASIC
)
52 dsp
->startcode_find_candidate
= ff_startcode_find_candidate_rvb
;
54 if (flags
& AV_CPU_FLAG_RVV_I32
) {
55 if (ff_rv_vlen_least(128)) {
56 dsp
->vc1_inv_trans_4x8_dc
= ff_vc1_inv_trans_4x8_dc_rvv
;
57 dsp
->vc1_inv_trans_4x4_dc
= ff_vc1_inv_trans_4x4_dc_rvv
;
58 dsp
->avg_vc1_mspel_pixels_tab
[0][0] = ff_avg_pixels16x16_rvv
;
59 if (flags
& AV_CPU_FLAG_RVV_I64
) {
60 dsp
->vc1_inv_trans_8x8_dc
= ff_vc1_inv_trans_8x8_dc_rvv
;
61 dsp
->vc1_inv_trans_8x4_dc
= ff_vc1_inv_trans_8x4_dc_rvv
;
62 dsp
->avg_vc1_mspel_pixels_tab
[1][0] = ff_avg_pixels8x8_rvv
;
65 dsp
->startcode_find_candidate
= ff_startcode_find_candidate_rvv
;
66 dsp
->vc1_unescape_buffer
= ff_vc1_unescape_buffer_rvv
;