FFmpeg
h264dsp_init_mips.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Parag Salasakar (Parag.Salasakar@imgtec.com)
3  * Copyright (c) 2015 Zhou Xiaoyong <zhouxiaoyong@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 
22 #include "libavutil/attributes.h"
23 #include "libavutil/mips/cpu.h"
24 #include "h264dsp_mips.h"
25 
27  const int chroma_format_idc)
28 {
30 
31  if (have_mmi(cpu_flags)) {
32  if (bit_depth == 8) {
33  c->h264_add_pixels4_clear = ff_h264_add_pixels4_8_mmi;
34  c->h264_idct_add = ff_h264_idct_add_8_mmi;
35  c->h264_idct8_add = ff_h264_idct8_add_8_mmi;
36  c->h264_idct_dc_add = ff_h264_idct_dc_add_8_mmi;
37  c->h264_idct8_dc_add = ff_h264_idct8_dc_add_8_mmi;
38  c->h264_idct_add16 = ff_h264_idct_add16_8_mmi;
39  c->h264_idct_add16intra = ff_h264_idct_add16intra_8_mmi;
40  c->h264_idct8_add4 = ff_h264_idct8_add4_8_mmi;
41 
42  if (chroma_format_idc <= 1)
43  c->h264_idct_add8 = ff_h264_idct_add8_8_mmi;
44  else
45  c->h264_idct_add8 = ff_h264_idct_add8_422_8_mmi;
46 
47  c->h264_luma_dc_dequant_idct = ff_h264_luma_dc_dequant_idct_8_mmi;
48 
49  c->weight_h264_pixels_tab[0] = ff_h264_weight_pixels16_8_mmi;
50  c->weight_h264_pixels_tab[1] = ff_h264_weight_pixels8_8_mmi;
51  c->weight_h264_pixels_tab[2] = ff_h264_weight_pixels4_8_mmi;
52 
53  c->biweight_h264_pixels_tab[0] = ff_h264_biweight_pixels16_8_mmi;
54  c->biweight_h264_pixels_tab[1] = ff_h264_biweight_pixels8_8_mmi;
55  c->biweight_h264_pixels_tab[2] = ff_h264_biweight_pixels4_8_mmi;
56 
57  c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_8_mmi;
58  c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_8_mmi;
59 
60  if (chroma_format_idc <= 1) {
61  c->h264_h_loop_filter_chroma =
63  c->h264_h_loop_filter_chroma_intra =
65  }
66 
67  c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_mmi;
68  c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_mmi;
69  c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_mmi;
70  c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_mmi;
71  }
72  }
73 
74  if (have_msa(cpu_flags)) {
75  if (chroma_format_idc <= 1)
76  c->h264_loop_filter_strength = ff_h264_loop_filter_strength_msa;
77  if (bit_depth == 8) {
78  c->h264_v_loop_filter_luma = ff_h264_v_lpf_luma_inter_msa;
79  c->h264_h_loop_filter_luma = ff_h264_h_lpf_luma_inter_msa;
80  c->h264_h_loop_filter_luma_mbaff =
82  c->h264_v_loop_filter_luma_intra = ff_h264_v_lpf_luma_intra_msa;
83  c->h264_h_loop_filter_luma_intra = ff_h264_h_lpf_luma_intra_msa;
84  c->h264_h_loop_filter_luma_mbaff_intra =
86  c->h264_v_loop_filter_chroma = ff_h264_v_lpf_chroma_inter_msa;
87 
88  if (chroma_format_idc <= 1)
89  c->h264_h_loop_filter_chroma = ff_h264_h_lpf_chroma_inter_msa;
90  else
91  c->h264_h_loop_filter_chroma =
93 
94  if (chroma_format_idc > 1)
95  c->h264_h_loop_filter_chroma_mbaff =
97 
98  c->h264_v_loop_filter_chroma_intra =
100 
101  if (chroma_format_idc <= 1)
102  c->h264_h_loop_filter_chroma_intra =
104 
105  /* Weighted MC */
106  c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels16_8_msa;
107  c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels8_8_msa;
108  c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels4_8_msa;
109 
110  c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels16_8_msa;
111  c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels8_8_msa;
112  c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels4_8_msa;
113 
114  c->h264_idct_add = ff_h264_idct_add_msa;
115  c->h264_idct8_add = ff_h264_idct8_addblk_msa;
116  c->h264_idct_dc_add = ff_h264_idct4x4_addblk_dc_msa;
117  c->h264_idct8_dc_add = ff_h264_idct8_dc_addblk_msa;
118  c->h264_idct_add16 = ff_h264_idct_add16_msa;
119  c->h264_idct8_add4 = ff_h264_idct8_add4_msa;
120 
121  if (chroma_format_idc <= 1)
122  c->h264_idct_add8 = ff_h264_idct_add8_msa;
123  else
124  c->h264_idct_add8 = ff_h264_idct_add8_422_msa;
125 
126  c->h264_idct_add16intra = ff_h264_idct_add16_intra_msa;
127  c->h264_luma_dc_dequant_idct = ff_h264_deq_idct_luma_dc_msa;
128  }
129  }
130 }
ff_h264_weight_pixels8_8_mmi
void ff_h264_weight_pixels8_8_mmi(uint8_t *block, ptrdiff_t stride, int height, int log2_denom, int weight, int offset)
Definition: h264dsp_mmi.c:1214
ff_h264_idct_add8_422_msa
void ff_h264_idct_add8_422_msa(uint8_t **dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nnzc[15 *8])
Definition: h264idct_msa.c:413
ff_h264_v_lpf_luma_inter_msa
void ff_h264_v_lpf_luma_inter_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
Definition: h264dsp_msa.c:2079
ff_h264_idct_add_8_mmi
void ff_h264_idct_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
Definition: h264dsp_mmi.c:79
have_mmi
#define have_mmi(flags)
Definition: cpu.h:25
ff_h264_h_loop_filter_luma_mbaff_msa
void ff_h264_h_loop_filter_luma_mbaff_msa(uint8_t *src, ptrdiff_t stride, int32_t alpha, int32_t beta, int8_t *tc0)
Definition: h264dsp_msa.c:2195
ff_biweight_h264_pixels8_8_msa
void ff_biweight_h264_pixels8_8_msa(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weightd, int weights, int offset)
Definition: h264dsp_msa.c:2445
ff_h264_biweight_pixels8_8_mmi
void ff_h264_biweight_pixels8_8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weightd, int weights, int offset)
Definition: h264dsp_mmi.c:1257
ff_h264dsp_init_mips
av_cold void ff_h264dsp_init_mips(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
Definition: h264dsp_init_mips.c:26
ff_biweight_h264_pixels16_8_msa
void ff_biweight_h264_pixels16_8_msa(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weightd, int weights, int offset)
Definition: h264dsp_msa.c:2336
ff_deblock_v_luma_intra_8_mmi
void ff_deblock_v_luma_intra_8_mmi(uint8_t *pix, ptrdiff_t stride, int alpha, int beta)
Definition: h264dsp_mmi.c:2189
ff_weight_h264_pixels8_8_msa
void ff_weight_h264_pixels8_8_msa(uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weight, int offset)
Definition: h264dsp_msa.c:2310
ff_h264_idct4x4_addblk_dc_msa
void ff_h264_idct4x4_addblk_dc_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:319
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:109
ff_h264_h_loop_filter_luma_mbaff_intra_msa
void ff_h264_h_loop_filter_luma_mbaff_intra_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta)
ff_h264_biweight_pixels16_8_mmi
void ff_h264_biweight_pixels16_8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weightd, int weights, int offset)
Definition: h264dsp_mmi.c:1143
bit_depth
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
Definition: af_astats.c:246
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:56
ff_h264_h_loop_filter_chroma422_mbaff_msa
void ff_h264_h_loop_filter_chroma422_mbaff_msa(uint8_t *src, ptrdiff_t stride, int32_t alpha, int32_t beta, int8_t *tc0)
Definition: h264dsp_msa.c:2186
ff_deblock_h_chroma_intra_8_mmi
void ff_deblock_h_chroma_intra_8_mmi(uint8_t *pix, ptrdiff_t stride, int alpha, int beta)
Definition: h264dsp_mmi.c:2047
ff_h264_luma_dc_dequant_idct_8_mmi
void ff_h264_luma_dc_dequant_idct_8_mmi(int16_t *output, int16_t *input, int qmul)
Definition: h264dsp_mmi.c:860
ff_h264_v_lpf_chroma_inter_msa
void ff_h264_v_lpf_chroma_inter_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
Definition: h264dsp_msa.c:2124
ff_h264_h_lpf_luma_inter_msa
void ff_h264_h_lpf_luma_inter_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
Definition: h264dsp_msa.c:2056
ff_h264_deq_idct_luma_dc_msa
void ff_h264_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src, int32_t de_q_val)
Definition: h264idct_msa.c:466
ff_deblock_h_luma_intra_8_mmi
void ff_deblock_h_luma_intra_8_mmi(uint8_t *pix, ptrdiff_t stride, int alpha, int beta)
Definition: h264dsp_mmi.c:2415
av_cold
#define av_cold
Definition: attributes.h:90
ff_h264_idct8_dc_add_8_mmi
void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
Definition: h264dsp_mmi.c:683
ff_h264_h_lpf_chroma_inter_msa
void ff_h264_h_lpf_chroma_inter_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
Definition: h264dsp_msa.c:2102
ff_h264_weight_pixels16_8_mmi
void ff_h264_weight_pixels16_8_mmi(uint8_t *block, ptrdiff_t stride, int height, int log2_denom, int weight, int offset)
Definition: h264dsp_mmi.c:1087
ff_h264_biweight_pixels4_8_mmi
void ff_h264_biweight_pixels4_8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weightd, int weights, int offset)
Definition: h264dsp_mmi.c:1347
ff_h264_idct_add8_msa
void ff_h264_idct_add8_msa(uint8_t **dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nnzc[15 *8])
Definition: h264idct_msa.c:392
ff_h264_idct8_dc_addblk_msa
void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:341
have_msa
#define have_msa(flags)
Definition: cpu.h:26
ff_h264_idct8_add4_msa
void ff_h264_idct8_add4_msa(uint8_t *dst, const int *blk_offset, int16_t *blk, int dst_stride, const uint8_t nnzc[5 *8])
ff_deblock_v_chroma_intra_8_mmi
void ff_deblock_v_chroma_intra_8_mmi(uint8_t *pix, ptrdiff_t stride, int alpha, int beta)
Definition: h264dsp_mmi.c:1829
ff_h264_idct_add16_intra_msa
void ff_h264_idct_add16_intra_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nnzc[5 *8])
Definition: h264idct_msa.c:447
ff_h264_weight_pixels4_8_mmi
void ff_h264_weight_pixels4_8_mmi(uint8_t *block, ptrdiff_t stride, int height, int log2_denom, int weight, int offset)
Definition: h264dsp_mmi.c:1309
h264dsp_mips.h
ff_h264_idct8_add_8_mmi
void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
Definition: h264dsp_mmi.c:171
ff_h264_idct_add_msa
void ff_h264_idct_add_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:272
ff_deblock_v_luma_8_mmi
void ff_deblock_v_luma_8_mmi(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
Definition: h264dsp_mmi.c:2180
ff_weight_h264_pixels16_8_msa
void ff_weight_h264_pixels16_8_msa(uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weight, int offset)
Definition: h264dsp_msa.c:2212
ff_h264_h_lpf_chroma_intra_msa
void ff_h264_h_lpf_chroma_intra_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta)
Definition: h264dsp_msa.c:2162
ff_h264_idct_add16_8_mmi
void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[5 *8])
Definition: h264dsp_mmi.c:768
ff_h264_idct8_add4_8_mmi
void ff_h264_idct8_add4_8_mmi(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[5 *8])
Definition: h264dsp_mmi.c:799
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
H264DSPContext
Context for storing H.264 DSP functions.
Definition: h264dsp.h:42
ff_deblock_v_chroma_8_mmi
void ff_deblock_v_chroma_8_mmi(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
Definition: h264dsp_mmi.c:1745
ff_biweight_h264_pixels4_8_msa
void ff_biweight_h264_pixels4_8_msa(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weightd, int weights, int offset)
Definition: h264dsp_msa.c:2462
ff_h264_h_loop_filter_chroma422_msa
void ff_h264_h_loop_filter_chroma422_msa(uint8_t *src, ptrdiff_t stride, int32_t alpha, int32_t beta, int8_t *tc0)
Definition: h264dsp_msa.c:2178
attributes.h
ff_h264_add_pixels4_8_mmi
void ff_h264_add_pixels4_8_mmi(uint8_t *_dst, int16_t *_src, int stride)
Definition: h264dsp_mmi.c:31
ff_h264_idct_add8_422_8_mmi
void ff_h264_idct_add8_422_8_mmi(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
Definition: h264dsp_mmi.c:832
ff_h264_idct8_addblk_msa
void ff_h264_idct8_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:313
ff_weight_h264_pixels4_8_msa
void ff_weight_h264_pixels4_8_msa(uint8_t *src, ptrdiff_t stride, int height, int log2_denom, int weight, int offset)
Definition: h264dsp_msa.c:2323
ff_h264_v_lpf_luma_intra_msa
void ff_h264_v_lpf_luma_intra_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta)
Definition: h264dsp_msa.c:2154
ff_h264_idct_dc_add_8_mmi
void ff_h264_idct_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride)
Definition: h264dsp_mmi.c:639
ff_h264_loop_filter_strength_msa
void ff_h264_loop_filter_strength_msa(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_msa.c:119
ff_h264_v_lpf_chroma_intra_msa
void ff_h264_v_lpf_chroma_intra_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta)
Definition: h264dsp_msa.c:2170
ff_deblock_h_chroma_8_mmi
void ff_deblock_h_chroma_8_mmi(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
Definition: h264dsp_mmi.c:1907
ff_h264_h_lpf_luma_intra_msa
void ff_h264_h_lpf_luma_intra_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta)
Definition: h264dsp_msa.c:2146
ff_h264_idct_add16_msa
void ff_h264_idct_add16_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t stride, const uint8_t nnzc[5 *8])
Definition: h264idct_msa.c:347
ff_deblock_h_luma_8_mmi
void ff_deblock_h_luma_8_mmi(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0)
Definition: h264dsp_mmi.c:2196
ff_h264_idct_add16intra_8_mmi
void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[5 *8])
Definition: h264dsp_mmi.c:786
ff_h264_idct_add8_8_mmi
void ff_h264_idct_add8_8_mmi(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15 *8])
Definition: h264dsp_mmi.c:816
cpu.h