Skip to content

Commit

Permalink
Revert the default input format change
Browse files Browse the repository at this point in the history
Bump version
  • Loading branch information
CrendKing committed Jun 12, 2021
1 parent e6341b4 commit c38911d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Run uninstall.bat to unregister the filters and clean up user data.

### Common

By default, 10-bit and 16-bit input formats are not enabled for compatibility reasons. If you have a 10/16-bit capable video renderer installed, you can enable them by ticking the relevant checkboxes in the filter's settings page. On the other hand, if you don't have a said video renderer installed while enabling these input formats, you might experience compatibility issue and reduced video qualities.
By default, 10-bit and 16-bit input formats are enabled for best video quality. However, not all video renderers are capable of processing these data. If you do not have such a video renderer installed, leaving these options on might cause compatibility issues. In that case, you should open the settings page of the filter and untick the relevant checkboxes.

Examples of 10/16-bit capable video renderers: [madVR](http://madvr.com/), [MPC Video Renderer](https://github.com/Aleksoid1978/VideoRenderer).

Expand Down
24 changes: 12 additions & 12 deletions avisynth_filter/src/format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,30 @@ namespace SynthFilter {
// for each group of formats with the same format ID, they should appear with the most preferred -> list preferred order
const std::vector<Format::PixelFormat> Format::PIXEL_FORMATS = {
// 4:2:0
{ .name = L"NV12", .mediaSubtype = MEDIASUBTYPE_NV12, .fsFormatId = VideoInfo::CS_YV12, .bitCount = 12, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_NV12, .enabledByDefault = true },
{ .name = L"YV12", .mediaSubtype = MEDIASUBTYPE_YV12, .fsFormatId = VideoInfo::CS_YV12, .bitCount = 12, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YV12, .enabledByDefault = true },
{ .name = L"I420", .mediaSubtype = MEDIASUBTYPE_I420, .fsFormatId = VideoInfo::CS_YV12, .bitCount = 12, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_I420, .enabledByDefault = true },
{ .name = L"IYUV", .mediaSubtype = MEDIASUBTYPE_IYUV, .fsFormatId = VideoInfo::CS_YV12, .bitCount = 12, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_IYUV, .enabledByDefault = true },
{ .name = L"NV12", .mediaSubtype = MEDIASUBTYPE_NV12, .fsFormatId = VideoInfo::CS_YV12, .bitCount = 12, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_NV12 },
{ .name = L"YV12", .mediaSubtype = MEDIASUBTYPE_YV12, .fsFormatId = VideoInfo::CS_YV12, .bitCount = 12, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YV12 },
{ .name = L"I420", .mediaSubtype = MEDIASUBTYPE_I420, .fsFormatId = VideoInfo::CS_YV12, .bitCount = 12, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_I420 },
{ .name = L"IYUV", .mediaSubtype = MEDIASUBTYPE_IYUV, .fsFormatId = VideoInfo::CS_YV12, .bitCount = 12, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_IYUV },

// P010 has the most significant 6 bits zero-padded, while AviSynth expects the least significant bits padded
// P010 without right shifting 6 bits on every WORD is equivalent to P016, without precision loss
{ .name = L"P016", .mediaSubtype = MEDIASUBTYPE_P016, .fsFormatId = VideoInfo::CS_YUV420P16, .bitCount = 24, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P016, .enabledByDefault = false },
{ .name = L"P010", .mediaSubtype = MEDIASUBTYPE_P010, .fsFormatId = VideoInfo::CS_YUV420P16, .bitCount = 24, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P010, .enabledByDefault = false },
{ .name = L"P016", .mediaSubtype = MEDIASUBTYPE_P016, .fsFormatId = VideoInfo::CS_YUV420P16, .bitCount = 24, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P016 },
{ .name = L"P010", .mediaSubtype = MEDIASUBTYPE_P010, .fsFormatId = VideoInfo::CS_YUV420P16, .bitCount = 24, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P010 },

// 4:2:2
// YUY2 interleaves Y and UV planes together, thus twice as wide as unpacked formats per pixel
{ .name = L"YUY2", .mediaSubtype = MEDIASUBTYPE_YUY2, .fsFormatId = VideoInfo::CS_YUY2, .bitCount = 16, .componentsPerPixel = 2, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YUY2, .enabledByDefault = true },
{ .name = L"YUY2", .mediaSubtype = MEDIASUBTYPE_YUY2, .fsFormatId = VideoInfo::CS_YUY2, .bitCount = 16, .componentsPerPixel = 2, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YUY2 },
// AviSynth+ does not support UYVY
// P210 has the same problem as P010
{ .name = L"P216", .mediaSubtype = MEDIASUBTYPE_P216, .fsFormatId = VideoInfo::CS_YUV422P16, .bitCount = 32, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P216, .enabledByDefault = false },
{ .name = L"P210", .mediaSubtype = MEDIASUBTYPE_P210, .fsFormatId = VideoInfo::CS_YUV422P16, .bitCount = 32, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P210, .enabledByDefault = false },
{ .name = L"P216", .mediaSubtype = MEDIASUBTYPE_P216, .fsFormatId = VideoInfo::CS_YUV422P16, .bitCount = 32, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P216 },
{ .name = L"P210", .mediaSubtype = MEDIASUBTYPE_P210, .fsFormatId = VideoInfo::CS_YUV422P16, .bitCount = 32, .componentsPerPixel = 1, .subsampleWidthRatio = 2, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P210 },

// 4:4:4
{ .name = L"YV24", .mediaSubtype = MEDIASUBTYPE_YV24, .fsFormatId = VideoInfo::CS_YV24, .bitCount = 24, .componentsPerPixel = 1, .subsampleWidthRatio = 1, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YV24, .enabledByDefault = true },
{ .name = L"YV24", .mediaSubtype = MEDIASUBTYPE_YV24, .fsFormatId = VideoInfo::CS_YV24, .bitCount = 24, .componentsPerPixel = 1, .subsampleWidthRatio = 1, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YV24 },

// RGB
{ .name = L"RGB24", .mediaSubtype = MEDIASUBTYPE_RGB24, .fsFormatId = VideoInfo::CS_BGR24, .bitCount = 24, .componentsPerPixel = 3, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_RGB24, .enabledByDefault = true },
{ .name = L"RGB32", .mediaSubtype = MEDIASUBTYPE_RGB32, .fsFormatId = VideoInfo::CS_BGR32, .bitCount = 32, .componentsPerPixel = 4, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_RGB32, .enabledByDefault = true },
{ .name = L"RGB24", .mediaSubtype = MEDIASUBTYPE_RGB24, .fsFormatId = VideoInfo::CS_BGR24, .bitCount = 24, .componentsPerPixel = 3, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_RGB24 },
{ .name = L"RGB32", .mediaSubtype = MEDIASUBTYPE_RGB32, .fsFormatId = VideoInfo::CS_BGR32, .bitCount = 32, .componentsPerPixel = 4, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_RGB32 },
// RGB48 will not work because LAV Filters outputs R-G-B pixel order while AviSynth+ expects B-G-R
};

Expand Down
4 changes: 2 additions & 2 deletions filter_common/src/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ auto Environment::LoadSettingsFromIni() -> void {

std::ranges::for_each(Format::PIXEL_FORMATS, [this](const Format::PixelFormat &format) {
const std::wstring settingName = std::format(L"{}{}", SETTING_NAME_INPUT_FORMAT_PREFIX, format.name);
if (_ini.GetBoolValue(L"", settingName.c_str(), format.enabledByDefault)) {
if (_ini.GetBoolValue(L"", settingName.c_str(), true)) {
_enabledInputFormats.emplace(format.name);
}
});
Expand All @@ -135,7 +135,7 @@ auto Environment::LoadSettingsFromRegistry() -> void {

std::ranges::for_each(Format::PIXEL_FORMATS, [this](const Format::PixelFormat &format) {
const std::wstring settingName = std::format(L"{}{}", SETTING_NAME_INPUT_FORMAT_PREFIX, format.name);
if (_registry.ReadNumber(settingName.c_str(), format.enabledByDefault) != 0) {
if (_registry.ReadNumber(settingName.c_str(), 1) != 0) {
_enabledInputFormats.emplace(format.name);
}
});
Expand Down
1 change: 0 additions & 1 deletion filter_common/src/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class Format {
bool areUVPlanesInterleaved;

int resourceId;
bool enabledByDefault;
};

struct VideoFormat {
Expand Down
2 changes: 1 addition & 1 deletion filter_common/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace SynthFilter {
#define FILTER_NAME_WIDE WIDEN(FILTER_NAME_BASE)
#define FILTER_VERSION_MAJOR 1
#define FILTER_VERSION_MINOR 1
#define FILTER_VERSION_PATCH 0
#define FILTER_VERSION_PATCH 1
#define FILTER_VERSION_STRING STRINGIZE(FILTER_VERSION_MAJOR) "." STRINGIZE(FILTER_VERSION_MINOR) "." STRINGIZE(FILTER_VERSION_PATCH) FILTER_VARIANT " # " FILTER_GIT_HASH
}
22 changes: 11 additions & 11 deletions vapoursynth_filter/src/format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ namespace SynthFilter {
// for each group of formats with the same format ID, they should appear with the most preferred -> list preferred order
const std::vector<Format::PixelFormat> Format::PIXEL_FORMATS = {
// 4:2:0
{ .name = L"NV12", .mediaSubtype = MEDIASUBTYPE_NV12, .fsFormatId = pfYUV420P8, .bitCount = 12, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_NV12, .enabledByDefault = true },
{ .name = L"YV12", .mediaSubtype = MEDIASUBTYPE_YV12, .fsFormatId = pfYUV420P8, .bitCount = 12, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YV12, .enabledByDefault = true },
{ .name = L"I420", .mediaSubtype = MEDIASUBTYPE_I420, .fsFormatId = pfYUV420P8, .bitCount = 12, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_I420, .enabledByDefault = true },
{ .name = L"IYUV", .mediaSubtype = MEDIASUBTYPE_IYUV, .fsFormatId = pfYUV420P8, .bitCount = 12, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_IYUV, .enabledByDefault = true },
{ .name = L"NV12", .mediaSubtype = MEDIASUBTYPE_NV12, .fsFormatId = pfYUV420P8, .bitCount = 12, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_NV12 },
{ .name = L"YV12", .mediaSubtype = MEDIASUBTYPE_YV12, .fsFormatId = pfYUV420P8, .bitCount = 12, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YV12 },
{ .name = L"I420", .mediaSubtype = MEDIASUBTYPE_I420, .fsFormatId = pfYUV420P8, .bitCount = 12, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_I420 },
{ .name = L"IYUV", .mediaSubtype = MEDIASUBTYPE_IYUV, .fsFormatId = pfYUV420P8, .bitCount = 12, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_IYUV },

// P010 has the most significant 6 bits zero-padded, while VapourSynth expects the least significant bits padded
// P010 without right shifting 6 bits on every WORD is equivalent to P016, without precision loss
{ .name = L"P016", .mediaSubtype = MEDIASUBTYPE_P016, .fsFormatId = pfYUV420P16, .bitCount = 24, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P016, .enabledByDefault = false },
{ .name = L"P010", .mediaSubtype = MEDIASUBTYPE_P010, .fsFormatId = pfYUV420P16, .bitCount = 24, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P010, .enabledByDefault = false },
{ .name = L"P016", .mediaSubtype = MEDIASUBTYPE_P016, .fsFormatId = pfYUV420P16, .bitCount = 24, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P016 },
{ .name = L"P010", .mediaSubtype = MEDIASUBTYPE_P010, .fsFormatId = pfYUV420P16, .bitCount = 24, .subsampleWidthRatio = 2, .subsampleHeightRatio = 2, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P010 },

// 4:2:2
{ .name = L"YUY2", .mediaSubtype = MEDIASUBTYPE_YUY2, .fsFormatId = pfCompatYUY2, .bitCount = 16, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YUY2, .enabledByDefault = true },
{ .name = L"YUY2", .mediaSubtype = MEDIASUBTYPE_YUY2, .fsFormatId = pfCompatYUY2, .bitCount = 16, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YUY2 },
// P210 has the same problem as P010
{ .name = L"P216", .mediaSubtype = MEDIASUBTYPE_P216, .fsFormatId = pfYUV422P16, .bitCount = 32, .subsampleWidthRatio = 2, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P216, .enabledByDefault = false },
{ .name = L"P210", .mediaSubtype = MEDIASUBTYPE_P210, .fsFormatId = pfYUV422P16, .bitCount = 32, .subsampleWidthRatio = 2, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P210, .enabledByDefault = false },
{ .name = L"P216", .mediaSubtype = MEDIASUBTYPE_P216, .fsFormatId = pfYUV422P16, .bitCount = 32, .subsampleWidthRatio = 2, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P216 },
{ .name = L"P210", .mediaSubtype = MEDIASUBTYPE_P210, .fsFormatId = pfYUV422P16, .bitCount = 32, .subsampleWidthRatio = 2, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = true, .resourceId = IDC_INPUT_FORMAT_P210 },

// 4:4:4
{ .name = L"YV24", .mediaSubtype = MEDIASUBTYPE_YV24, .fsFormatId = pfYUV444P8, .bitCount = 24, .subsampleWidthRatio = 1, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YV24, .enabledByDefault = true },
{ .name = L"YV24", .mediaSubtype = MEDIASUBTYPE_YV24, .fsFormatId = pfYUV444P8, .bitCount = 24, .subsampleWidthRatio = 1, .subsampleHeightRatio = 1, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_YV24 },

// RGB
{ .name = L"RGB32", .mediaSubtype = MEDIASUBTYPE_RGB32, .fsFormatId = pfCompatBGR32, .bitCount = 32, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_RGB32, .enabledByDefault = true },
{ .name = L"RGB32", .mediaSubtype = MEDIASUBTYPE_RGB32, .fsFormatId = pfCompatBGR32, .bitCount = 32, .subsampleWidthRatio = 0, .subsampleHeightRatio = 0, .areUVPlanesInterleaved = false, .resourceId = IDC_INPUT_FORMAT_RGB32 },
// RGB48 will not work because LAV Filters outputs R-G-B pixel order while AviSynth+ expects B-G-R
};

Expand Down

0 comments on commit c38911d

Please sign in to comment.