Extend QSV resolution check for Ivy Bridge

master
palana 2013-12-04 19:31:51 +01:00
parent d84552ad82
commit 0e9663f696
1 changed files with 34 additions and 10 deletions

View File

@ -140,18 +140,42 @@ namespace
return true;
}
bool is_sandy_bridge()
enum qsv_cpu_platform
{
QSV_CPU_PLATFORM_UNKNOWN,
QSV_CPU_PLATFORM_SNB,
QSV_CPU_PLATFORM_IVB,
QSV_CPU_PLATFORM_HSW
};
qsv_cpu_platform qsv_get_cpu_platform()
{
int cpuInfo[4];
__cpuid(cpuInfo, 1);
BYTE model = ((cpuInfo[0]>>4) & 0xF) + ((cpuInfo[0]>>12) & 0xF0);
BYTE family = ((cpuInfo[0]>>8) & 0xF) + ((cpuInfo[0]>>20) & 0xFF);
BYTE model = ((cpuInfo[0] >> 4) & 0xF) + ((cpuInfo[0] >> 12) & 0xF0);
BYTE family = ((cpuInfo[0] >> 8) & 0xF) + ((cpuInfo[0] >> 20) & 0xFF);
// See Intel 64 and IA-32 Architectures Software Developer's Manual, Vol 3C Table 35-1
if(family != 6)
return false;
if (family != 6)
return QSV_CPU_PLATFORM_UNKNOWN;
return model == 0x2A || model == 0x2D;
switch (model)
{
case 0x2a:
case 0x2d:
return QSV_CPU_PLATFORM_SNB;
case 0x3a:
case 0x3e:
return QSV_CPU_PLATFORM_IVB;
case 0x3c:
case 0x45:
case 0x46:
return QSV_CPU_PLATFORM_HSW;
}
return QSV_CPU_PLATFORM_UNKNOWN;
}
}
@ -257,14 +281,14 @@ public:
QSVEncoder(int fps, int width, int height, int quality, CTSTR preset, bool bUse444, ColorDescription &colorDesc, int maxBitrate, int bufferSize, bool bUseCFR_)
: fps(fps), bFirstFrameProcessed(false), width(width), height(height), max_bitrate(maxBitrate)
{
if(is_sandy_bridge())
if(qsv_get_cpu_platform() <= QSV_CPU_PLATFORM_IVB)
{
if(width > 1920 && height > 1200)
CrashError(TEXT("Your output resolution of %ux%u exceeds the maximum of 1920x1200 supported by QuickSync on Sandy Bridge based processors"), width, height);
CrashError(TEXT("Your output resolution of %ux%u exceeds the maximum of 1920x1200 supported by QuickSync on Sandy Bridge and Ivy Bridge based processors"), width, height);
else if(width > 1920)
CrashError(TEXT("Your output resolution width of %u exceeds the maximum of 1920 supported by QuickSync on Sandy Bridge based processors"), width);
CrashError(TEXT("Your output resolution width of %u exceeds the maximum of 1920 supported by QuickSync on Sandy Bridge and Ivy Bridge based processors"), width);
else if(height > 1200)
CrashError(TEXT("Your output resolution height of %u exceeds the maximum of 1200 supported by QuickSync on Sandy Bridge based processors"), height);
CrashError(TEXT("Your output resolution height of %u exceeds the maximum of 1200 supported by QuickSync on Sandy Bridge and Ivy Bridge based processors"), height);
}
bUseCBR = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseCBR")) != 0;