37 int32_t p0, p1, p2, p3, tmp0, tmp1, tmp2;
38 int32_t b0_1, b0_2, b1_1, b1_2, b1_3, b2_1, b2_2, b2_3, b2_4, b2_5, b2_6;
39 int32_t b3_1, b3_2, b3_3, b3_4, b3_5, b3_6, b3_7, b3_8, b3_9;
41 const short *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
42 const int num_bands = 4;
56 for (y = 0; y < plane->
height; y += 2) {
67 b1_1 = b1_ptr[back_pitch];
69 b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch];
80 b3_2 = b3_ptr[back_pitch];
84 b3_8 = b3_2 - b3_5*6 + b3_ptr[pitch];
88 for (x = 0, indx = 0; x < plane->
width; x+=2, indx++) {
89 if (x+2 >= plane->
width) {
109 p0 = p1 = p2 = p3 = 0;
115 b0_1 = b0_ptr[indx+1];
116 b0_2 = b0_ptr[pitch+indx+1];
121 p2 = (tmp0 + tmp2) << 3;
122 p3 = (tmp1 + tmp2 + b0_2) << 2;
129 b1_2 = b1_ptr[indx+1];
130 b1_1 = b1_ptr[back_pitch+indx+1];
132 tmp2 = tmp1 - tmp0*6 + b1_3;
133 b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch+indx+1];
135 p0 += (tmp0 + tmp1) << 3;
136 p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2;
138 p3 += (tmp2 + b1_3) << 1;
143 b2_3 = b2_ptr[indx+1];
144 b2_6 = b2_ptr[pitch+indx+1];
147 tmp1 = b2_1 - b2_2*6 + b2_3;
151 p2 += (tmp0 + b2_4 + b2_5) << 2;
152 p3 += (tmp1 + b2_4 - b2_5*6 + b2_6) << 1;
157 b3_6 = b3_ptr[indx+1];
158 b3_3 = b3_ptr[back_pitch+indx+1];
164 b3_9 = b3_3 - b3_6*6 + b3_ptr[pitch+indx+1];
166 p0 += (tmp0 + tmp1) << 2;
167 p1 += (tmp0 - tmp1*6 + tmp2) << 1;
168 p2 += (b3_7 + b3_8) << 1;
169 p3 += b3_7 - b3_8*6 + b3_9;
173 dst[
x] = av_clip_uint8((p0 >> 6) + 128);
174 dst[x+1] = av_clip_uint8((p1 >> 6) + 128);
175 dst[dst_pitch+
x] = av_clip_uint8((p2 >> 6) + 128);
176 dst[dst_pitch+x+1] = av_clip_uint8((p3 >> 6) + 128);
179 dst += dst_pitch << 1;
193 int x,
y, indx, b0, b1, b2, b3, p0, p1, p2, p3;
194 const short *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
206 for (y = 0; y < plane->
height; y += 2) {
207 for (x = 0, indx = 0; x < plane->
width; x += 2, indx++) {
215 p0 = (b0 + b1 + b2 + b3 + 2) >> 2;
216 p1 = (b0 + b1 - b2 - b3 + 2) >> 2;
217 p2 = (b0 - b1 + b2 - b3 + 2) >> 2;
218 p3 = (b0 - b1 - b2 + b3 + 2) >> 2;
221 dst[
x] = av_clip_uint8(p0 + 128);
222 dst[x + 1] = av_clip_uint8(p1 + 128);
223 dst[dst_pitch +
x] = av_clip_uint8(p2 + 128);
224 dst[dst_pitch + x + 1] = av_clip_uint8(p3 + 128);
227 dst += dst_pitch << 1;
237 #define IVI_HAAR_BFLY(s1, s2, o1, o2, t) \ 239 o1 = (s1 + s2) >> 1;\ 243 #define INV_HAAR8(s1, s5, s3, s7, s2, s4, s6, s8,\ 244 d1, d2, d3, d4, d5, d6, d7, d8,\ 245 t0, t1, t2, t3, t4, t5, t6, t7, t8) {\ 246 t1 = s1 << 1; t5 = s5 << 1;\ 247 IVI_HAAR_BFLY(t1, t5, t1, t5, t0); IVI_HAAR_BFLY(t1, s3, t1, t3, t0);\ 248 IVI_HAAR_BFLY(t5, s7, t5, t7, t0); IVI_HAAR_BFLY(t1, s2, t1, t2, t0);\ 249 IVI_HAAR_BFLY(t3, s4, t3, t4, t0); IVI_HAAR_BFLY(t5, s6, t5, t6, t0);\ 250 IVI_HAAR_BFLY(t7, s8, t7, t8, t0);\ 251 d1 = COMPENSATE(t1);\ 252 d2 = COMPENSATE(t2);\ 253 d3 = COMPENSATE(t3);\ 254 d4 = COMPENSATE(t4);\ 255 d5 = COMPENSATE(t5);\ 256 d6 = COMPENSATE(t6);\ 257 d7 = COMPENSATE(t7);\ 258 d8 = COMPENSATE(t8); } 261 #define INV_HAAR4(s1, s3, s5, s7) {\ 262 HAAR_BFLY(s1, s5); HAAR_BFLY(s1, s3); HAAR_BFLY(s5, s7);\ 263 s1 = COMPENSATE(s1);\ 264 s3 = COMPENSATE(s3);\ 265 s5 = COMPENSATE(s5);\ 266 s7 = COMPENSATE(s7); } 271 int i,
shift, sp1, sp2, sp3, sp4;
278 #define COMPENSATE(x) (x) 281 for (i = 0; i < 8; i++) {
285 sp1 = src[ 0] <<
shift;
286 sp2 = src[ 8] <<
shift;
287 sp3 = src[16] <<
shift;
288 sp4 = src[24] <<
shift;
290 src[32], src[40], src[48], src[56],
291 dst[ 0], dst[ 8], dst[16], dst[24],
292 dst[32], dst[40], dst[48], dst[56],
293 t0, t1, t2, t3, t4, t5, t6, t7, t8);
295 dst[ 0] = dst[ 8] = dst[16] = dst[24] =
296 dst[32] = dst[40] = dst[48] = dst[56] = 0;
304 #define COMPENSATE(x) (x) 306 for (i = 0; i < 8; i++) {
307 if ( !src[0] && !src[1] && !src[2] && !src[3]
308 && !src[4] && !src[5] && !src[6] && !src[7]) {
309 memset(out, 0, 8 *
sizeof(out[0]));
311 INV_HAAR8(src[0], src[1], src[2], src[3],
312 src[4], src[5], src[6], src[7],
313 out[0], out[1], out[2], out[3],
314 out[4], out[5], out[6], out[7],
315 t0, t1, t2, t3, t4, t5, t6, t7, t8);
329 dc_coeff = (*in + 0) >> 3;
331 for (y = 0; y < blk_size; out += pitch, y++) {
332 for (x = 0; x < blk_size; x++)
338 #define IVI_SLANT_BFLY(s1, s2, o1, o2, t) \ 344 #define IVI_IREFLECT(s1, s2, o1, o2, t) \ 345 t = ((s1 + s2*2 + 2) >> 2) + s1;\ 346 o2 = ((s1*2 - s2 + 2) >> 2) - s2;\ 350 #define IVI_SLANT_PART4(s1, s2, o1, o2, t) \ 351 t = s2 + ((s1*4 - s2 + 4) >> 3);\ 352 o2 = s1 + ((-s1 - s2*4 + 4) >> 3);\ 356 #define IVI_INV_SLANT8(s1, s4, s8, s5, s2, s6, s3, s7,\ 357 d1, d2, d3, d4, d5, d6, d7, d8,\ 358 t0, t1, t2, t3, t4, t5, t6, t7, t8) {\ 359 IVI_SLANT_PART4(s4, s5, t4, t5, t0);\ 361 IVI_SLANT_BFLY(s1, t5, t1, t5, t0); IVI_SLANT_BFLY(s2, s6, t2, t6, t0);\ 362 IVI_SLANT_BFLY(s7, s3, t7, t3, t0); IVI_SLANT_BFLY(t4, s8, t4, t8, t0);\ 364 IVI_SLANT_BFLY(t1, t2, t1, t2, t0); IVI_IREFLECT (t4, t3, t4, t3, t0);\ 365 IVI_SLANT_BFLY(t5, t6, t5, t6, t0); IVI_IREFLECT (t8, t7, t8, t7, t0);\ 366 IVI_SLANT_BFLY(t1, t4, t1, t4, t0); IVI_SLANT_BFLY(t2, t3, t2, t3, t0);\ 367 IVI_SLANT_BFLY(t5, t8, t5, t8, t0); IVI_SLANT_BFLY(t6, t7, t6, t7, t0);\ 368 d1 = COMPENSATE(t1);\ 369 d2 = COMPENSATE(t2);\ 370 d3 = COMPENSATE(t3);\ 371 d4 = COMPENSATE(t4);\ 372 d5 = COMPENSATE(t5);\ 373 d6 = COMPENSATE(t6);\ 374 d7 = COMPENSATE(t7);\ 375 d8 = COMPENSATE(t8);} 378 #define IVI_INV_SLANT4(s1, s4, s2, s3, d1, d2, d3, d4, t0, t1, t2, t3, t4) {\ 379 IVI_SLANT_BFLY(s1, s2, t1, t2, t0); IVI_IREFLECT (s4, s3, t4, t3, t0);\ 381 IVI_SLANT_BFLY(t1, t4, t1, t4, t0); IVI_SLANT_BFLY(t2, t3, t2, t3, t0);\ 382 d1 = COMPENSATE(t1);\ 383 d2 = COMPENSATE(t2);\ 384 d3 = COMPENSATE(t3);\ 385 d4 = COMPENSATE(t4);} 395 #define COMPENSATE(x) (x) 398 for (i = 0; i < 8; i++) {
400 IVI_INV_SLANT8(src[0], src[8], src[16], src[24], src[32], src[40], src[48], src[56],
401 dst[0], dst[8], dst[16], dst[24], dst[32], dst[40], dst[48], dst[56],
402 t0, t1, t2, t3, t4, t5, t6, t7, t8);
404 dst[0] = dst[8] = dst[16] = dst[24] = dst[32] = dst[40] = dst[48] = dst[56] = 0;
411 #define COMPENSATE(x) ((x + 1)>>1) 413 for (i = 0; i < 8; i++) {
414 if (!src[0] && !src[1] && !src[2] && !src[3] && !src[4] && !src[5] && !src[6] && !src[7]) {
415 memset(out, 0, 8*
sizeof(out[0]));
417 IVI_INV_SLANT8(src[0], src[1], src[2], src[3], src[4], src[5], src[6], src[7],
418 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
419 t0, t1, t2, t3, t4, t5, t6, t7, t8);
435 #define COMPENSATE(x) (x) 438 for (i = 0; i < 4; i++) {
441 dst[0], dst[4], dst[8], dst[12],
444 dst[0] = dst[4] = dst[8] = dst[12] = 0;
451 #define COMPENSATE(x) ((x + 1)>>1) 453 for (i = 0; i < 4; i++) {
454 if (!src[0] && !src[1] && !src[2] && !src[3]) {
455 out[0] = out[1] = out[2] = out[3] = 0;
458 out[0], out[1], out[2], out[3],
472 dc_coeff = (*in + 1) >> 1;
474 for (y = 0; y < blk_size; out += pitch, y++) {
475 for (x = 0; x < blk_size; x++)
485 #define COMPENSATE(x) ((x + 1)>>1) 486 for (i = 0; i < 8; i++) {
487 if (!in[0] && !in[1] && !in[2] && !in[3] && !in[4] && !in[5] && !in[6] && !in[7]) {
488 memset(out, 0, 8*
sizeof(out[0]));
490 IVI_INV_SLANT8( in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7],
491 out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
492 t0, t1, t2, t3, t4, t5, t6, t7, t8);
505 dc_coeff = (*in + 1) >> 1;
507 for (x = 0; x < blk_size; x++)
512 for (y = 1; y < blk_size; out += pitch, y++) {
513 for (x = 0; x < blk_size; x++)
520 int i, row2, row4, row8;
527 #define COMPENSATE(x) ((x + 1)>>1) 528 for (i = 0; i < 8; i++) {
530 IVI_INV_SLANT8(in[0], in[8], in[16], in[24], in[32], in[40], in[48], in[56],
531 out[0], out[pitch], out[row2], out[row2 + pitch], out[row4],
532 out[row4 + pitch], out[row4 + row2], out[row8 - pitch],
533 t0, t1, t2, t3, t4, t5, t6, t7, t8);
535 out[0] = out[pitch] = out[row2] = out[row2 + pitch] = out[row4] =
536 out[row4 + pitch] = out[row4 + row2] = out[row8 - pitch] = 0;
550 dc_coeff = (*in + 1) >> 1;
552 for (y = 0; y < blk_size; out += pitch, y++) {
554 for (x = 1; x < blk_size; x++)
564 for (y = 0; y < 8; out += pitch, in += 8, y++)
565 for (x = 0; x < 8; x++)
575 memset(out + 1, 0, 7*
sizeof(out[0]));
578 for (y = 1; y < 8; out += pitch, y++)
579 memset(out, 0, 8*
sizeof(out[0]));
582 #define IVI_MC_TEMPLATE(size, suffix, OP) \ 583 void ff_ivi_mc_ ## size ##x## size ## suffix (int16_t *buf, const int16_t *ref_buf, \ 584 uint32_t pitch, int mc_type) \ 587 const int16_t *wptr; \ 591 for (i = 0; i < size; i++, buf += pitch, ref_buf += pitch) { \ 592 for (j = 0; j < size; j++) {\ 593 OP(buf[j], ref_buf[j]); \ 598 for (i = 0; i < size; i++, buf += pitch, ref_buf += pitch) \ 599 for (j = 0; j < size; j++) \ 600 OP(buf[j], (ref_buf[j] + ref_buf[j+1]) >> 1); \ 603 wptr = ref_buf + pitch; \ 604 for (i = 0; i < size; i++, buf += pitch, wptr += pitch, ref_buf += pitch) \ 605 for (j = 0; j < size; j++) \ 606 OP(buf[j], (ref_buf[j] + wptr[j]) >> 1); \ 609 wptr = ref_buf + pitch; \ 610 for (i = 0; i < size; i++, buf += pitch, wptr += pitch, ref_buf += pitch) \ 611 for (j = 0; j < size; j++) \ 612 OP(buf[j], (ref_buf[j] + ref_buf[j+1] + wptr[j] + wptr[j+1]) >> 2); \ 617 #define OP_PUT(a, b) (a) = (b) 618 #define OP_ADD(a, b) (a) += (b) 622 IVI_MC_TEMPLATE(4, _no_delta,
OP_PUT)
623 IVI_MC_TEMPLATE(4, _delta,
OP_ADD)
static int shift(int a, int b)
void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only two-dimensional inverse Haar transform for Indeo 4.
void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
Copy the DC coefficient into the first pixel of the block and zero all others.
int16_t * buf
pointer to the output buffer for this band
DSP functions (inverse transforms, motion compensations, wavelet recompostion) for Indeo Video Intera...
About Git write you should know how to use GIT properly Luckily Git comes with excellent documentation git help man git shows you the available git< command > help man git< command > shows information about the subcommand< command > The most comprehensive manual is the website Git Reference visit they are quite exhaustive You do not need a special username or password All you need is to provide a ssh public key to the Git server admin What follows now is a basic introduction to Git and some FFmpeg specific guidelines Read it at least if you are granted commit privileges to the FFmpeg project you are expected to be familiar with these rules I if not You can get git from etc no matter how small Every one of them has been saved from looking like a fool by this many times It s very easy for stray debug output or cosmetic modifications to slip in
void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
Copy the pixels into the frame buffer.
#define IVI_INV_SLANT4(s1, s4, s2, s3, d1, d2, d3, d4, t0, t1, t2, t3, t4)
inverse slant4 transform
int pitch
pitch associated with the buffers above
void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
inverse 1D row slant transform
void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only inverse row slant transform.
void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse Haar 8x8 transform for Indeo 4
This file contains structures and macros shared by both Indeo4 and Indeo5 decoders.
void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only inverse column slant transform.
#define IVI_MC_TEMPLATE(size, suffix, OP)
#define IVI_INV_SLANT8(s1, s4, s8, s5, s2, s6, s3, s7, d1, d2, d3, d4, d5, d6, d7, d8, t0, t1, t2, t3, t4, t5, t6, t7, t8)
inverse slant8 transform
void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse slant 8x8 transform
void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst, const int dst_pitch)
Haar wavelet recomposition filter for Indeo 4.
synthesis window for stochastic i
IVIBandDesc * bands
array of band descriptors
#define INV_HAAR8(s1, s5, s3, s7, s2, s4, s6, s8, d1, d2, d3, d4, d5, d6, d7, d8, t0, t1, t2, t3, t4, t5, t6, t7, t8)
inverse 8-point Haar transform
void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
two-dimensional inverse slant 4x4 transform
else dst[i][x+y *dst_stride[i]]
void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
DC-only two-dimensional inverse slant transform.
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=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);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_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_dlog(ac->avr,"%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-> out
color plane (luma or chroma) information
void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst, const int dst_pitch)
5/3 wavelet recomposition filter for Indeo5
void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
inverse 1D column slant transform