]> git.sesse.net Git - ffmpeg/blob - libavcodec/mips/vp8dsp_init_mips.c
vc2enc: do not allocate packet until exact frame size is known
[ffmpeg] / libavcodec / mips / vp8dsp_init_mips.c
1 /*
2  * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com)
3  *
4  * This file is part of FFmpeg.
5  *
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.
10  *
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.
15  *
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
19  */
20
21 /**
22  * @file
23  * VP8 compatible video decoder
24  */
25
26 #include "config.h"
27 #include "libavutil/attributes.h"
28 #include "libavcodec/vp8dsp.h"
29 #include "vp8dsp_mips.h"
30
31 #define VP8_MC_MIPS_FUNC(IDX, SIZE)            \
32     dsp->put_vp8_epel_pixels_tab[IDX][0][1] =  \
33         ff_put_vp8_epel##SIZE##_h4_msa;        \
34     dsp->put_vp8_epel_pixels_tab[IDX][0][2] =  \
35         ff_put_vp8_epel##SIZE##_h6_msa;        \
36     dsp->put_vp8_epel_pixels_tab[IDX][1][0] =  \
37         ff_put_vp8_epel##SIZE##_v4_msa;        \
38     dsp->put_vp8_epel_pixels_tab[IDX][1][1] =  \
39         ff_put_vp8_epel##SIZE##_h4v4_msa;      \
40     dsp->put_vp8_epel_pixels_tab[IDX][1][2] =  \
41         ff_put_vp8_epel##SIZE##_h6v4_msa;      \
42     dsp->put_vp8_epel_pixels_tab[IDX][2][0] =  \
43         ff_put_vp8_epel##SIZE##_v6_msa;        \
44     dsp->put_vp8_epel_pixels_tab[IDX][2][1] =  \
45         ff_put_vp8_epel##SIZE##_h4v6_msa;      \
46     dsp->put_vp8_epel_pixels_tab[IDX][2][2] =  \
47         ff_put_vp8_epel##SIZE##_h6v6_msa
48
49 #define VP8_BILINEAR_MC_MIPS_FUNC(IDX, SIZE)       \
50     dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] =  \
51         ff_put_vp8_bilinear##SIZE##_h_msa;         \
52     dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] =  \
53         ff_put_vp8_bilinear##SIZE##_h_msa;         \
54     dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] =  \
55         ff_put_vp8_bilinear##SIZE##_v_msa;         \
56     dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] =  \
57         ff_put_vp8_bilinear##SIZE##_hv_msa;        \
58     dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] =  \
59         ff_put_vp8_bilinear##SIZE##_hv_msa;        \
60     dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] =  \
61         ff_put_vp8_bilinear##SIZE##_v_msa;         \
62     dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] =  \
63         ff_put_vp8_bilinear##SIZE##_hv_msa;        \
64     dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] =  \
65         ff_put_vp8_bilinear##SIZE##_hv_msa
66
67 #define VP8_MC_MIPS_COPY(IDX, SIZE)                \
68     dsp->put_vp8_epel_pixels_tab[IDX][0][0] =      \
69         ff_put_vp8_pixels##SIZE##_msa;             \
70     dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] =  \
71         ff_put_vp8_pixels##SIZE##_msa;
72
73 #if HAVE_MSA
74 static av_cold void vp8dsp_init_msa(VP8DSPContext *dsp)
75 {
76     dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_msa;
77     dsp->vp8_idct_add = ff_vp8_idct_add_msa;
78     dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_msa;
79     dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_msa;
80     dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_msa;
81
82     VP8_MC_MIPS_FUNC(0, 16);
83     VP8_MC_MIPS_FUNC(1, 8);
84     VP8_MC_MIPS_FUNC(2, 4);
85
86     VP8_BILINEAR_MC_MIPS_FUNC(0, 16);
87     VP8_BILINEAR_MC_MIPS_FUNC(1, 8);
88     VP8_BILINEAR_MC_MIPS_FUNC(2, 4);
89
90     VP8_MC_MIPS_COPY(0, 16);
91     VP8_MC_MIPS_COPY(1, 8);
92
93     dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_msa;
94     dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_msa;
95     dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_msa;
96     dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_msa;
97
98     dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_msa;
99     dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_msa;
100     dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_msa;
101     dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_msa;
102
103     dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_msa;
104     dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_msa;
105 }
106 #endif  // #if HAVE_MSA
107
108 av_cold void ff_vp8dsp_init_mips(VP8DSPContext *dsp)
109 {
110 #if HAVE_MSA
111     vp8dsp_init_msa(dsp);
112 #endif  // #if HAVE_MSA
113 }