AvcDecoder: Check the pixel format

AvcDecoder handed out frame_->data[0..2] without looking at the pixel format,
and everything downstream indexes them as 8-bit 4:2:0. Check it, and drop the
frame instead of converting whatever else turned up.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5 authored and Henrik Rydgård committed 2026-09-12 12:53:13 -06:00
1 parent 435d446c37
commit b4b8e2e733
2 files changed
+7 -1

No files matched your search

-1
View File
@@ -329,7 +329,6 @@ void RegisterAllModules() {
Register_sceChkreg();
Register_sceVshBridge();
Register_sceResmgr();
Register_sceVideocodec();
// add new modules here.
+7
View File
@@ -155,6 +155,13 @@ bool AvcDecoder::Decode(const u8 *data, int size) {
}
#endif
// Everything downstream indexes the three planes as 8-bit 4:2:0, which is all the PSP's
// encoder produced. Anything else would be read as if it were, so say so and drop the frame
// rather than converting garbage.
if (frame_->format != AV_PIX_FMT_YUV420P && frame_->format != AV_PIX_FMT_YUVJ420P) {
WARN_LOG(Log::ME, "AvcDecoder: unexpected pixel format %d, ignoring the frame", frame_->format);
return false;
}
width_ = frame_->width;
height_ = frame_->height;
haveFrame_ = width_ > 0 && height_ > 0;