Merge pull request #8988 from JosJuice/no-refresh-rate-round
VideoCommon: Don't round the refresh rate
This commit is contained in:
commit
b354e343a7
|
@ -242,7 +242,9 @@ FifoPlayer& FifoPlayer::GetInstance()
|
||||||
void FifoPlayer::WriteFrame(const FifoFrameInfo& frame, const AnalyzedFrameInfo& info)
|
void FifoPlayer::WriteFrame(const FifoFrameInfo& frame, const AnalyzedFrameInfo& info)
|
||||||
{
|
{
|
||||||
// Core timing information
|
// Core timing information
|
||||||
m_CyclesPerFrame = SystemTimers::GetTicksPerSecond() / VideoInterface::GetTargetRefreshRate();
|
m_CyclesPerFrame = static_cast<u64>(SystemTimers::GetTicksPerSecond()) *
|
||||||
|
VideoInterface::GetTargetRefreshRateDenominator() /
|
||||||
|
VideoInterface::GetTargetRefreshRateNumerator();
|
||||||
m_ElapsedCycles = 0;
|
m_ElapsedCycles = 0;
|
||||||
m_FrameFifoSize = static_cast<u32>(frame.fifoData.size());
|
m_FrameFifoSize = static_cast<u32>(frame.fifoData.size());
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,9 @@ static UVIBorderBlankRegister m_BorderHBlank;
|
||||||
// 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown
|
// 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown
|
||||||
// 0xcc002080 - 0xcc002100 even more unknown
|
// 0xcc002080 - 0xcc002100 even more unknown
|
||||||
|
|
||||||
static u32 s_target_refresh_rate = 0;
|
static double s_target_refresh_rate = 0;
|
||||||
|
static u32 s_target_refresh_rate_numerator = 0;
|
||||||
|
static u32 s_target_refresh_rate_denominator = 1;
|
||||||
|
|
||||||
static constexpr std::array<u32, 2> s_clock_freqs{{
|
static constexpr std::array<u32, 2> s_clock_freqs{{
|
||||||
27000000,
|
27000000,
|
||||||
|
@ -102,14 +104,11 @@ void DoState(PointerWrap& p)
|
||||||
p.Do(m_DTVStatus);
|
p.Do(m_DTVStatus);
|
||||||
p.Do(m_FBWidth);
|
p.Do(m_FBWidth);
|
||||||
p.Do(m_BorderHBlank);
|
p.Do(m_BorderHBlank);
|
||||||
p.Do(s_target_refresh_rate);
|
|
||||||
p.Do(s_ticks_last_line_start);
|
p.Do(s_ticks_last_line_start);
|
||||||
p.Do(s_half_line_count);
|
p.Do(s_half_line_count);
|
||||||
p.Do(s_half_line_of_next_si_poll);
|
p.Do(s_half_line_of_next_si_poll);
|
||||||
p.Do(s_even_field_first_hl);
|
|
||||||
p.Do(s_odd_field_first_hl);
|
UpdateParameters();
|
||||||
p.Do(s_even_field_last_hl);
|
|
||||||
p.Do(s_odd_field_last_hl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Executed after Init, before game boot
|
// Executed after Init, before game boot
|
||||||
|
@ -698,15 +697,27 @@ void UpdateParameters()
|
||||||
s_even_field_first_hl = equ_hl + m_VBlankTimingEven.PRB + GetHalfLinesPerOddField();
|
s_even_field_first_hl = equ_hl + m_VBlankTimingEven.PRB + GetHalfLinesPerOddField();
|
||||||
s_even_field_last_hl = s_even_field_first_hl + acv_hl - 1;
|
s_even_field_last_hl = s_even_field_first_hl + acv_hl - 1;
|
||||||
|
|
||||||
s_target_refresh_rate = lround(2.0 * SystemTimers::GetTicksPerSecond() /
|
s_target_refresh_rate_numerator = SystemTimers::GetTicksPerSecond() * 2;
|
||||||
(GetTicksPerEvenField() + GetTicksPerOddField()));
|
s_target_refresh_rate_denominator = GetTicksPerEvenField() + GetTicksPerOddField();
|
||||||
|
s_target_refresh_rate =
|
||||||
|
static_cast<double>(s_target_refresh_rate_numerator) / s_target_refresh_rate_denominator;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetTargetRefreshRate()
|
double GetTargetRefreshRate()
|
||||||
{
|
{
|
||||||
return s_target_refresh_rate;
|
return s_target_refresh_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 GetTargetRefreshRateNumerator()
|
||||||
|
{
|
||||||
|
return s_target_refresh_rate_numerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 GetTargetRefreshRateDenominator()
|
||||||
|
{
|
||||||
|
return s_target_refresh_rate_denominator;
|
||||||
|
}
|
||||||
|
|
||||||
u32 GetTicksPerSample()
|
u32 GetTicksPerSample()
|
||||||
{
|
{
|
||||||
return 2 * SystemTimers::GetTicksPerSecond() / s_clock_freqs[m_Clock];
|
return 2 * SystemTimers::GetTicksPerSecond() / s_clock_freqs[m_Clock];
|
||||||
|
|
|
@ -363,7 +363,10 @@ void UpdateInterrupts();
|
||||||
// Change values pertaining to video mode
|
// Change values pertaining to video mode
|
||||||
void UpdateParameters();
|
void UpdateParameters();
|
||||||
|
|
||||||
u32 GetTargetRefreshRate();
|
double GetTargetRefreshRate();
|
||||||
|
u32 GetTargetRefreshRateNumerator();
|
||||||
|
u32 GetTargetRefreshRateDenominator();
|
||||||
|
|
||||||
u32 GetTicksPerSample();
|
u32 GetTicksPerSample();
|
||||||
u32 GetTicksPerHalfLine();
|
u32 GetTicksPerHalfLine();
|
||||||
u32 GetTicksPerField();
|
u32 GetTicksPerField();
|
||||||
|
|
|
@ -74,7 +74,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
||||||
static std::thread g_save_thread;
|
static std::thread g_save_thread;
|
||||||
|
|
||||||
// Don't forget to increase this after doing changes on the savestate system
|
// Don't forget to increase this after doing changes on the savestate system
|
||||||
constexpr u32 STATE_VERSION = 120; // Last changed in PR 8904
|
constexpr u32 STATE_VERSION = 121; // Last changed in PR 8988
|
||||||
|
|
||||||
// Maps savestate versions to Dolphin versions.
|
// Maps savestate versions to Dolphin versions.
|
||||||
// Versions after 42 don't need to be added to this list,
|
// Versions after 42 don't need to be added to this list,
|
||||||
|
|
|
@ -186,11 +186,11 @@ bool FrameDump::CreateVideoFile()
|
||||||
s_codec_context->codec_tag = MKTAG('X', 'V', 'I', 'D');
|
s_codec_context->codec_tag = MKTAG('X', 'V', 'I', 'D');
|
||||||
|
|
||||||
s_codec_context->codec_type = AVMEDIA_TYPE_VIDEO;
|
s_codec_context->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||||
s_codec_context->bit_rate = g_Config.iBitrateKbps * 1000;
|
s_codec_context->bit_rate = static_cast<int64_t>(g_Config.iBitrateKbps) * 1000;
|
||||||
s_codec_context->width = s_width;
|
s_codec_context->width = s_width;
|
||||||
s_codec_context->height = s_height;
|
s_codec_context->height = s_height;
|
||||||
s_codec_context->time_base.num = 1;
|
s_codec_context->time_base.num = VideoInterface::GetTargetRefreshRateDenominator();
|
||||||
s_codec_context->time_base.den = VideoInterface::GetTargetRefreshRate();
|
s_codec_context->time_base.den = VideoInterface::GetTargetRefreshRateNumerator();
|
||||||
s_codec_context->gop_size = 1;
|
s_codec_context->gop_size = 1;
|
||||||
s_codec_context->level = 1;
|
s_codec_context->level = 1;
|
||||||
s_codec_context->pix_fmt = g_Config.bUseFFV1 ? AV_PIX_FMT_BGR0 : AV_PIX_FMT_YUV420P;
|
s_codec_context->pix_fmt = g_Config.bUseFFV1 ? AV_PIX_FMT_BGR0 : AV_PIX_FMT_YUV420P;
|
||||||
|
|
Loading…
Reference in New Issue