Skip to content

Commit 7b27778

Browse files
committed
mpeg: Label the 16x16 rgba32 block size constant
1 parent 69a0cc2 commit 7b27778

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

ee/mpeg/src/libmpeg_core.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,15 @@ static u32 s_QmNonIntra[16] __attribute__((aligned(16))) = {
9797

9898
extern s32 _mpeg_dmac_handler(s32 channel, void *arg, void *addr);
9999

100+
#define RGBA32_BLOCK_SIZE (16 * 16 * 4)
101+
100102
#define IPU_CMD_BUSY (1ull << 63)
101103

102104
#define IPU_CTRL_BUSY (1 << 31)
103105
#define IPU_CTRL_RST (1 << 30)
104106
#define IPU_CTRL_MP1 (1 << 23)
105107
#define IPU_CTRL_ECD (1 << 14)
106108

107-
108109
// clang-format off
109110
#define IPU_COMMAND_BCLR 0x00000000
110111
#define IPU_COMMAND_IDEC 0x10000000
@@ -258,11 +259,11 @@ s32 _mpeg_dmac_handler(s32 channel, void *arg, void *addr)
258259
}
259260
*R_EE_D3_MADR = cp->dest;
260261
*R_EE_D4_MADR = cp->source;
261-
cp->source += mbc * 0x180;
262-
cp->dest += mbc * 0x400;
262+
cp->source += mbc * sizeof(_MPEGMacroBlock8);
263+
cp->dest += mbc * RGBA32_BLOCK_SIZE;
263264
cp->blocks = cp->blocks - mbc;
264-
*R_EE_D3_QWC = (mbc * 0x400) >> 4;
265-
*R_EE_D4_QWC = (mbc * 0x180) >> 4;
265+
*R_EE_D3_QWC = (mbc * sizeof(_MPEGMacroBlock8)) >> 4;
266+
*R_EE_D4_QWC = (mbc * RGBA32_BLOCK_SIZE) >> 4;
266267
*R_EE_D4_CHCR = 0x101;
267268
*R_EE_IPU_CMD = IPU_COMMAND_CSC | mbc;
268269
*R_EE_D3_CHCR = 0x100;
@@ -284,12 +285,12 @@ int _MPEG_CSCImage(void *source, void *dest, int mbcount)
284285
*R_EE_D3_MADR = (u32)dest;
285286
*R_EE_D4_MADR = (u32)source;
286287

287-
s_CSCParam.source = (u32)source + mbc * sizeof(_MPEGMacroBlock8); // 0x180
288-
s_CSCParam.dest = (u32)dest + mbc * 0x400; // 1024
288+
s_CSCParam.source = (u32)source + mbc * sizeof(_MPEGMacroBlock8);
289+
s_CSCParam.dest = (u32)dest + mbc * RGBA32_BLOCK_SIZE;
289290
s_CSCParam.blocks = mbcount - mbc;
290291

291-
*R_EE_D4_QWC = (mbc * 0x180) >> 4;
292-
*R_EE_D3_QWC = (mbc * 0x400) >> 4;
292+
*R_EE_D4_QWC = (mbc * sizeof(_MPEGMacroBlock8)) >> 4;
293+
*R_EE_D3_QWC = (mbc * RGBA32_BLOCK_SIZE) >> 4;
293294
EnableDmac(3);
294295
*R_EE_D4_CHCR = 0x101;
295296
*R_EE_IPU_CMD = IPU_COMMAND_CSC | mbc;

0 commit comments

Comments
 (0)