Video: remove enforced resolution least common multiple of 4 when dumping screenshots and not videos (only videos encoders have this limit).
NOTE: this will likely trigger FIFOCI differences.
This commit is contained in:
parent
72db62e178
commit
66592f79f2
|
@ -18,6 +18,9 @@
|
||||||
#include "VideoCommon/Present.h"
|
#include "VideoCommon/Present.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
|
||||||
|
// The video encoder needs the image to be a multiple of x samples.
|
||||||
|
static constexpr int VIDEO_ENCODER_LCM = 4;
|
||||||
|
|
||||||
static bool DumpFrameToPNG(const FrameData& frame, const std::string& file_name)
|
static bool DumpFrameToPNG(const FrameData& frame, const std::string& file_name)
|
||||||
{
|
{
|
||||||
return Common::ConvertRGBAToRGBAndSavePNG(file_name, frame.data, frame.width, frame.height,
|
return Common::ConvertRGBAToRGBAndSavePNG(file_name, frame.data, frame.width, frame.height,
|
||||||
|
@ -354,6 +357,13 @@ bool FrameDumper::IsFrameDumping() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FrameDumper::GetRequiredResolutionLeastCommonMultiple() const
|
||||||
|
{
|
||||||
|
if (Config::Get(Config::MAIN_MOVIE_DUMP_FRAMES))
|
||||||
|
return VIDEO_ENCODER_LCM;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void FrameDumper::DoState(PointerWrap& p)
|
void FrameDumper::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_FFMPEG
|
#ifdef HAVE_FFMPEG
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
void SaveScreenshot(std::string filename);
|
void SaveScreenshot(std::string filename);
|
||||||
|
|
||||||
bool IsFrameDumping() const;
|
bool IsFrameDumping() const;
|
||||||
|
int GetRequiredResolutionLeastCommonMultiple() const;
|
||||||
|
|
||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,6 @@
|
||||||
|
|
||||||
std::unique_ptr<VideoCommon::Presenter> g_presenter;
|
std::unique_ptr<VideoCommon::Presenter> g_presenter;
|
||||||
|
|
||||||
// The video encoder needs the image to be a multiple of x samples.
|
|
||||||
static constexpr int VIDEO_ENCODER_LCM = 4;
|
|
||||||
|
|
||||||
namespace VideoCommon
|
namespace VideoCommon
|
||||||
{
|
{
|
||||||
// Stretches the native/internal analog resolution aspect ratio from ~4:3 to ~16:9
|
// Stretches the native/internal analog resolution aspect ratio from ~4:3 to ~16:9
|
||||||
|
@ -246,16 +243,18 @@ void Presenter::ProcessFrameDumping(u64 ticks) const
|
||||||
int width = target_rect.GetWidth();
|
int width = target_rect.GetWidth();
|
||||||
int height = target_rect.GetHeight();
|
int height = target_rect.GetHeight();
|
||||||
|
|
||||||
// Ensure divisibility by "VIDEO_ENCODER_LCM" and a min of 1 to make it compatible with all the
|
const int resolution_lcm = g_frame_dumper->GetRequiredResolutionLeastCommonMultiple();
|
||||||
|
|
||||||
|
// Ensure divisibility by the dumper LCM and a min of 1 to make it compatible with all the
|
||||||
// video encoders. Note that this is theoretically only necessary when recording videos and not
|
// video encoders. Note that this is theoretically only necessary when recording videos and not
|
||||||
// screenshots.
|
// screenshots.
|
||||||
// We always scale positively to make sure the least amount of information is lost.
|
// We always scale positively to make sure the least amount of information is lost.
|
||||||
//
|
//
|
||||||
// TODO: this should be added as black padding on the edges by the frame dumper.
|
// TODO: this should be added as black padding on the edges by the frame dumper.
|
||||||
if ((width % VIDEO_ENCODER_LCM) != 0 || width == 0)
|
if ((width % resolution_lcm) != 0 || width == 0)
|
||||||
width += VIDEO_ENCODER_LCM - (width % VIDEO_ENCODER_LCM);
|
width += resolution_lcm - (width % resolution_lcm);
|
||||||
if ((height % VIDEO_ENCODER_LCM) != 0 || height == 0)
|
if ((height % resolution_lcm) != 0 || height == 0)
|
||||||
height += VIDEO_ENCODER_LCM - (height % VIDEO_ENCODER_LCM);
|
height += resolution_lcm - (height % resolution_lcm);
|
||||||
|
|
||||||
// Remove any black borders, there would be no point in including them in the recording
|
// Remove any black borders, there would be no point in including them in the recording
|
||||||
target_rect.left = 0;
|
target_rect.left = 0;
|
||||||
|
|
Loading…
Reference in New Issue