Merge pull request #9 from DizzyEggg/compresss

Remove DMA from decompression code
This commit is contained in:
hedara90 2024-12-09 16:04:51 +01:00 committed by GitHub
commit 58058a0d1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -321,16 +321,7 @@ void BuildDecompressionTable(const u32 *packedFreqs, struct DecodeYK *table, u32
{
if (freqs[i] != 0)
{
DmaCopy16(3, &sYkTemplate[freqs[i]], &table[currCol], freqs[i]*sizeof(struct DecodeYK));
for (u32 j = 0; j < freqs[i]; j++)
symbolTable[currCol + j] = i;
currCol += freqs[i];
}
// Fully unrolling this loop worsens the performance, however this partial unroll makes it better by about 3k cycles.
i++;
if (freqs[i] != 0)
{
DmaCopy16(3, &sYkTemplate[freqs[i]], &table[currCol], freqs[i]*sizeof(struct DecodeYK));
CpuCopy32(&sYkTemplate[freqs[i]], &table[currCol], freqs[i]*sizeof(struct DecodeYK));
for (u32 j = 0; j < freqs[i]; j++)
symbolTable[currCol + j] = i;
currCol += freqs[i];
@ -547,6 +538,23 @@ void DecodeSymDeltatANS(const u32 *data, const u32 *pFreqs, u16 *resultVec, u32
SwitchToArmCallSymDeltaANS(data, &stuff, maskTable, (void *) funcBuffer);
}
static inline void Copy16(void *_src, void *_dst, u32 size)
{
u16 *src = _src;
u16 *dst = _dst;
for (u32 i = 0; i < size; i++) {
dst[i] = src[i];
}
}
static inline void Fill16(u16 value, void *_dst, u32 size)
{
u16 *dst = _dst;
for (u32 i = 0; i < size; i++) {
dst[i] = value;
}
}
__attribute__((target("arm"))) __attribute__((noinline)) void DecodeInstructions(u32 headerLoSize, u8 *loVec, u16 *symVec, void *dest)
{
u32 loIndex = 0;
@ -579,20 +587,20 @@ __attribute__((target("arm"))) __attribute__((noinline)) void DecodeInstructions
dest = (void *)(dest + 2);
if (currOffset == 1)
{
DmaFill16(3, symVec[symIndex], dest, 2*currLength);
Fill16(symVec[symIndex], dest, currLength);
dest = (void *)(dest + currLength*2);
}
else
{
DmaCopy16(3, (void *)(dest - currOffset*2), dest, currLength*2);
Copy16((void *)(dest - currOffset*2), dest, currLength);
//DmaCopy16(3, (void *)(dest - currOffset*2), dest, currLength*2);
dest = (void *)(dest + currLength*2);
}
symIndex++;
}
else
{
DmaCopy16(3, &symVec[symIndex], dest, currOffset*2);
Copy16(&symVec[symIndex], dest, currOffset);
dest = (void *)(dest + currOffset*2);
symIndex += currOffset;
}