History

pixblockdsp, avdct: Add get_pixels_unaligned

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.

Martin Storsjö committed 6 years ago

Commit 353aecb1 parent b12b0536 files · +17 −3Browse files

Unified · Split

6 files
  1. libavcodec/avdct.c +1 −0
  2. libavcodec/avdct.h +4 −0
  3. libavcodec/pixblockdsp.c +2 −0
  4. libavcodec/pixblockdsp.h +3 −0
  5. libavcodec/x86/pixblockdsp_init.c +6 −2
  6. libavfilter/vf_spp.c +1 −1
libavcodec/avdct.c+1−0
@@ -120,6 +120,7 @@ int avcodec_dct_init(AVDCT *dsp) · 119 unmodified lines
120120 PixblockDSPContext pdsp;
121121 ff_pixblockdsp_init(&pdsp, avctx);
122122 COPY(pdsp, get_pixels);
123+ COPY(pdsp, get_pixels_unaligned);
123124 }
124125 #endif
125126
libavcodec/avdct.h+4−0
@@ -67,6 +67,10 @@ typedef struct AVDCT { · 66 unmodified lines
6767 ptrdiff_t line_size);
6868
6969 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);
7074 } AVDCT;
7175
7276 /**
libavcodec/pixblockdsp.c+2−0
@@ -90,10 +90,12 @@ av_cold void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx) · 89 unmodified lines
9090 case 10:
9191 case 12:
9292 case 14:
93+ c->get_pixels_unaligned =
9394 c->get_pixels = get_pixels_16_c;
9495 break;
9596 default:
9697 if (avctx->bits_per_raw_sample<=8 || avctx->codec_type != AVMEDIA_TYPE_VIDEO) {
98+ c->get_pixels_unaligned =
9799 c->get_pixels = get_pixels_8_c;
98100 }
99101 break;
libavcodec/pixblockdsp.h+3−0
@@ -29,6 +29,9 @@ typedef struct PixblockDSPContext { · 28 unmodified lines
2929 void (*get_pixels)(int16_t *av_restrict block /* align 16 */,
3030 const uint8_t *pixels /* align 8 */,
3131 ptrdiff_t stride);
32+ void (*get_pixels_unaligned)(int16_t *av_restrict block /* align 16 */,
33+ const uint8_t *pixels,
34+ ptrdiff_t stride);
3235 void (*diff_pixels)(int16_t *av_restrict block /* align 16 */,
3336 const uint8_t *s1 /* align 8 */,
3437 const uint8_t *s2 /* align 8 */,
libavcodec/x86/pixblockdsp_init.c+6−2
@@ -37,15 +37,19 @@ av_cold void ff_pixblockdsp_init_x86(PixblockDSPContext *c, · 36 unmodified lines
3737 int cpu_flags = av_get_cpu_flags();
3838
3939 if (EXTERNAL_MMX(cpu_flags)) {
40− if (!high_bit_depth)
40+ if (!high_bit_depth) {
41+ c->get_pixels_unaligned =
4142 c->get_pixels = ff_get_pixels_mmx;
43+ }
4244 c->diff_pixels_unaligned =
4345 c->diff_pixels = ff_diff_pixels_mmx;
4446 }
4547
4648 if (EXTERNAL_SSE2(cpu_flags)) {
47− if (!high_bit_depth)
49+ if (!high_bit_depth) {
50+ c->get_pixels_unaligned =
4851 c->get_pixels = ff_get_pixels_sse2;
52+ }
4953 c->diff_pixels_unaligned =
5054 c->diff_pixels = ff_diff_pixels_sse2;
5155 }
libavfilter/vf_spp.c+1−1
@@ -283,7 +283,7 @@ static void filter(SPPContext *p, uint8_t *dst, uint8_t *src, · 282 unmodified lines
283283 const int x1 = x + offset[i + count - 1][0];
284284 const int y1 = y + offset[i + count - 1][1];
285285 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);
287287 p->dct->fdct(block);
288288 p->requantize(block2, block, qp, p->dct->idct_permutation);
289289 p->dct->idct(block2);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t