mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Camera: Compress webcam frames to fit the game's framesize
The PSP camera keeps JPEG frames within the framesize from the video setup. Go!Edit stores frames in 15KB slots and only takes frames that fit, so our uncompressed-quality webcam frames were dropped and one frame got repeated for the whole clip. Lower the JPEG quality until a frame fits. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
948062907b
commit
9d33e828ab
3 files changed
+35
-7
No files matched your search
@@ -247,13 +247,23 @@ HRESULT ReaderCallback::OnReadSample(
|
||||
}
|
||||
}
|
||||
|
||||
// Compress image to jpeg from RGB24.
|
||||
jpge::compress_image_to_jpeg_file_in_memory(
|
||||
device->imageJpeg, imgJpegSize,
|
||||
dstW,
|
||||
dstH,
|
||||
3,
|
||||
device->imageRGB);
|
||||
// Compress image to jpeg from RGB24. Like the PSP camera, lower the quality until the frame
|
||||
// fits the size the game asked for: Go!Edit stores frames in fixed 15KB slots.
|
||||
const int maxFrameSize = Camera::getMaxFrameSize();
|
||||
jpge::params params;
|
||||
for (int quality = 85; ; quality -= 10) {
|
||||
imgJpegSize = device->imgJpegSize;
|
||||
params.m_quality = quality;
|
||||
jpge::compress_image_to_jpeg_file_in_memory(
|
||||
device->imageJpeg, imgJpegSize,
|
||||
dstW,
|
||||
dstH,
|
||||
3,
|
||||
device->imageRGB, params);
|
||||
if (imgJpegSize <= maxFrameSize || quality <= 15) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Camera::pushCameraImage(imgJpegSize, device->imageJpeg);
|
||||
|
||||
Reference in new issue
Block a user