Use this in vf_spp.c, where the get_pixels operation is done on unaligned source addresses. Hook up the x86 (mmx and sse) versions of get_pixels to this function pointer, as those implementations seem to support unaligned use. This fixes fate-filter-spp on armv7.
Unified · Split
| @@ -120,6 +120,7 @@ int avcodec_dct_init(AVDCT *dsp) · 119 unmodified lines | ||
| 120 | 120 | PixblockDSPContext pdsp; |
| 121 | 121 | ff_pixblockdsp_init(&pdsp, avctx); |
| 122 | 122 | COPY(pdsp, get_pixels); |
| 123 | + COPY(pdsp, get_pixels_unaligned); | |
| 123 | 124 | } |
| 124 | 125 | #endif |
| 125 | 126 | |
| @@ -67,6 +67,10 @@ typedef struct AVDCT { · 66 unmodified lines | ||
| 67 | 67 | ptrdiff_t line_size); |
| 68 | 68 | |
| 69 | 69 | int bits_per_sample; |
| 70 | + | |
| 71 | + void (*get_pixels_unaligned)(int16_t *block /* align 16 */, | |
| 72 | + const uint8_t *pixels, | |
| 73 | + ptrdiff_t line_size); | |
| 70 | 74 | } AVDCT; |
| 71 | 75 | |
| 72 | 76 | /** |
| @@ -90,10 +90,12 @@ av_cold void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx) · 89 unmodified lines | ||
| 90 | 90 | case 10: |
| 91 | 91 | case 12: |
| 92 | 92 | case 14: |
| 93 | + c->get_pixels_unaligned = | |
| 93 | 94 | c->get_pixels = get_pixels_16_c; |
| 94 | 95 | break; |
| 95 | 96 | default: |
| 96 | 97 | if (avctx->bits_per_raw_sample<=8 || avctx->codec_type != AVMEDIA_TYPE_VIDEO) { |
| 98 | + c->get_pixels_unaligned = | |
| 97 | 99 | c->get_pixels = get_pixels_8_c; |
| 98 | 100 | } |
| 99 | 101 | break; |
| @@ -29,6 +29,9 @@ typedef struct PixblockDSPContext { · 28 unmodified lines | ||
| 29 | 29 | void (*get_pixels)(int16_t *av_restrict block /* align 16 */, |
| 30 | 30 | const uint8_t *pixels /* align 8 */, |
| 31 | 31 | ptrdiff_t stride); |
| 32 | + void (*get_pixels_unaligned)(int16_t *av_restrict block /* align 16 */, | |
| 33 | + const uint8_t *pixels, | |
| 34 | + ptrdiff_t stride); | |
| 32 | 35 | void (*diff_pixels)(int16_t *av_restrict block /* align 16 */, |
| 33 | 36 | const uint8_t *s1 /* align 8 */, |
| 34 | 37 | const uint8_t *s2 /* align 8 */, |
| @@ -37,15 +37,19 @@ av_cold void ff_pixblockdsp_init_x86(PixblockDSPContext *c, · 36 unmodified lines | ||
| 37 | 37 | int cpu_flags = av_get_cpu_flags(); |
| 38 | 38 | |
| 39 | 39 | if (EXTERNAL_MMX(cpu_flags)) { |
| 40 | − if (!high_bit_depth) | |
| 40 | + if (!high_bit_depth) { | |
| 41 | + c->get_pixels_unaligned = | |
| 41 | 42 | c->get_pixels = ff_get_pixels_mmx; |
| 43 | + } | |
| 42 | 44 | c->diff_pixels_unaligned = |
| 43 | 45 | c->diff_pixels = ff_diff_pixels_mmx; |
| 44 | 46 | } |
| 45 | 47 | |
| 46 | 48 | if (EXTERNAL_SSE2(cpu_flags)) { |
| 47 | − if (!high_bit_depth) | |
| 49 | + if (!high_bit_depth) { | |
| 50 | + c->get_pixels_unaligned = | |
| 48 | 51 | c->get_pixels = ff_get_pixels_sse2; |
| 52 | + } | |
| 49 | 53 | c->diff_pixels_unaligned = |
| 50 | 54 | c->diff_pixels = ff_diff_pixels_sse2; |
| 51 | 55 | } |
| @@ -283,7 +283,7 @@ static void filter(SPPContext *p, uint8_t *dst, uint8_t *src, · 282 unmodified lines | ||
| 283 | 283 | const int x1 = x + offset[i + count - 1][0]; |
| 284 | 284 | const int y1 = y + offset[i + count - 1][1]; |
| 285 | 285 | const int index = x1 + y1*linesize; |
| 286 | − p->dct->get_pixels(block, p->src + sample_bytes*index, sample_bytes*linesize); | |
| 286 | + p->dct->get_pixels_unaligned(block, p->src + sample_bytes*index, sample_bytes*linesize); | |
| 287 | 287 | p->dct->fdct(block); |
| 288 | 288 | p->requantize(block2, block, qp, p->dct->idct_permutation); |
| 289 | 289 | p->dct->idct(block2); |