Fix issue from #567 that stopped videos from working. Clean up some code.

This commit is contained in:
Sacha 2014-07-15 03:21:24 +10:00
parent 6bd044f9be
commit 82536b298c
5 changed files with 62 additions and 68 deletions

View file

@ -159,31 +159,31 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
picInfo->reserved2 = 0;
u64 stamp0 = get_system_time();
auto pY = std::unique_ptr<u8[]>{ new u8[w*h] }.get(); // color planes
auto pU = std::unique_ptr<u8[]>{ new u8[w*h/4] }.get();
auto pV = std::unique_ptr<u8[]>{ new u8[w*h/4] }.get();
auto pA = std::unique_ptr<u8[]>{ new u8[w*h] }.get();
auto res = std::unique_ptr<u32[]>{ new u32[ow*oh*4] }.get(); // RGBA interleaved output
std::unique_ptr<u8[]> pY(new u8[w*h]); // color planes
std::unique_ptr<u8[]> pU(new u8[w*h/4]);
std::unique_ptr<u8[]> pV(new u8[w*h/4]);
std::unique_ptr<u8[]> pA(new u8[w*h]);
std::unique_ptr<u32[]> res(new u32[ow*oh*4]); // RGBA interleaved output
if (!Memory.CopyToReal(pY, inPicBuff_addr, w*h))
if (!Memory.CopyToReal(pY.get(), inPicBuff_addr, w*h))
{
cellVpost->Error("cellVpostExec: data copying failed(pY)");
Emu.Pause();
}
if (!Memory.CopyToReal(pU, inPicBuff_addr + w*h, w*h/4))
if (!Memory.CopyToReal(pU.get(), inPicBuff_addr + w*h, w*h/4))
{
cellVpost->Error("cellVpostExec: data copying failed(pU)");
Emu.Pause();
}
if (!Memory.CopyToReal(pV, inPicBuff_addr + w*h + w*h/4, w*h/4))
if (!Memory.CopyToReal(pV.get(), inPicBuff_addr + w*h + w*h/4, w*h/4))
{
cellVpost->Error("cellVpostExec: data copying failed(pV)");
Emu.Pause();
}
memset(pA, (const u8)ctrlParam->outAlpha, w*h);
memset(pA.get(), (const u8)ctrlParam->outAlpha, w*h);
u64 stamp1 = get_system_time();
@ -191,9 +191,9 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
u64 stamp2 = get_system_time();
u8* in_data[4] = { pY, pU, pV, pA };
u8* in_data[4] = { pY.get(), pU.get(), pV.get(), pA.get() };
int in_line[4] = { w, w/2, w/2, w };
u8* out_data[4] = { (u8*)res, NULL, NULL, NULL };
u8* out_data[4] = { (u8*)res.get(), NULL, NULL, NULL };
int out_line[4] = { static_cast<int>(ow*4), 0, 0, 0 };
sws_scale(sws, in_data, in_line, 0, h, out_data, out_line);
@ -202,7 +202,7 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
u64 stamp3 = get_system_time();
if (!Memory.CopyFromReal(outPicBuff_addr, res, ow*oh*4))
if (!Memory.CopyFromReal(outPicBuff_addr, res.get(), ow*oh*4))
{
cellVpost->Error("cellVpostExec: data copying failed(result)");
Emu.Pause();