History

avcodec/snow: Move dsp helper functions to snow_dwt.h

Andreas Rheinhardt committed 3 years ago

Commit f52b4a61 parent 155e7e13 files · +40 −39Browse files

Unified · Split

3 files
  1. libavcodec/snow.h +0 −38
  2. libavcodec/snow_dwt.h +40 −0
  3. libavcodec/x86/snowdsp.c +0 −1
libavcodec/snow.h+0−38
@@ -176,44 +176,6 @@ extern const uint8_t * const ff_obmc_tab[4]; · 175 unmodified lines
176176 extern const uint8_t ff_qexp[QROOT];
177177 extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
178178
179−/* C bits used by mmx/sse2/altivec */
180−
181−static av_always_inline void snow_interleave_line_header(int * i, int width, IDWTELEM * low, IDWTELEM * high){
182− (*i) = (width) - 2;
183−
184− if (width & 1){
185− low[(*i)+1] = low[((*i)+1)>>1];
186− (*i)--;
187− }
188−}
189−
190−static av_always_inline void snow_interleave_line_footer(int * i, IDWTELEM * low, IDWTELEM * high){
191− for (; (*i)>=0; (*i)-=2){
192− low[(*i)+1] = high[(*i)>>1];
193− low[*i] = low[(*i)>>1];
194− }
195−}
196−
197−static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){
198− for(; i<w; i++){
199− dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
200− }
201−
202− if((width^lift_high)&1){
203− dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
204− }
205−}
206−
207−static av_always_inline void snow_horizontal_compose_liftS_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w){
208− for(; i<w; i++){
209− dst[i] = src[i] + ((ref[i] + ref[(i+1)]+W_BO + 4 * src[i]) >> W_BS);
210− }
211−
212− if(width&1){
213− dst[w] = src[w] + ((2 * ref[w] + W_BO + 4 * src[w]) >> W_BS);
214− }
215−}
216−
217179 /* common code */
218180
219181 int ff_snow_common_init(AVCodecContext *avctx);
libavcodec/snow_dwt.h+40−0
@@ -24,6 +24,8 @@ · 23 unmodified lines
2424 #include <stddef.h>
2525 #include <stdint.h>
2626
27+#include "libavutil/attributes.h"
28+
2729 struct MpegEncContext;
2830
2931 typedef int DWTELEM;
@@ -91,6 +93,44 @@ typedef struct SnowDWTContext { · 61 unmodified lines
9193 : ff_slice_buffer_load_line((slice_buf), \
9294 (line_num)))
9395
96+/* C bits used by mmx/sse2/altivec */
97+
98+static av_always_inline void snow_interleave_line_header(int *i, int width, IDWTELEM *low, IDWTELEM *high)
99+{
100+ *i = width - 2;
101+
102+ if (width & 1) {
103+ low[*i + 1] = low[(*i + 1)>>1];
104+ (*i)--;
105+ }
106+}
107+
108+static av_always_inline void snow_interleave_line_footer(int *i, IDWTELEM *low, const IDWTELEM *high)
109+{
110+ for (; *i >= 0; *i -= 2) {
111+ low[*i + 1] = high[*i >> 1];
112+ low[*i] = low[*i >> 1];
113+ }
114+}
115+
116+static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, IDWTELEM *dst, const IDWTELEM *src, const IDWTELEM *ref, int width, int w, int lift_high, int mul, int add, int shift)
117+{
118+ for (; i < w; i++)
119+ dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
120+
121+ if ((width ^ lift_high) & 1)
122+ dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
123+}
124+
125+static av_always_inline void snow_horizontal_compose_liftS_lead_out(int i, IDWTELEM *dst, const IDWTELEM *src, const IDWTELEM *ref, int width, int w)
126+{
127+ for (; i < w; i++)
128+ dst[i] = src[i] + ((ref[i] + ref[(i+1)]+W_BO + 4 * src[i]) >> W_BS);
129+
130+ if (width & 1)
131+ dst[w] = src[w] + ((2 * ref[w] + W_BO + 4 * src[w]) >> W_BS);
132+}
133+
94134 int ff_slice_buffer_init(slice_buffer *buf, int line_count,
95135 int max_allocated_lines, int line_width,
96136 IDWTELEM *base_buffer);
libavcodec/x86/snowdsp.c+0−1
@@ -24,7 +24,6 @@ · 23 unmodified lines
2424 #include "libavutil/attributes.h"
2525 #include "libavutil/cpu.h"
2626 #include "libavutil/x86/asm.h"
27−#include "libavcodec/snow.h"
2827 #include "libavcodec/snow_dwt.h"
2928
3029 #if HAVE_INLINE_ASM

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t