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
176extern const uint8_t ff_qexp[QROOT];176extern const uint8_t ff_qexp[QROOT];
177extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];177extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
178 178
179/* C bits used by mmx/sse2/altivec */
180
181static 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
190static 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
197static 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
207static 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
217/* common code */179/* common code */
218 180
219int ff_snow_common_init(AVCodecContext *avctx);181int ff_snow_common_init(AVCodecContext *avctx);
libavcodec/snow_dwt.h+40−0
@@ -24,6 +24,8 @@ · 23 unmodified lines
24#include <stddef.h>24#include <stddef.h>
25#include <stdint.h>25#include <stdint.h>
26 26
27#include "libavutil/attributes.h"
28
27struct MpegEncContext;29struct MpegEncContext;
28 30
29typedef int DWTELEM;31typedef int DWTELEM;
@@ -91,6 +93,44 @@ typedef struct SnowDWTContext { · 61 unmodified lines
91 : ff_slice_buffer_load_line((slice_buf), \93 : ff_slice_buffer_load_line((slice_buf), \
92 (line_num)))94 (line_num)))
93 95
96/* C bits used by mmx/sse2/altivec */
97
98static 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
108static 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
116static 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
125static 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
94int ff_slice_buffer_init(slice_buffer *buf, int line_count,134int ff_slice_buffer_init(slice_buffer *buf, int line_count,
95 int max_allocated_lines, int line_width,135 int max_allocated_lines, int line_width,
96 IDWTELEM *base_buffer);136 IDWTELEM *base_buffer);
libavcodec/x86/snowdsp.c+0−1
@@ -24,7 +24,6 @@ · 23 unmodified lines
24#include "libavutil/attributes.h"24#include "libavutil/attributes.h"
25#include "libavutil/cpu.h"25#include "libavutil/cpu.h"
26#include "libavutil/x86/asm.h"26#include "libavutil/x86/asm.h"
27#include "libavcodec/snow.h"
28#include "libavcodec/snow_dwt.h"27#include "libavcodec/snow_dwt.h"
29 28
30#if HAVE_INLINE_ASM29#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