Skip to content

Commit 800b56e

Browse files
committed
cellVdec: try to fix ps home video pitch
1 parent f535c82 commit 800b56e

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

rpcs3/Emu/Cell/Modules/cellVdec.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,11 +1303,7 @@ error_code cellVdecGetPictureExt(ppu_thread& ppu, u32 handle, vm::cptr<CellVdecP
13031303
u8* in_data[4] = { frame->data[0], frame->data[1], frame->data[2], alpha_plane.get() };
13041304
int in_line[4] = { frame->linesize[0], frame->linesize[1], frame->linesize[2], w * 1 };
13051305
u8* out_data[4] = { outBuff.get_ptr() };
1306-
int out_line[4] = { w * 4 }; // RGBA32 or ARGB32
1307-
1308-
// TODO:
1309-
// It's possible that we need to align the pitch to 128 here.
1310-
// PS HOME seems to rely on this somehow in certain cases.
1306+
int out_line[4] = { static_cast<int>(utils::align<u32>(w * 4, 128)) }; // RGBA32 or ARGB32
13111307

13121308
if (!alpha_plane)
13131309
{
@@ -1319,6 +1315,10 @@ error_code cellVdecGetPictureExt(ppu_thread& ppu, u32 handle, vm::cptr<CellVdecP
13191315
{
13201316
fmt::throw_exception("cellVdecGetPictureExt: av_image_fill_linesizes failed (handle=0x%x, seq_id=%d, cmd_id=%d, ret=0x%x): %s", handle, frame.seq_id, frame.cmd_id, ret, utils::av_error_to_string(ret));
13211317
}
1318+
1319+
// TODO:
1320+
// It's possible that we need to align the pitches to 128/64 here.
1321+
// We also may need to do this manually in cellVdecGetPicItem
13221322
}
13231323

13241324
sws_scale(vdec->sws, in_data, in_line, 0, h, out_data, out_line);
@@ -1429,9 +1429,10 @@ error_code cellVdecGetPicItem(ppu_thread& ppu, u32 handle, vm::pptr<CellVdecPicI
14291429

14301430
info->codecType = vdec->type;
14311431
info->startAddr = 0x00000123; // invalid value (no address for picture)
1432-
const int buffer_size = av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1);
1432+
const int buffer_size = av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 128);
14331433
ensure(buffer_size >= 0);
1434-
info->size = utils::align<u32>(buffer_size, 128);
1434+
ensure(buffer_size % 128 == 0);
1435+
info->size = static_cast<u32>(buffer_size);
14351436
info->auNum = 1;
14361437
info->auPts[0].lower = static_cast<u32>(pts);
14371438
info->auPts[0].upper = static_cast<u32>(pts >> 32);

0 commit comments

Comments
 (0)