From f312925374bd4bc94a1861bd90922f7496f5fd70 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 1 Mar 2015 09:26:08 -0800 Subject: [PATCH 1/3] Fix a log message. --- Core/HLE/sceMpeg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index cbb655398a..2593f3d28a 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1633,7 +1633,7 @@ static int sceMpegQueryPcmEsSize(u32 mpeg, u32 esSizeAddr, u32 outSizeAddr) return -1; } - ERROR_LOG(ME, "sceMpegQueryPcmEsSize - bad pointers(%08x, %08x, %08x)", mpeg, esSizeAddr, outSizeAddr); + ERROR_LOG(ME, "sceMpegQueryPcmEsSize(%08x, %08x, %08x)", mpeg, esSizeAddr, outSizeAddr); Memory::Write_U32(MPEG_PCM_ES_SIZE, esSizeAddr); Memory::Write_U32(MPEG_PCM_ES_OUTPUT_SIZE, outSizeAddr); From d49010832cd4d75a97ffee1ceb5f3559e580a0e3 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 1 Mar 2015 09:26:53 -0800 Subject: [PATCH 2/3] Make sceMpegChangeGetAuMode() operate more sanely. I'm pretty sure this is what the intention was before, but it still doesn't do anything useful (since ignore* are... ignored.) --- Core/HLE/sceMpeg.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 2593f3d28a..fb3ad8867a 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1646,13 +1646,20 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { WARN_LOG(ME, "sceMpegChangeGetAuMode(%08x, %i, %i): bad mpeg handle", mpeg, streamUid, mode); - return -1; + return ERROR_MPEG_INVALID_VALUE; + } + if (mode != MPEG_AU_MODE_DECODE && mode != MPEG_AU_MODE_SKIP) { + ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): bad mode", mpeg, streamUid, mode); + return ERROR_MPEG_INVALID_VALUE; } - // NOTE: Where is the info supposed to come from? - StreamInfo info = {0}; - info.sid = streamUid; - if (info.sid) { + auto stream = ctx->streamMap.find(streamUid); + if (stream == ctx->streamMap.end()) { + ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); + return ERROR_MPEG_INVALID_VALUE; + } else { + StreamInfo &info = stream->second; + DEBUG_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): changing type=%d", mpeg, streamUid, mode, info.type); switch (info.type) { case MPEG_AVC_STREAM: if (mode == MPEG_AU_MODE_DECODE) { @@ -1677,11 +1684,9 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) } break; default: - ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i): unknown streamID", mpeg, streamUid); + ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); break; } - } else { - ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i): unknown streamID", mpeg, streamUid); } return 0; } From c16fac66889a914d8d1a8365dd9f866f35484e9d Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 1 Mar 2015 09:27:38 -0800 Subject: [PATCH 3/3] Force off full-range color during video decode. Fixes #6528, so should make colors in videos more correct. --- Core/HW/MediaEngine.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index f1d7989583..84f6716ee9 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -482,6 +482,17 @@ void MediaEngine::updateSwsFormat(int videoPixelMode) { NULL, NULL ); + + int *inv_coefficients; + int *coefficients; + int srcRange, dstRange; + int brightness, contrast, saturation; + + if (sws_getColorspaceDetails(m_sws_ctx, &inv_coefficients, &srcRange, &coefficients, &dstRange, &brightness, &contrast, &saturation) != -1) { + srcRange = 0; + dstRange = 0; + sws_setColorspaceDetails(m_sws_ctx, inv_coefficients, srcRange, coefficients, dstRange, brightness, contrast, saturation); + } } #endif }