History

avcodec/lossless_videoencdsp: Don't presume alignment in diff_bytes

The alignment of all the parameters in diff_bytes can be anything the despite the documentation claiming otherwise. 8ecd38312210d48ec9e50d78fc223d60e71a30ed was based around said documentation and is therefore insufficient to fix e.g. the misaligned loads that happen in the huffyuvbgra and huffyuvbgr24 vsynth FATE-tests.

Andreas Rheinhardt committed 2 years ago

Commit a4800641 parent e54696b2 files · +6 −8Browse files

Unified · Split

2 files
  1. libavcodec/lossless_videoencdsp.c +4 −6
  2. libavcodec/lossless_videoencdsp.h +2 −2
libavcodec/lossless_videoencdsp.c+4−6
@@ -25,13 +25,11 @@ · 24 unmodified lines
2525 #if HAVE_FAST_64BIT
2626 typedef uint64_t uint_native;
2727 #define READ AV_RN64
28−#define READA AV_RN64A
29−#define WRITEA AV_WN64A
28+#define WRITE AV_WN64
3029 #else
3130 typedef uint32_t uint_native;
3231 #define READ AV_RN32
33−#define READA AV_RN32A
34−#define WRITEA AV_WN32A
32+#define WRITE AV_WN32
3533 #endif
3634 // 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size
3735 #define pb_7f (~(uint_native)0 / 255 * 0x7f)
@@ -56,9 +54,9 @@ static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, · 18 unmodified lines
5654 } else
5755 #endif
5856 for (i = 0; i <= w - (int) sizeof(uint_native); i += sizeof(uint_native)) {
59− uint_native a = READA(src1 + i);
57+ uint_native a = READ(src1 + i);
6058 uint_native b = READ(src2 + i);
61− WRITEA(dst + i, ((a | pb_80) - (b & pb_7f)) ^ ((a ^ b ^ pb_80) & pb_80));
59+ WRITE(dst + i, ((a | pb_80) - (b & pb_7f)) ^ ((a ^ b ^ pb_80) & pb_80));
6260 }
6361 for (; i < w; i++)
6462 dst[i + 0] = src1[i + 0] - src2[i + 0];
libavcodec/lossless_videoencdsp.h+2−2
@@ -23,8 +23,8 @@ · 22 unmodified lines
2323 #include <stdint.h>
2424
2525 typedef struct LLVidEncDSPContext {
26− void (*diff_bytes)(uint8_t *dst /* align 16 */,
27− const uint8_t *src1 /* align 16 */,
26+ void (*diff_bytes)(uint8_t *dst /* align 1 */,
27+ const uint8_t *src1 /* align 1 */,
2828 const uint8_t *src2 /* align 1 */,
2929 intptr_t w);
3030 /**

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