36 #define IdctAdjustBeforeShift 8
45 #define M(a, b) ((int)((SUINT)(a) * (b)) >> 16)
48 int16_t *input,
int type)
52 int A,
B,
C,
D, Ad, Bd, Cd, Dd,
E,
F,
G,
H;
53 int Ed, Gd, Add, Bdd, Fd, Hd;
58 for (
i = 0;
i < 8;
i++) {
60 if (ip[0 * 8] | ip[1 * 8] | ip[2 * 8] | ip[3 * 8] |
61 ip[4 * 8] | ip[5 * 8] | ip[6 * 8] | ip[7 * 8]) {
73 E =
M(
xC4S4, (ip[0 * 8] + ip[4 * 8]));
74 F =
M(
xC4S4, (ip[0 * 8] - ip[4 * 8]));
107 for (
i = 0;
i < 8;
i++) {
109 if (ip[1] | ip[2] | ip[3] |
110 ip[4] | ip[5] | ip[6] | ip[7]) {
122 E =
M(
xC4S4, (ip[0] + ip[4])) + 8;
123 F =
M(
xC4S4, (ip[0] - ip[4])) + 8;
180 int v = (
xC4S4 * ip[0] + (IdctAdjustBeforeShift << 16)) >> 20;
199 int16_t *input,
int type)
203 int A,
B,
C,
D, Ad, Bd, Cd, Dd,
E,
F,
G,
H;
204 int Ed, Gd, Add, Bdd, Fd, Hd;
209 for (
i = 0;
i < 4;
i++) {
211 if (ip[0 * 8] | ip[1 * 8] | ip[2 * 8] | ip[3 * 8]) {
242 ip[1 * 8] = Add + Hd;
243 ip[2 * 8] = Add - Hd;
248 ip[5 * 8] = Fd + Bdd;
249 ip[6 * 8] = Fd - Bdd;
258 for (
i = 0;
i < 8;
i++) {
260 if (ip[0] | ip[1] | ip[2] | ip[3]) {
369 for (
i = 0;
i < 8;
i++) {
384 int *bounding_values,
int count)
388 const ptrdiff_t nstride = -
stride;
390 for (end = first_pixel + count; first_pixel < end; first_pixel++) {
392 (first_pixel[0] - first_pixel[nstride]) * 3;
401 int *bounding_values,
int count)
406 for (end = first_pixel + count *
stride; first_pixel != end; first_pixel +=
stride) {
408 (first_pixel[ 0] - first_pixel[-1]) * 3;
416 #define LOOP_FILTER(prefix, suffix, dim, count) \
417 void prefix##_##dim##_loop_filter_##count##suffix(uint8_t *first_pixel, ptrdiff_t stride, \
418 int *bounding_values) \
420 vp3_##dim##_loop_filter_c(first_pixel, stride, bounding_values, count); \
433 for (
i = 0;
i <
h;
i++) {
447 c->put_no_rnd_pixels_l2 = put_no_rnd_pixels_l2;
452 c->v_loop_filter =
c->v_loop_filter_unaligned = vp3_v_loop_filter_8_c;
453 c->h_loop_filter =
c->h_loop_filter_unaligned = vp3_h_loop_filter_8_c;
475 int *bounding_values = bounding_values_array + 127;
482 memset(bounding_values_array, 0, 256 *
sizeof(
int));
483 for (x = 0; x < filter_limit; x++) {
484 bounding_values[-x] = -x;
485 bounding_values[x] = x;
488 bounding_values[ x] =
value;
489 bounding_values[-x] = -
value;
492 bounding_values[128] =
value;
493 bounding_values[129] = bounding_values[130] = filter_limit * 0x02020202U;
Macro definitions for various function/variable attributes.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> dc
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define flags(name, subs,...)
common internal and external API header
static int filter_value(int in, int rrp[8], int v[9])
static uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
static void vp3_idct_dc_add_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
static void vp3_idct_put_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
static av_always_inline void vp3_h_loop_filter_c(uint8_t *first_pixel, ptrdiff_t stride, int *bounding_values, int count)
static av_always_inline void idct(uint8_t *dst, ptrdiff_t stride, int16_t *input, int type)
static av_always_inline void idct10(uint8_t *dst, ptrdiff_t stride, int16_t *input, int type)
void ff_vp3dsp_set_bounding_values(int *bounding_values_array, int filter_limit)
static av_always_inline void vp3_v_loop_filter_c(uint8_t *first_pixel, ptrdiff_t stride, int *bounding_values, int count)
static void vp3_idct_add_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
#define IdctAdjustBeforeShift
void ff_vp3dsp_idct10_put(uint8_t *dest, ptrdiff_t stride, int16_t *block)
void ff_vp3dsp_idct10_add(uint8_t *dest, ptrdiff_t stride, int16_t *block)
#define LOOP_FILTER(prefix, suffix, dim, count)
av_cold void ff_vp3dsp_init(VP3DSPContext *c, int flags)
void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
av_cold void ff_vp3dsp_init_ppc(VP3DSPContext *c, int flags)
av_cold void ff_vp3dsp_init_arm(VP3DSPContext *c, int flags)
av_cold void ff_vp3dsp_init_mips(VP3DSPContext *c, int flags)