mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-09 13:19:00 +00:00
Fixed green artifacts in movies/animations (ffmpeg) (#3398)
* Fixed green artifacts in movies/animations (ffmpeg) * cleanup&clang * Avoid for-loop when source and target widths are equal
This commit is contained in:
@@ -15,8 +15,22 @@ std::vector<OrbisVideodec2AvcPictureInfo> gPictureInfos;
|
||||
std::vector<OrbisVideodec2LegacyAvcPictureInfo> gLegacyPictureInfos;
|
||||
|
||||
static inline void CopyNV12Data(u8* dst, const AVFrame& src) {
|
||||
std::memcpy(dst, src.data[0], src.width * src.height);
|
||||
std::memcpy(dst + (src.width * src.height), src.data[1], (src.width * src.height) / 2);
|
||||
if (src.width == src.linesize[0]) {
|
||||
std::memcpy(dst, src.data[0], src.width * src.height);
|
||||
std::memcpy(dst + (src.width * src.height), src.data[1], (src.width * src.height) / 2);
|
||||
return;
|
||||
}
|
||||
|
||||
for (u16 row = 0; row < src.height; row++) {
|
||||
u64 dst_offset = row * src.width;
|
||||
std::memcpy(dst + dst_offset, src.data[0] + (row * src.linesize[0]), src.width);
|
||||
}
|
||||
|
||||
u64 dst_base = src.width * src.height;
|
||||
for (u16 row = 0; row < src.height / 2; row++) {
|
||||
u64 dst_offset = row * src.width;
|
||||
std::memcpy(dst + dst_base + dst_offset, src.data[1] + (row * src.linesize[1]), src.width);
|
||||
}
|
||||
}
|
||||
|
||||
VdecDecoder::VdecDecoder(const OrbisVideodec2DecoderConfigInfo& configInfo,
|
||||
@@ -110,7 +124,7 @@ s32 VdecDecoder::Decode(const OrbisVideodec2InputData& inputData,
|
||||
outputInfo.codecType = 1; // FIXME: Hardcoded to AVC
|
||||
outputInfo.frameWidth = frame->width;
|
||||
outputInfo.frameHeight = frame->height;
|
||||
outputInfo.framePitch = frame->linesize[0];
|
||||
outputInfo.framePitch = frame->width;
|
||||
outputInfo.frameBufferSize = frameBuffer.frameBufferSize;
|
||||
outputInfo.frameBuffer = frameBuffer.frameBuffer;
|
||||
|
||||
@@ -121,7 +135,7 @@ s32 VdecDecoder::Decode(const OrbisVideodec2InputData& inputData,
|
||||
// For proper compatibility with older games, check the inputted OutputInfo struct size.
|
||||
if (outputInfo.thisSize == sizeof(OrbisVideodec2OutputInfo)) {
|
||||
// framePitchInBytes only exists in the newer struct.
|
||||
outputInfo.framePitchInBytes = frame->linesize[0];
|
||||
outputInfo.framePitchInBytes = frame->width;
|
||||
if (outputInfo.isValid) {
|
||||
OrbisVideodec2AvcPictureInfo pictureInfo = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user