Unified · Split
| @@ -176,44 +176,6 @@ extern const uint8_t * const ff_obmc_tab[4]; · 175 unmodified lines | |||
| 176 | extern const uint8_t ff_qexp[QROOT]; | 176 | extern const uint8_t ff_qexp[QROOT]; |
| 177 | extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES]; | 177 | extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES]; |
| 178 | 178 | ||
| 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 | |||
| 217 | /* common code */ | 179 | /* common code */ |
| 218 | 180 | ||
| 219 | int ff_snow_common_init(AVCodecContext *avctx); | 181 | int ff_snow_common_init(AVCodecContext *avctx); |
| @@ -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 | |||
| 27 | struct MpegEncContext; | 29 | struct MpegEncContext; |
| 28 | 30 | ||
| 29 | typedef int DWTELEM; | 31 | typedef 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 | |||
| 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 | |||
| 94 | int ff_slice_buffer_init(slice_buffer *buf, int line_count, | 134 | int 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); |
| @@ -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_ASM | 29 | #if HAVE_INLINE_ASM |