FFmpeg
vc1dsp_init_loongarch.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Loongson Technology Corporation Limited
3  * Contributed by Hao Chen <chenhao@loongson.cn>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
23 #include "libavutil/attributes.h"
24 #include "libavcodec/vc1dsp.h"
25 #include "vc1dsp_loongarch.h"
26 
27 #define FN_ASSIGN(OP, X, Y, INSN) \
28  dsp->OP##vc1_mspel_pixels_tab[1][X+4*Y] = ff_##OP##vc1_mspel_mc##X##Y##INSN; \
29  dsp->OP##vc1_mspel_pixels_tab[0][X+4*Y] = ff_##OP##vc1_mspel_mc##X##Y##_16##INSN
30 
31 #define FN_ASSIGN_V(OP, Y, INSN) \
32  dsp->OP##vc1_mspel_pixels_tab[0][4*Y] = ff_##OP##vc1_mspel_mc0##Y##_16##INSN
33 
34 #define FN_ASSIGN_H(OP, X, INSN) \
35  dsp->OP##vc1_mspel_pixels_tab[0][X] = ff_##OP##vc1_mspel_mc##X##0_16##INSN
36 
38 {
40 
41  if (have_lasx(cpu_flags)) {
50  FN_ASSIGN(put_, 1, 1, _lasx);
51  FN_ASSIGN(put_, 1, 2, _lasx);
52  FN_ASSIGN(put_, 1, 3, _lasx);
53  FN_ASSIGN(put_, 2, 1, _lasx);
54  FN_ASSIGN(put_, 2, 2, _lasx);
55  FN_ASSIGN(put_, 2, 3, _lasx);
56  FN_ASSIGN(put_, 3, 1, _lasx);
57  FN_ASSIGN(put_, 3, 2, _lasx);
58  FN_ASSIGN(put_, 3, 3, _lasx);
59  FN_ASSIGN_V(put_, 1, _lasx);
60  FN_ASSIGN_V(put_, 2, _lasx);
61  FN_ASSIGN_V(put_, 3, _lasx);
62  FN_ASSIGN_H(put_, 1, _lasx);
63  FN_ASSIGN_H(put_, 2, _lasx);
64  FN_ASSIGN_H(put_, 3, _lasx);
66  }
67 }
vc1dsp.h
VC1DSPContext::vc1_inv_trans_4x4
void(* vc1_inv_trans_4x4)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:40
ff_vc1_inv_trans_8x4_dc_lasx
void ff_vc1_inv_trans_8x4_dc_lasx(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp_lasx.c:265
have_lasx
#define have_lasx(flags)
Definition: cpu.h:29
VC1DSPContext::vc1_inv_trans_8x8_dc
void(* vc1_inv_trans_8x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:41
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:98
VC1DSPContext::put_no_rnd_vc1_chroma_pixels_tab
h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]
Definition: vc1dsp.h:63
VC1DSPContext::vc1_inv_trans_4x4_dc
void(* vc1_inv_trans_4x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:44
FN_ASSIGN_H
#define FN_ASSIGN_H(OP, X, INSN)
Definition: vc1dsp_init_loongarch.c:34
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:50
ff_vc1_inv_trans_4x8_dc_lasx
void ff_vc1_inv_trans_4x8_dc_lasx(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp_lasx.c:290
ff_vc1_inv_trans_8x4_lasx
void ff_vc1_inv_trans_8x4_lasx(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp_lasx.c:174
VC1DSPContext::vc1_inv_trans_8x4_dc
void(* vc1_inv_trans_8x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:42
av_cold
#define av_cold
Definition: attributes.h:90
ff_vc1_inv_trans_4x4_dc_lasx
void ff_vc1_inv_trans_4x4_dc_lasx(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp_lasx.c:439
VC1DSPContext::vc1_inv_trans_8x4
void(* vc1_inv_trans_8x4)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:38
FN_ASSIGN_V
#define FN_ASSIGN_V(OP, Y, INSN)
Definition: vc1dsp_init_loongarch.c:31
VC1DSPContext::vc1_inv_trans_4x8_dc
void(* vc1_inv_trans_4x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:43
ff_vc1_inv_trans_8x8_lasx
void ff_vc1_inv_trans_8x8_lasx(int16_t block[64])
Definition: vc1dsp_lasx.c:25
ff_vc1_inv_trans_8x8_dc_lasx
void ff_vc1_inv_trans_8x8_dc_lasx(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp_lasx.c:135
attributes.h
VC1DSPContext::vc1_inv_trans_8x8
void(* vc1_inv_trans_8x8)(int16_t *b)
Definition: vc1dsp.h:37
ff_vc1_inv_trans_4x4_lasx
void ff_vc1_inv_trans_4x4_lasx(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp_lasx.c:466
FN_ASSIGN
#define FN_ASSIGN(OP, X, Y, INSN)
Definition: vc1dsp_init_loongarch.c:27
ff_put_no_rnd_vc1_chroma_mc8_lasx
void ff_put_no_rnd_vc1_chroma_mc8_lasx(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y)
Definition: vc1dsp_lasx.c:700
VC1DSPContext
Definition: vc1dsp.h:35
ff_vc1_inv_trans_4x8_lasx
void ff_vc1_inv_trans_4x8_lasx(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp_lasx.c:325
vc1dsp_loongarch.h
VC1DSPContext::vc1_inv_trans_4x8
void(* vc1_inv_trans_4x8)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:39
ff_vc1dsp_init_loongarch
av_cold void ff_vc1dsp_init_loongarch(VC1DSPContext *dsp)
Definition: vc1dsp_init_loongarch.c:37
cpu.h