From 3020bed04f4af26548141c9da784e2861202824b Mon Sep 17 00:00:00 2001 From: for13to1 Date: Sat, 25 Nov 2023 17:45:20 +0800 Subject: [PATCH 1/4] bugfix: failed to obtain frameSize when open rawfile --- YUViewLib/src/common/Typedef.h | 2 +- YUViewLib/src/playlistitem/playlistItems.cpp | 4 +++- YUViewUnitTest/video/yuv/yuv.pro | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/YUViewLib/src/common/Typedef.h b/YUViewLib/src/common/Typedef.h index 201ccaf9f..6762e4dcb 100644 --- a/YUViewLib/src/common/Typedef.h +++ b/YUViewLib/src/common/Typedef.h @@ -278,7 +278,7 @@ struct Size { return this->width != other.width || this->height != other.height; } - constexpr bool isValid() const { return this->width != 0 && this->height != 0; } + constexpr bool isValid() const { return this->width > 0 && this->height > 0; } unsigned width{}; unsigned height{}; }; diff --git a/YUViewLib/src/playlistitem/playlistItems.cpp b/YUViewLib/src/playlistitem/playlistItems.cpp index 00851d7b2..c8f0252a2 100644 --- a/YUViewLib/src/playlistitem/playlistItems.cpp +++ b/YUViewLib/src/playlistitem/playlistItems.cpp @@ -113,7 +113,9 @@ playlistItem *createPlaylistItemFromFile(QWidget *parent, const QString &fileNam if (allExtensions.contains(ext)) { - playlistItemRawFile *newRawFile = new playlistItemRawFile(fileName); + QSize size(0, 0); + QString sourcePixelFormat = ""; + playlistItemRawFile *newRawFile = new playlistItemRawFile(fileName, size, sourcePixelFormat, ext); return newRawFile; } } diff --git a/YUViewUnitTest/video/yuv/yuv.pro b/YUViewUnitTest/video/yuv/yuv.pro index 03635a97f..c727fb16c 100644 --- a/YUViewUnitTest/video/yuv/yuv.pro +++ b/YUViewUnitTest/video/yuv/yuv.pro @@ -2,5 +2,5 @@ TEMPLATE = subdirs requires(qtHaveModule(testlib)) -SUBDIRS = PixelFormatYUVTest/ \ +SUBDIRS = PixelFormatYUVTest \ PixelFormatYUVGuessTest From 48f26cafcb6094f2cb7789fd0e10ad179dea4b68 Mon Sep 17 00:00:00 2001 From: for13to1 Date: Tue, 28 Nov 2023 02:04:32 +0800 Subject: [PATCH 2/4] recognize *.rgba file Signed-off-by: for13to1 --- .../src/playlistitem/playlistItemRawFile.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/YUViewLib/src/playlistitem/playlistItemRawFile.cpp b/YUViewLib/src/playlistitem/playlistItemRawFile.cpp index 474df60fa..185d33e91 100644 --- a/YUViewLib/src/playlistitem/playlistItemRawFile.cpp +++ b/YUViewLib/src/playlistitem/playlistItemRawFile.cpp @@ -75,7 +75,7 @@ playlistItemRawFile::playlistItemRawFile(const QString &rawFilePath, QFileInfo fi(rawFilePath); QString ext = fi.suffix(); ext = ext.toLower(); - if (ext == "yuv" || ext == "nv21" || fmt.toLower() == "yuv" || ext == "y4m") + if (ext == "yuv" || ext == "nv21" || ext == "y4m" || fmt.toLower() == "yuv") { this->video = std::make_unique(); this->rawFormat = video::RawFormat::YUV; @@ -85,6 +85,12 @@ playlistItemRawFile::playlistItemRawFile(const QString &rawFilePath, this->video = std::make_unique(); this->rawFormat = video::RawFormat::RGB; } + else if (ext == "rgba" || ext == "gbra" || ext == "bgra" || ext == "brga" || + ext == "argb" || ext == "agbr" || ext == "abgr" || ext == "abrg") + { + this->video = std::make_unique(); + this->rawFormat = video::RawFormat::RGB; + } else Q_ASSERT_X(false, Q_FUNC_INFO, "No video handler for the raw file format found."); @@ -558,8 +564,22 @@ void playlistItemRawFile::getSupportedFileExtensions(QStringList &allExtensions, allExtensions.append("nv21"); allExtensions.append("y4m"); + allExtensions.append("rgba"); + allExtensions.append("rbga"); + allExtensions.append("grba"); + allExtensions.append("gbra"); + allExtensions.append("brga"); + allExtensions.append("bgra"); + allExtensions.append("argb"); + allExtensions.append("arbg"); + allExtensions.append("agrb"); + allExtensions.append("agbr"); + allExtensions.append("abrg"); + allExtensions.append("abgr"); + filters.append("Raw YUV File (*.yuv *.nv21)"); filters.append("Raw RGB File (*.rgb *.rbg *.grb *.gbr *.brg *.bgr)"); + filters.append("Raw RGBA File (*.rgba *.rbga *.grba *.gbra *.brga *.bgra *.argb *.arbg *.agrb *.agbr *.abrg *.abgr)"); filters.append("YUV4MPEG2 File (*.y4m)"); } From d3377e9de75dda6431f708bbac922d9edb635960 Mon Sep 17 00:00:00 2001 From: for13to1 Date: Thu, 7 Dec 2023 00:00:10 +0800 Subject: [PATCH 3/4] recover from official develop branch --- YUViewLib/src/playlistitem/playlistItems.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/YUViewLib/src/playlistitem/playlistItems.cpp b/YUViewLib/src/playlistitem/playlistItems.cpp index c8f0252a2..00851d7b2 100644 --- a/YUViewLib/src/playlistitem/playlistItems.cpp +++ b/YUViewLib/src/playlistitem/playlistItems.cpp @@ -113,9 +113,7 @@ playlistItem *createPlaylistItemFromFile(QWidget *parent, const QString &fileNam if (allExtensions.contains(ext)) { - QSize size(0, 0); - QString sourcePixelFormat = ""; - playlistItemRawFile *newRawFile = new playlistItemRawFile(fileName, size, sourcePixelFormat, ext); + playlistItemRawFile *newRawFile = new playlistItemRawFile(fileName); return newRawFile; } } From 9cf9b687e16ded39b3f5f6000fdfd0cbb2078cf0 Mon Sep 17 00:00:00 2001 From: for13to1 Date: Thu, 7 Dec 2023 00:40:49 +0800 Subject: [PATCH 4/4] recover from official develop branch to publish bugfix --- YUViewLib/src/common/Typedef.h | 2 +- .../src/playlistitem/playlistItemRawFile.cpp | 22 +------------------ 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/YUViewLib/src/common/Typedef.h b/YUViewLib/src/common/Typedef.h index 23fbf0334..12a44b90c 100644 --- a/YUViewLib/src/common/Typedef.h +++ b/YUViewLib/src/common/Typedef.h @@ -273,7 +273,7 @@ struct Size { return this->width != other.width || this->height != other.height; } - constexpr bool isValid() const { return this->width > 0 && this->height > 0; } + constexpr bool isValid() const { return this->width != 0 && this->height != 0; } unsigned width{}; unsigned height{}; }; diff --git a/YUViewLib/src/playlistitem/playlistItemRawFile.cpp b/YUViewLib/src/playlistitem/playlistItemRawFile.cpp index 9a0d77bf9..d4f409a62 100644 --- a/YUViewLib/src/playlistitem/playlistItemRawFile.cpp +++ b/YUViewLib/src/playlistitem/playlistItemRawFile.cpp @@ -77,7 +77,7 @@ playlistItemRawFile::playlistItemRawFile(const QString &rawFilePath, QFileInfo fi(rawFilePath); QString ext = fi.suffix(); ext = ext.toLower(); - if (ext == "yuv" || ext == "nv21" || ext == "y4m" || fmt.toLower() == "yuv") + if (ext == "yuv" || ext == "nv21" || fmt.toLower() == "yuv" || ext == "y4m") { this->video = std::make_unique(); this->rawFormat = video::RawFormat::YUV; @@ -87,12 +87,6 @@ playlistItemRawFile::playlistItemRawFile(const QString &rawFilePath, this->video = std::make_unique(); this->rawFormat = video::RawFormat::RGB; } - else if (ext == "rgba" || ext == "gbra" || ext == "bgra" || ext == "brga" || - ext == "argb" || ext == "agbr" || ext == "abgr" || ext == "abrg") - { - this->video = std::make_unique(); - this->rawFormat = video::RawFormat::RGB; - } else Q_ASSERT_X(false, Q_FUNC_INFO, "No video handler for the raw file format found."); @@ -566,22 +560,8 @@ void playlistItemRawFile::getSupportedFileExtensions(QStringList &allExtensions, allExtensions.append("nv21"); allExtensions.append("y4m"); - allExtensions.append("rgba"); - allExtensions.append("rbga"); - allExtensions.append("grba"); - allExtensions.append("gbra"); - allExtensions.append("brga"); - allExtensions.append("bgra"); - allExtensions.append("argb"); - allExtensions.append("arbg"); - allExtensions.append("agrb"); - allExtensions.append("agbr"); - allExtensions.append("abrg"); - allExtensions.append("abgr"); - filters.append("Raw YUV File (*.yuv *.nv21)"); filters.append("Raw RGB File (*.rgb *.rbg *.grb *.gbr *.brg *.bgr)"); - filters.append("Raw RGBA File (*.rgba *.rbga *.grba *.gbra *.brga *.bgra *.argb *.arbg *.agrb *.agbr *.abrg *.abgr)"); filters.append("YUV4MPEG2 File (*.y4m)"); }