FFmpeg
h264dsp_loongarch.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 Loongson Technology Corporation Limited
3  * Contributed by Shiyou Yin <yinshiyou-hf@loongson.cn>
4  * Xiwei Gu <guxiwei-hf@loongson.cn>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef AVCODEC_LOONGARCH_H264DSP_LOONGARCH_H
24 #define AVCODEC_LOONGARCH_H264DSP_LOONGARCH_H
25 
26 #include "libavcodec/h264dec.h"
27 #include "config.h"
28 
29 void ff_h264_idct_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
30 void ff_h264_idct8_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
31 void ff_h264_idct_dc_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
32 void ff_h264_idct8_dc_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride);
33 void ff_h264_luma_dc_dequant_idct_8_lsx(int16_t *_output, int16_t *_input, int qmul);
34 void ff_h264_idct_add16_8_lsx(uint8_t *dst, const int32_t *blk_offset,
35  int16_t *block, int32_t dst_stride,
36  const uint8_t nzc[15 * 8]);
37 void ff_h264_idct8_add4_8_lsx(uint8_t *dst, const int32_t *blk_offset,
38  int16_t *block, int32_t dst_stride,
39  const uint8_t nzc[15 * 8]);
40 void ff_h264_idct_add8_8_lsx(uint8_t **dst, const int32_t *blk_offset,
41  int16_t *block, int32_t dst_stride,
42  const uint8_t nzc[15 * 8]);
43 void ff_h264_idct_add8_422_8_lsx(uint8_t **dst, const int32_t *blk_offset,
44  int16_t *block, int32_t dst_stride,
45  const uint8_t nzc[15 * 8]);
46 void ff_h264_idct_add16_intra_8_lsx(uint8_t *dst, const int32_t *blk_offset,
47  int16_t *block, int32_t dst_stride,
48  const uint8_t nzc[15 * 8]);
49 
50 void ff_h264_h_lpf_luma_8_lsx(uint8_t *src, ptrdiff_t stride,
51  int alpha, int beta, int8_t *tc0);
52 void ff_h264_v_lpf_luma_8_lsx(uint8_t *src, ptrdiff_t stride,
53  int alpha, int beta, int8_t *tc0);
54 void ff_h264_h_lpf_luma_intra_8_lsx(uint8_t *src, ptrdiff_t stride,
55  int alpha, int beta);
56 void ff_h264_v_lpf_luma_intra_8_lsx(uint8_t *src, ptrdiff_t stride,
57  int alpha, int beta);
58 void ff_h264_h_lpf_chroma_8_lsx(uint8_t *src, ptrdiff_t stride,
59  int alpha, int beta, int8_t *tc0);
60 void ff_h264_v_lpf_chroma_8_lsx(uint8_t *src, ptrdiff_t stride,
61  int alpha, int beta, int8_t *tc0);
62 void ff_h264_h_lpf_chroma_intra_8_lsx(uint8_t *src, ptrdiff_t stride,
63  int alpha, int beta);
64 void ff_h264_v_lpf_chroma_intra_8_lsx(uint8_t *src, ptrdiff_t stride,
65  int alpha, int beta);
66 void ff_biweight_h264_pixels16_8_lsx(uint8_t *dst, uint8_t *src,
67  ptrdiff_t stride, int height,
68  int log2_denom, int weight_dst,
69  int weight_src, int offset_in);
70 void ff_biweight_h264_pixels8_8_lsx(uint8_t *dst, uint8_t *src,
71  ptrdiff_t stride, int height,
72  int log2_denom, int weight_dst,
73  int weight_src, int offset);
74 void ff_biweight_h264_pixels4_8_lsx(uint8_t *dst, uint8_t *src,
75  ptrdiff_t stride, int height,
76  int log2_denom, int weight_dst,
77  int weight_src, int offset);
78 void ff_weight_h264_pixels16_8_lsx(uint8_t *src, ptrdiff_t stride,
79  int height, int log2_denom,
80  int weight_src, int offset_in);
81 void ff_weight_h264_pixels8_8_lsx(uint8_t *src, ptrdiff_t stride,
82  int height, int log2_denom,
83  int weight_src, int offset);
84 void ff_weight_h264_pixels4_8_lsx(uint8_t *src, ptrdiff_t stride,
85  int height, int log2_denom,
86  int weight_src, int offset);
87 void ff_h264_add_pixels4_8_lsx(uint8_t *_dst, int16_t *_src, int stride);
88 void ff_h264_add_pixels8_8_lsx(uint8_t *_dst, int16_t *_src, int stride);
89 void ff_h264_loop_filter_strength_lsx(int16_t bS[2][4][4], uint8_t nnz[40],
90  int8_t ref[2][40], int16_t mv[2][40][2],
91  int bidir, int edges, int step,
92  int mask_mv0, int mask_mv1, int field);
93 
94 #if HAVE_LASX
95 void ff_h264_h_lpf_luma_8_lasx(uint8_t *src, ptrdiff_t stride,
96  int alpha, int beta, int8_t *tc0);
97 void ff_h264_v_lpf_luma_8_lasx(uint8_t *src, ptrdiff_t stride,
98  int alpha, int beta, int8_t *tc0);
99 void ff_h264_h_lpf_luma_intra_8_lasx(uint8_t *src, ptrdiff_t stride,
100  int alpha, int beta);
101 void ff_h264_v_lpf_luma_intra_8_lasx(uint8_t *src, ptrdiff_t stride,
102  int alpha, int beta);
103 void ff_biweight_h264_pixels16_8_lasx(unsigned char *dst, unsigned char *src,
104  long int stride, int height,
105  int log2_denom, int weight_dst,
106  int weight_src, int offset_in);
107 void ff_biweight_h264_pixels8_8_lasx(unsigned char *dst, unsigned char *src,
108  long int stride, int height,
109  int log2_denom, int weight_dst,
110  int weight_src, int offset);
111 void ff_weight_h264_pixels16_8_lasx(uint8_t *src, ptrdiff_t stride,
112  int height, int log2_denom,
113  int weight_src, int offset_in);
114 void ff_weight_h264_pixels8_8_lasx(uint8_t *src, ptrdiff_t stride,
115  int height, int log2_denom,
116  int weight_src, int offset);
117 void ff_h264_add_pixels4_8_lasx(uint8_t *_dst, int16_t *_src, int stride);
118 
119 void ff_h264_add_pixels8_8_lasx(uint8_t *_dst, int16_t *_src, int stride);
120 void ff_h264_idct8_add_8_lasx(uint8_t *dst, int16_t *src, int32_t dst_stride);
121 void ff_h264_idct8_dc_add_8_lasx(uint8_t *dst, int16_t *src,
122  int32_t dst_stride);
123 void ff_h264_idct8_add4_8_lasx(uint8_t *dst, const int32_t *blk_offset,
124  int16_t *block, int32_t dst_stride,
125  const uint8_t nzc[15 * 8]);
126 void ff_h264_loop_filter_strength_lasx(int16_t bS[2][4][4], uint8_t nnz[40],
127  int8_t ref[2][40], int16_t mv[2][40][2],
128  int bidir, int edges, int step,
129  int mask_mv0, int mask_mv1, int field);
130 #endif // #if HAVE_LASX
131 
132 #endif // #ifndef AVCODEC_LOONGARCH_H264DSP_LOONGARCH_H
ff_h264_idct8_add_8_lsx
void ff_h264_idct8_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride)
ff_h264_idct_add_8_lsx
void ff_h264_idct_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride)
ff_h264_idct_dc_add_8_lsx
void ff_h264_idct_dc_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride)
mv
static const int8_t mv[256][2]
Definition: 4xm.c:80
step
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
Definition: rate_distortion.txt:58
ff_h264_loop_filter_strength_lasx
void ff_h264_loop_filter_strength_lasx(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2], int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field)
Definition: h264_deblock_lasx.c:112
ff_h264_v_lpf_luma_intra_8_lsx
void ff_h264_v_lpf_luma_intra_8_lsx(uint8_t *src, ptrdiff_t stride, int alpha, int beta)
ff_h264_h_lpf_luma_8_lsx
void ff_h264_h_lpf_luma_8_lsx(uint8_t *src, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
ff_weight_h264_pixels4_8_lsx
void ff_weight_h264_pixels4_8_lsx(uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weight_src, int offset)
ff_h264_idct8_dc_add_8_lsx
void ff_h264_idct8_dc_add_8_lsx(uint8_t *dst, int16_t *src, int dst_stride)
ff_h264_luma_dc_dequant_idct_8_lsx
void ff_h264_luma_dc_dequant_idct_8_lsx(int16_t *_output, int16_t *_input, int qmul)
ff_h264_h_lpf_chroma_8_lsx
void ff_h264_h_lpf_chroma_8_lsx(uint8_t *src, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
field
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this field
Definition: writing_filters.txt:78
ff_h264_add_pixels4_8_lsx
void ff_h264_add_pixels4_8_lsx(uint8_t *_dst, int16_t *_src, int stride)
ff_biweight_h264_pixels8_8_lsx
void ff_biweight_h264_pixels8_8_lsx(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weight_dst, int weight_src, int offset)
ff_h264_loop_filter_strength_lsx
void ff_h264_loop_filter_strength_lsx(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2], int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field)
ff_h264_h_lpf_luma_intra_8_lasx
void ff_h264_h_lpf_luma_intra_8_lasx(uint8_t *data, ptrdiff_t img_width, int alpha_in, int beta_in)
Definition: h264dsp_lasx.c:406
ff_weight_h264_pixels8_8_lsx
void ff_weight_h264_pixels8_8_lsx(uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weight_src, int offset)
ff_h264_v_lpf_chroma_8_lsx
void ff_h264_v_lpf_chroma_8_lsx(uint8_t *src, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
ff_h264_idct_add16_8_lsx
void ff_h264_idct_add16_8_lsx(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_loongarch.c:28
ff_h264_v_lpf_luma_intra_8_lasx
void ff_h264_v_lpf_luma_intra_8_lasx(uint8_t *data, ptrdiff_t img_width, int alpha_in, int beta_in)
Definition: h264dsp_lasx.c:582
ff_weight_h264_pixels16_8_lsx
void ff_weight_h264_pixels16_8_lsx(uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weight_src, int offset_in)
height
#define height
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
ff_h264_add_pixels8_8_lasx
void ff_h264_add_pixels8_8_lasx(uint8_t *_dst, int16_t *_src, int stride)
Definition: h264dsp_lasx.c:729
ff_h264_v_lpf_luma_8_lsx
void ff_h264_v_lpf_luma_8_lsx(uint8_t *src, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
h264dec.h
ff_h264_idct_add8_422_8_lsx
void ff_h264_idct_add8_422_8_lsx(uint8_t **dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_loongarch.c:121
ff_biweight_h264_pixels16_8_lsx
void ff_biweight_h264_pixels16_8_lsx(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weight_dst, int weight_src, int offset_in)
ff_h264_add_pixels8_8_lsx
void ff_h264_add_pixels8_8_lsx(uint8_t *_dst, int16_t *_src, int stride)
stride
#define stride
Definition: h264pred_template.c:537
ff_h264_idct8_add4_8_lsx
void ff_h264_idct8_add4_8_lsx(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_loongarch.c:49
ff_h264_idct_add16_intra_8_lsx
void ff_h264_idct_add16_intra_8_lsx(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_loongarch.c:169
ff_h264_h_lpf_chroma_intra_8_lsx
void ff_h264_h_lpf_chroma_intra_8_lsx(uint8_t *src, ptrdiff_t stride, int alpha, int beta)
ff_h264_v_lpf_luma_8_lasx
void ff_h264_v_lpf_luma_8_lasx(uint8_t *data, ptrdiff_t img_width, int alpha_in, int beta_in, int8_t *tc)
Definition: h264dsp_lasx.c:244
ff_h264_idct_add8_8_lsx
void ff_h264_idct_add8_8_lsx(uint8_t **dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_loongarch.c:93
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:112
ff_h264_v_lpf_chroma_intra_8_lsx
void ff_h264_v_lpf_chroma_intra_8_lsx(uint8_t *src, ptrdiff_t stride, int alpha, int beta)
ff_h264_add_pixels4_8_lasx
void ff_h264_add_pixels4_8_lasx(uint8_t *_dst, int16_t *_src, int stride)
Definition: h264dsp_lasx.c:702
alpha
static const int16_t alpha[]
Definition: ilbcdata.h:55
ff_h264_h_lpf_luma_8_lasx
void ff_h264_h_lpf_luma_8_lasx(uint8_t *data, ptrdiff_t img_width, int alpha_in, int beta_in, int8_t *tc)
Definition: h264dsp_lasx.c:67
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
int32_t
int32_t
Definition: audioconvert.c:56
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
ff_h264_h_lpf_luma_intra_8_lsx
void ff_h264_h_lpf_luma_intra_8_lsx(uint8_t *src, ptrdiff_t stride, int alpha, int beta)
ff_biweight_h264_pixels4_8_lsx
void ff_biweight_h264_pixels4_8_lsx(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weight_dst, int weight_src, int offset)