# HG changeset patch # User Torsten Jager # Date 1675683905 -3600 # Mon Feb 06 12:45:05 2023 +0100 # Node ID 6f1000084f6084f49c95c202d12593e49916f58b # Parent 0a786d63bbdb2d780a9231f6772e84e743c72014 Try to silence some cast align warnings 5. diff -r 0a786d63bbdb -r 6f1000084f60 src/combined/ffmpeg/ff_audio_decoder.c --- a/src/combined/ffmpeg/ff_audio_decoder.c Mon Feb 06 12:45:00 2023 +0100 +++ b/src/combined/ffmpeg/ff_audio_decoder.c Mon Feb 06 12:45:05 2023 +0100 @@ -796,7 +796,7 @@ #define CLIP_16(v) ((v + 0x8000) & ~0xffff ? (v >> 31) ^ 0x7fff : v) static int ff_audio_decode (ff_audio_decoder_t *this) { - int16_t *decode_buffer = (int16_t *)this->send.buf; + int16_t *decode_buffer = (int16_t *)ASSUME_ALIGNED_2 (this->send.buf, 2); int consumed, got_frame = 0; #if XFF_AUDIO >= 4 float gain = this->class->gain; @@ -871,13 +871,13 @@ const stype *p1, *p2, *p3, *p4;\ int i, sstep;\ int8_t *x = idx;\ - int16_t *dptr = (int16_t *)decode_buffer + dindx;\ + int16_t *dptr = decode_buffer + dindx;\ if (planar) {\ - p1 = (stype *)this->av_frame->extended_data[x[0]];\ + p1 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[x[0]], sizeof (stype));\ if (!p1) break;\ sstep = 1;\ } else {\ - p1 = (stype *)this->av_frame->extended_data[0];\ + p1 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[0], sizeof (stype));\ if (!p1) break;\ p1 += x[0];\ sstep = this->ff_channels;\ @@ -893,10 +893,10 @@ break;\ }\ if (planar) {\ - p2 = (stype *)this->av_frame->extended_data[x[1]];\ + p2 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[x[1]], sizeof (stype));\ if (!p2) break;\ } else\ - p2 = (stype *)this->av_frame->extended_data[0] + x[1];\ + p2 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[0], sizeof (stype)) + x[1];\ if (num == 2) {\ for (i = 0; i < samples; i++) {\ int32_t v = MIX_FIX(*p2);\ @@ -911,10 +911,10 @@ break;\ }\ if (planar) {\ - p3 = (stype *)this->av_frame->extended_data[x[2]];\ + p3 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[x[2]], sizeof (stype));\ if (!p3) break;\ } else\ - p3 = (stype *)this->av_frame->extended_data[0] + x[2];\ + p3 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[0], sizeof (stype)) + x[2];\ if (num == 3) {\ for (i = 0; i < samples; i++) {\ int32_t v = MIX_FIX(*p2);\ @@ -931,10 +931,10 @@ break;\ }\ if (planar) {\ - p4 = (stype *)this->av_frame->extended_data[x[3]];\ + p4 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[x[3]], sizeof (stype));\ if (!p4) break;\ } else\ - p4 = (stype *)this->av_frame->extended_data[0] + x[3];\ + p4 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[0], sizeof (stype)) + x[3];\ for (i = 0; i < samples; i++) {\ int32_t v = MIX_FIX(*p2);\ p2 += sstep;\ @@ -1003,13 +1003,13 @@ int i, sstep;\ float gain3;\ int8_t *x = idx;\ - int16_t *dptr = (int16_t *)decode_buffer + dindx;\ + int16_t *dptr = decode_buffer + dindx;\ if (planar) {\ - p1 = (stype *)this->av_frame->extended_data[x[0]];\ + p1 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[x[0]], sizeof (stype));\ if (!p1) break;\ sstep = 1;\ } else {\ - p1 = (stype *)this->av_frame->extended_data[0];\ + p1 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[0], sizeof (stype));\ if (!p1) break;\ p1 += x[0];\ sstep = this->ff_channels;\ @@ -1025,10 +1025,10 @@ }\ gain3 = gain * 0.7071;\ if (planar) {\ - p2 = (stype *)this->av_frame->extended_data[x[1]];\ + p2 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[x[1]], sizeof (stype));\ if (!p2) break;\ } else\ - p2 = (stype *)this->av_frame->extended_data[0] + x[1];\ + p2 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[0], sizeof (stype)) + x[1];\ if (num == 2) {\ for (i = 0; i < samples; i++) {\ int32_t v = (*p1) * gain + (*p2) * gain3;\ @@ -1040,10 +1040,10 @@ break;\ }\ if (planar) {\ - p3 = (stype *)this->av_frame->extended_data[x[2]];\ + p3 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[x[2]], sizeof (stype));\ if (!p3) break;\ } else\ - p3 = (stype *)this->av_frame->extended_data[0] + x[2];\ + p3 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[0], sizeof (stype)) + x[2];\ if (num == 3) {\ for (i = 0; i < samples; i++) {\ int32_t v = (*p1) * gain + (*p2 + *p3) * gain3;\ @@ -1056,10 +1056,10 @@ break;\ }\ if (planar) {\ - p4 = (stype *)this->av_frame->extended_data[x[3]];\ + p4 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[x[3]], sizeof (stype));\ if (!p4) break;\ } else\ - p4 = (stype *)this->av_frame->extended_data[0] + x[3];\ + p4 = (stype *)ASSUME_ALIGNED_2 (this->av_frame->extended_data[0], sizeof (stype)) + x[3];\ for (i = 0; i < samples; i++) {\ int32_t v = (*p1) * gain + (*p2 + *p3 + *p4) * gain3;\ p1 += sstep;\ @@ -1240,8 +1240,8 @@ /* the above codecs output float samples, not 16-bit integers */ int samples = this->send.len / sizeof(float); float gain = this->class->gain; - float *p = (float *)this->decode_buffer; - int16_t *q = (int16_t *)this->decode_buffer; + float *p = (float *)ASSUME_ALIGNED_2 (this->decode_buffer, 4); + int16_t *q = (int16_t *)ASSUME_ALIGNED_2 (this->decode_buffer, 2); int i; for (i = samples; i; i--) { int v = *p++ * gain; @@ -1255,7 +1255,7 @@ int samples = this->send.len / (this->ff_channels * 2); int channels = this->ao_channels; int ff_channels = this->ff_channels; - int16_t *p = (int16_t *)this->decode_buffer; + int16_t *p = (int16_t *)ASSUME_ALIGNED_2 (this->decode_buffer, 2); int16_t *q = p; int shift = this->downmix_shift, i, j; /* downmix mono output to stereo first */ @@ -1300,7 +1300,7 @@ } /* final mono downmix */ if (channels > this->ao_channels) { - p = (int16_t *)this->decode_buffer; + p = (int16_t *)ASSUME_ALIGNED_2 (this->decode_buffer, 2); q = p; for (i = samples; i; i--) { int v = *p++;