instruction stringclasses 9
values | input stringlengths 279 5.47k | output stringlengths 6 9.58k |
|---|---|---|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/test/test_animation.cpp
**Change Type:** modified
**Context:** PR #26688: Animated GIF APNG WEBP AVIF revisions
**Review Line:** 402
**Code Changes:**
```diff
+
+ // Read back the still images into a vector of Mats.
+ EXPECT_TRUE(imreadmulti(output, apng_frames));
+
+ // Expect all... | CV_16U Mats converted to CV_8U internally. so i did not do frames comparison. frankly handling CV_16U probably crude and need extra work if needed. i did not find 16U APNGs to test well. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #26714: fix for png durations and memory leak
**Code Changes:**
```diff
@@ -404,7 +404,6 @@ bool PngDecoder::readData( Mat& img )
fseek(m_f, -8, SEEK_CUR);
else
m_buf_pos -= 8;
-
... | Please cite your source, there are several implementations: https://github.com/davidmz/apng-js/blob/e5272dcd6900cbea2c341ce259c206a162cedec8/src/library/parser.js#L64 https://github.com/FFmpeg/FFmpeg/blob/19c95ecbff84eebca254d200c941ce07868ee707/libavformat/apngdec.c#L259 I believe the spec says differently though: htt... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #26714: fix for png durations and memory leak
**Code Changes:**
```diff
@@ -404,7 +404,6 @@ bool PngDecoder::readData( Mat& img )
fseek(m_f, -8, SEEK_CUR);
else
m_buf_pos -= 8;
-
... | for example delaynum 1 delayden 24 it means 1000 / 24 40 ms for example delaynum 4 delayden 100 it means 1000 / 100 * 4 40 ms |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #26714: fix for png durations and memory leak
**Code Changes:**
```diff
@@ -404,7 +404,6 @@ bool PngDecoder::readData( Mat& img )
fseek(m_f, -8, SEEK_CUR);
else
m_buf_pos -= 8;
-
... | when saving for example 80 ms delay num 80 delayden 1000 it means 1000 / 1000 * 80 80 ms |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/videoio/src/cap_android_mediandk.cpp
**Change Type:** modified
**Context:** PR #26656: AndroidMediaNdkCapture pixel format enhancement
**Review Line:** 65
**Code Changes:**
```diff
sawInputEOS(false), sawOutputEOS(false),
- frameStride(0), frameWidth(0), frameHeight(0), colorFormat(0)... | Attention: default output become BGR for Android too. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/hough.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -120,7 +120,7 @@ static void
HoughLinesStandard( InputArray src, OutputArray lines, int type,
float rho, float theta,
int threshold, ... | `if` in inner loops is slow. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -2165,11 +2165,13 @@ Must fall between 0 and max_theta.
@param max_theta For standard and multi-scale Hough transform, an upper bound for the angle.
Must fall b... | No such params. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/hough.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -120,7 +120,7 @@ static void
HoughLinesStandard( InputArray src, OutputArray lines, int type,
float rho, float theta,
int threshold, ... | I moved if(use_edgeval) to outside of for loop. But I still remain to use this bool; use_edgeval to avoid code duplication, instead of defining another Hough function. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -2165,11 +2165,13 @@ Must fall between 0 and max_theta.
@param max_theta For standard and multi-scale Hough transform, an upper bound for the angle.
Must fall b... | I'm sorry, it was my mistake. I updated it. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -15,22 +15,27 @@ using namespace std;
/// Global variables
/** General variables */
-Mat src, edges;
+Mat src, canny_edge, sobel_edge;
Mat src_gra... | No need to use sprintf here. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.markdown
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -83,7 +83,7 @@ Arranging the terms: \f$r = x \cos \theta + y \sin \theta\f$
### Standard and Probabilistic Hough Line Transform
-OpenCV i... | Better wording: ``` - Uses edge intensity instead binary 0 or 1 values in standard Hough transform. ``` |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.markdown
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Review Line:** 100
**Code Changes:**
```diff
@@ -97,6 +97,12 @@ b. **The Probabilistic Hough Line Transform**
of the detected lines \f$(x_{0}, y_{0}, x_{1}, y_{1... | Line 86 should be "OpenCV implements three kind of Hough Line Transforms:" |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -15,22 +15,27 @@ using namespace std;
/// Global variables
/** General variables */
-Mat src, edges;
+Mat src, canny_edge, sobel_edge;
Mat src_gra... | I want to add Edge threshold slider as this figure (  ), because weighted Hough depends on edge amount. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_houghlines.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -340,6 +340,53 @@ TEST(HoughLines, regression_21983)
EXPECT_NEAR(lines[0][1], 1.57179642, 1e-4);
}
+TEST(WeightedHoughLines, horizontal)
+{
+ Mat img(25, ... | Signature for `_EQ` is `ASSERT_EQ(expected_reference, actual_result);`. Correct order of parameters are required to emit valid error messages. Reference: https://github.com/opencv/opencv/blob/4.0.0/modules/ts/include/opencv2/ts/ts_gtest.h#L8196-L8200 ``` GTEST_API_ AssertionResult EqFailure(const char* expected_express... |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_houghlines.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Review Line:** 355
**Code Changes:**
```diff
+
+ // detect lines
+ std::vector<Vec2f> lines;
+ int threshold{220*25-1};
+ bool use_edgeval{true};
+ HoughLines(img, lines, 1, CV_... | BTW, test doesn't look representative. ``` int threshold{25-1}; HoughLines(img, lines, 1, CV_PI/180, threshold, 0, 0, 0.0, CV_PI); ``` works well without this patch. if HoughLines() input comes from Canny() then this input is in set of `[0, 255]` without intermediate values. How is intermediate values could be prepared... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_houghlines.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -340,6 +340,53 @@ TEST(HoughLines, regression_21983)
EXPECT_NEAR(lines[0][1], 1.57179642, 1e-4);
}
+TEST(WeightedHoughLines, horizontal)
+{
+ Mat img(25, ... | I'm sorry. I fixed it. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_houghlines.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Review Line:** 355
**Code Changes:**
```diff
+
+ // detect lines
+ std::vector<Vec2f> lines;
+ int threshold{220*25-1};
+ bool use_edgeval{true};
+ HoughLines(img, lines, 1, CV_... | Just a moment please for the fixation. I'm still struggling to build latest 4.x branch. I reported my error [here](https://github.com/opencv/opencv/issues/26620) |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_houghlines.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Review Line:** 355
**Code Changes:**
```diff
+
+ // detect lines
+ std::vector<Vec2f> lines;
+ int threshold{220*25-1};
+ bool use_edgeval{true};
+ HoughLines(img, lines, 1, CV_... | Now I fixed the unit test. and confirmed it. If I set " use_edgeval{false}" for both TEST(WeightedHoughLines, horizontal), and TEST(WeightedHoughLines, diagonal), and run the command; ```bash $ ./ext/sensyn-opencv/bin/opencv_test_imgproc --gtest_filter=WeightedHoughLines.* ``` , it fails as below; ```test_log [========... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Review Line:** 176
**Code Changes:**
```diff
+ double x0 = r*cos_t, y0 = r*sin_t;
+ double alpha = 1000;
+
+ Point pt1( cvRound(x0 + alpha*(-sin_t)), cvRound(y0 +... | Classic Hough transform and probablistic versions return lines in Cartesian coordinate system. You version implements polar version. I propose to return back to Cartesian and I'll merge the patch. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Review Line:** 176
**Code Changes:**
```diff
+ double x0 = r*cos_t, y0 = r*sin_t;
+ double alpha = 1000;
+
+ Point pt1( cvRound(x0 + alpha*(-sin_t)), cvRound(y0 +... | I'm very sorry for not being able to fix nor respond. When I have time, I will definitely fix based on your request. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -15,22 +15,27 @@ using namespace std;
/// Global variables
/** General variables */
-Mat src, edges;
+Mat src, canny_edge, sobel_edge;
Mat src_gra... | MS Visual Studio reports warning here. Please use 100000. See CI logs for details. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -15,22 +15,27 @@ using namespace std;
/// Global variables
/** General variables */
-Mat src, edges;
+Mat src, canny_edge, sobel_edge;
Mat src_gra... | Oh I'm very sorry. Now I'm fixing and checking the build procedure. I will push after I confirmed it build without error. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
**Change Type:** modified
**Context:** PR #21407: Feature: weighted hough
**Code Changes:**
```diff
@@ -15,22 +15,27 @@ using namespace std;
/// Global variables
/** General variables */
-Mat src, edges;
+Mat src, canny_edge, sobel_edge;
Mat src_gra... | I think I fixed the 2 errors in the CI. But github workflow seems only run on branch 4.x, so I couldn't confirmed the fixation. Could you check it by running CI? |
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback. | **File:** platforms/android/default.config.py
**Change Type:** added
**Context:** PR #26057: Android builds update
**Code Changes:**
```diff
@@ -0,0 +1,6 @@
+ABIs = [
+ ABI("2", "armeabi-v7a", None, 21, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
+ ABI("3", "arm64-v8a", None, 21, cmake_vars=dict(AND... | Makes sense for "Android NDK r27 and higher" according to documentation. Why do not enable that by default in the main build_sdk.py script? |
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback. | **File:** platforms/android/default.config.py
**Change Type:** added
**Context:** PR #26057: Android builds update
**Code Changes:**
```diff
@@ -0,0 +1,6 @@
+ABIs = [
+ ABI("2", "armeabi-v7a", None, 21, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
+ ABI("3", "arm64-v8a", None, 21, cmake_vars=dict(AND... | I want to switch CI to the default configuration and always build SDK and AAR packages with 16kb pages support. The packages will work with both old and new memory configuration. It just tunes ELF sections alignment a bit. The option will be ignored with NDK before 27. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** platforms/android/default.config.py
**Change Type:** added
**Context:** PR #26057: Android builds update
**Code Changes:**
```diff
@@ -0,0 +1,6 @@
+ABIs = [
+ ABI("2", "armeabi-v7a", None, 21, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
+ ABI("3", "arm64-v8a", None, 21, cmake_vars=dict(AND... | ```suggestion ABI("3", "arm64-v8a", None, 21, cmake_vars=dict(ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES='ON')), ``` |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** platforms/android/default.config.py
**Change Type:** added
**Context:** PR #26057: Android builds update
**Code Changes:**
```diff
@@ -0,0 +1,6 @@
+ABIs = [
+ ABI("2", "armeabi-v7a", None, 21, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
+ ABI("3", "arm64-v8a", None, 21, cmake_vars=dict(AND... | Same issue here: ```suggestion ABI("5", "x86_64", None, 21, cmake_vars=dict(ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES='ON')), ``` |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVCompilerOptions.cmake
**Change Type:** modified
**Context:** PR #26057: Android builds update
**Review Line:** 409
**Code Changes:**
```diff
endif()
endif()
+# For 16k pages support with NDK prior 27
+# Details: https://developer.android.com/guide/practices/page-sizes?hl=en
+if(ANDROID AND ... | > ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES `OPENCV_ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES` to avoid possible conflicts |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.hpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -47,34 +47,124 @@
#include "grfmt_base.hpp"
#include "bitstrm.hpp"
+#include <png.h>
+#include <zlib.h>
namespace cv
{
``` | Shouldn't this function be static? Does it even need to be a member function? |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.hpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -47,34 +47,124 @@
#include "grfmt_base.hpp"
#include "bitstrm.hpp"
+#include <png.h>
+#include <zlib.h>
namespace cv
{
``` | Isn't it the case for the .cpp file though? |
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | If you have a commented block, put it in an `#If 0` and please explain why it is now commented out. |
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | Some of those members are unset right now because the user does not send them. The writemulti API is not good enough to write an animation. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | this part was for only test |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | please sort the headers. iostream is most likely useless. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | those functions belong to an anonymous namespace. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | Please use CV_LOG_DEBUG instead of printf |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | Please use `!isalpha()` |
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | Please do not use new as it makes its hard to track memory. Use std::vector<char> if you can. |
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.hpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -47,34 +47,124 @@
#include "grfmt_base.hpp"
#include "bitstrm.hpp"
+#include <png.h>
+#include <zlib.h>
namespace cv
{
``` | It's ok to keep this API for now, for debugging, but I'd like to see a proper animation API, maybe in private, that starts taking into account the frame durations. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.hpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -47,34 +47,124 @@
#include "grfmt_base.hpp"
#include "bitstrm.hpp"
+#include <png.h>
+#include <zlib.h>
namespace cv
{
``` | this is not standard, please use `unsigned int` or `uint32_t` |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.hpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -47,34 +47,124 @@
#include "grfmt_base.hpp"
#include "bitstrm.hpp"
+#include <png.h>
+#include <zlib.h>
namespace cv
{
``` | please use `unsigned char` |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | mf is not checked. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | fread may read less bytes than expected. Imread should close the file and return false in the case. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | I propose ``` uint32_t PngDecoder::read_chunk(CHUNK& pChunk) ``` NULL is not possible then. |
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | I propose to use `std::vector` or `cv::AutoBuffer` to prevent memory leaks. |
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | The same to prevent leaks. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Review Line:** 1341
**Code Changes:**
```diff
+ {
+ *dp++ = 0;
+ memcpy(dp, row, rowbytes);
+ dp += rowbytes;
+ row += stride;
+ }
+ }
+ ... | For asmorkalov: Need to check. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | Print error with CV_LOG_ERROR and return false from imread. There should not be silent failures. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | It'll be great to use named constants here. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #25715: Animated PNG Support
**Code Changes:**
```diff
@@ -51,21 +51,66 @@
and png2bmp sample from libpng distribution (Copyright (C) 1999-2001 MIYASAKA Masaru)
\***************************************************************... | i think next line do the job ``` if (fread(sig, 1, 8, m_f)) id = read_chunk(m_chunkIHDR); if (!(id == id_IHDR && m_chunkIHDR.size == 25)) return false; ``` |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 52
**Code Changes:**
```diff
@@ -49,6 +49,8 @@
#include <fstream>
+struct WebPAnimDecoder;
+
namespace cv
{
@@ -61,17 +63,24 @@ class WebPDecoder CV_FINAL : public B... | If you forward declare the structs, no need to include the WebP headers. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | No need to forward declare. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindWebP.cmake
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -10,8 +10,6 @@
# Look for the header file.
-unset(WEBP_FOUND)
-
FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
if(NOT WEBP_INCLUDE_DIR)
@@ -21,13 +19,14 @@ else()... | You should only add webpmux and webpdemux if they are found. When building WebP from third_party, it is all bundled in one library. So: ```cmake if(WEBP_MUX_LIBRARY) SET(WEBP_LIBRARIES ${WEBP_LIBRARY} ${WEBP_MUX_LIBRARY}) endif() ``` |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindWebP.cmake
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -10,8 +10,6 @@
# Look for the header file.
-unset(WEBP_FOUND)
-
FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
if(NOT WEBP_INCLUDE_DIR)
@@ -21,13 +19,14 @@ else()... | SET(WEBP_LIBRARIES ${WEBP_LIBRARY}) if(WEBP_MUX_LIBRARY) SET(WEBP_LIBRARIES ${WEBP_LIBRARIES} ${WEBP_MUX_LIBRARY} ${WEBP_DEMUX_LIBRARY}) endif() |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -49,6 +49,8 @@
#include <fstream>
+struct WebPAnimDecoder;
+
namespace cv
{
@@ -61,17 +63,24 @@ class WebPDecoder CV_FINAL : public BaseImageDecoder
``` | Do not include webp here, just forward declare `WebPAnimEncoder` and `WebPAnimDecoder` (`struct WebPAnimEncoder;`) |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindWebP.cmake
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 13
**Code Changes:**
```diff
# Look for the header file.
-unset(WEBP_FOUND)
-
FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
if(NOT WEBP_INCLUDE_DIR)
@@ -21,13 +19,14 @@ else... | do not unset that if you want the CI to pass. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindWebP.cmake
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 13
**Code Changes:**
```diff
# Look for the header file.
-unset(WEBP_FOUND)
-
FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
if(NOT WEBP_INCLUDE_DIR)
@@ -21,13 +19,14 @@ else... | i think Webp version of buildbot should be updated. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindLibsGrfmt.cmake
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 200
**Code Changes:**
```diff
- if(EXISTS "${WEBP_INCLUDE_DIR}/enc/vp8enci.h")
- ocv_parse_header("${WEBP_INCLUDE_DIR}/enc/vp8enci.h" WEBP_VERSION_LINES ENC_MAJ_VERSION ENC_MI... | Indeed, that check should go, this is from WebP 0.5.2 (2017).... https://chromium.googlesource.com/webm/libwebp/+/668e1dd44f7594610b805f8ef8b7d7964777d3e2 It is rather harmless though, did you have a problem with it? |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | You are missing a WebPAnimDecoderDelete. Either you create a destructor for WebPDecoder, either you wrap the pointer in a unique_ptr. E.g., create in the header, a private struct: ```cpp struct UniquePtrDeleter { void operator()(WebPAnimDecoder * decoder) const { WebPAnimDecoderDelete(decoder); } void operator()(WebpDa... |
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | When calling the WebP API you need to get a pointer so if you have a `std::unique_ptr<WebPAnimDecoder, UniquePtrDeleter> anim_decoder;`, just call `anim_decoder.get()` |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindWebP.cmake
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -10,8 +10,6 @@
# Look for the header file.
-unset(WEBP_FOUND)
-
FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
if(NOT WEBP_INCLUDE_DIR)
@@ -21,13 +19,14 @@ else()... | What are you trying to check here? How old is an invalid WebP version? |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/test/test_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -7,23 +7,9 @@ namespace opencv_test { namespace {
#ifdef HAVE_WEBP
-TEST(Imgcodecs_WebP, encode_decode_lossless_webp)
+static void readFileBytes(const std::s... | Also compare the bgcolor and all the other members. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindWebP.cmake
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -10,8 +10,6 @@
# Look for the header file.
-unset(WEBP_FOUND)
-
FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
if(NOT WEBP_INCLUDE_DIR)
@@ -21,13 +19,14 @@ else()... | It will be clearer to use https://cmake.org/cmake/help/latest/module/CheckCXXSourceCompiles.html here, instead of adding a new file to the source tree. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | Just to reduce the imbricated `if` , write it as: ```cpp if (VP8_STATUS_OK == WebPGetFeatures(header, sizeof(header), &features)) return false; ``` And then you can remove the big `{}` below. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 188
**Code Changes:**
```diff
@@ -155,7 +185,7 @@ bool WebPDecoder::readData(Mat &img)
CV_CheckEQ(img.cols, m_width, "");
CV_CheckEQ(img.rows, m_height, "");
- ... | That should still be m_buf no ? |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | That is only if there is alpha. Otherwise, it should be BGR |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | should i mark this as resolved? |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 188
**Code Changes:**
```diff
@@ -155,7 +185,7 @@ bool WebPDecoder::readData(Mat &img)
CV_CheckEQ(img.cols, m_width, "");
CV_CheckEQ(img.rows, m_height, "");
- ... | if (m_buf.empty()) don't pass tests.. m_buf is related with imdecode and imencode which i did not focused yet. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindWebP.cmake
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -10,8 +10,6 @@
# Look for the header file.
-unset(WEBP_FOUND)
-
FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
if(NOT WEBP_INCLUDE_DIR)
@@ -21,13 +19,14 @@ else()... | Thx for checking ! Forget about that then. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -49,6 +49,8 @@
#include <fstream>
+struct WebPAnimDecoder;
+
namespace cv
{
@@ -61,17 +63,24 @@ class WebPDecoder CV_FINAL : public BaseImageDecoder
``` | Please add the same thing for data and encoder: ``` void operator()(WebPData* data) const { WebPDataClear(data); } ``` And you can then use it internally when creating a unique_ptr (or use a typedef to that) ``` typedef std::unique_ptr<WebPAnimDecoder, UniquePtrDeleter> AnimDecoder; ``` If you only use those once, no n... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | Just do the same thing for data and encoder (or maybe simply do what you did for the encoder, by using a full unique_ptr definition if you only use those once in the code. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | I'd say the second one. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -49,6 +49,8 @@
#include <fstream>
+struct WebPAnimDecoder;
+
namespace cv
{
@@ -61,17 +63,24 @@ class WebPDecoder CV_FINAL : public BaseImageDecoder
``` | animinfo -> anim |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/test/test_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -7,23 +7,9 @@ namespace opencv_test { namespace {
#ifdef HAVE_WEBP
-TEST(Imgcodecs_WebP, encode_decode_lossless_webp)
+static void readFileBytes(const std::s... | Is that image standard ? |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | This is the reason why I think writemulti should not support AVIF and WebP. Those are not multi-page formats (and yes, I added it for AVIF but now think that it should be removed) |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -49,6 +49,8 @@
#include <fstream>
+struct WebPAnimDecoder;
+
namespace cv
{
@@ -61,17 +63,24 @@ class WebPDecoder CV_FINAL : public BaseImageDecoder
``` | Defining `operator()` forces you to include the WebP headers here. Can you instead define it in the `.cpp` file ? And therefore forward declare `WebPAnimDecoder` in the header |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/include/opencv2/imgcodecs.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -218,6 +218,36 @@ enum ImwriteHDRCompressionFlags {
//! @} imgcodecs_flags
+/** @brief Represents an animation with multiple frames.
+The `Animati... | Let's stick to struct, they are easier to bind. Animations do not have 100 frames. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/test/test_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -7,23 +7,9 @@ namespace opencv_test { namespace {
#ifdef HAVE_WEBP
-TEST(Imgcodecs_WebP, encode_decode_lossless_webp)
+static void readFileBytes(const std::s... | here is the link of image https://opencv.org/wp-content/uploads/2020/07/OpenCV_logo_white_.png i resized it to speed up tests |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/include/opencv2/imgcodecs.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -218,6 +218,36 @@ enum ImwriteHDRCompressionFlags {
//! @} imgcodecs_flags
+/** @brief Represents an animation with multiple frames.
+The `Animati... | M.b. `cv::Scalar`? We use it everywhere for the same purpose. There is no issue with big-little endianess. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/include/opencv2/imgcodecs.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -218,6 +218,36 @@ enum ImwriteHDRCompressionFlags {
//! @} imgcodecs_flags
+/** @brief Represents an animation with multiple frames.
+The `Animati... | Does it affect decoding? Please add note to the description. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/test/test_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -7,23 +7,9 @@ namespace opencv_test { namespace {
#ifdef HAVE_WEBP
-TEST(Imgcodecs_WebP, encode_decode_lossless_webp)
+static void readFileBytes(const std::s... | use OpenCV theRNG. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/include/opencv2/imgcodecs.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -218,6 +218,36 @@ enum ImwriteHDRCompressionFlags {
//! @} imgcodecs_flags
+/** @brief Represents an animation with multiple frames.
+The `Animati... | That should be an extra parameter in imwriteanimation because it is not filled by imreadanimation |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/include/opencv2/imgcodecs.hpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -218,6 +218,36 @@ enum ImwriteHDRCompressionFlags {
//! @} imgcodecs_flags
+/** @brief Represents an animation with multiple frames.
+The `Animati... | i will remove it. IMWRITE_WEBP_QUALITY parameter does the job. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/test/test_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -7,23 +7,9 @@ namespace opencv_test { namespace {
#ifdef HAVE_WEBP
-TEST(Imgcodecs_WebP, encode_decode_lossless_webp)
+static void readFileBytes(const std::s... | Please create PR in opencv_extra with the same branch name. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/test/test_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -7,23 +7,9 @@ namespace opencv_test { namespace {
#ifdef HAVE_WEBP
-TEST(Imgcodecs_WebP, encode_decode_lossless_webp)
+static void readFileBytes(const std::s... | I propose to switch to some existing file in opencv_extra. It grows too fast this days. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindWebP.cmake
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -10,8 +10,6 @@
# Look for the header file.
-unset(WEBP_FOUND)
-
FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
if(NOT WEBP_INCLUDE_DIR)
@@ -21,13 +19,14 @@ else()... | The check is redundant. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 461
**Code Changes:**
```diff
+ std::unique_ptr<WebPAnimEncoder, void (*)(WebPAnimEncoder*)> anim_encoder(
+ WebPAnimEncoderNew(width, height, &anim_config), WebPAn... | Looks like the sanitizer issue is related to the flag. The encoder always expects alpha channel, even, ig input matrices have CV_8UC3 type. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 461
**Code Changes:**
```diff
+ std::unique_ptr<WebPAnimEncoder, void (*)(WebPAnimEncoder*)> anim_encoder(
+ WebPAnimEncoderNew(width, height, &anim_config), WebPAn... | > Looks like the sanitizer issue is related to the flag. The encoder always expects alpha channel, even, ig input matrices have CV_8UC3 type. There are two possible solutions: either assert if the input is 8UC3, or convert 8UC3 to 8UC4. I believe converting 8UC3 to 8UC4 is the better approach. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/python/tutorial_code/imgcodecs/animations.py
**Change Type:** added
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -0,0 +1,52 @@
+import cv2 as cv
+import numpy as np
+
+def main(filename):
+ ## [write_animation]
+ if filename == "animated_image.webp":
+ ... | timestamp is not incremented in the loop |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/cpp/tutorial_code/imgcodecs/animations.cpp
**Change Type:** added
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -0,0 +1,51 @@
+#include <opencv2/highgui.hpp>
+#include <opencv2/imgcodecs.hpp>
+#include <opencv2/imgproc.hpp>
+#include <iostream>
+
+using namespace... | Timestamp is not incremented. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/test/test_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 210
**Code Changes:**
```diff
+ EXPECT_EQ(0, cvtest::norm(l_animation.frames[5], l_animation.frames[14], NORM_INF));
+ EXPECT_EQ(0, cvtest::norm(l_animation.frames[6], ... | Let's extact it as another test case. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/loadsave.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -682,6 +682,116 @@ bool imreadmulti(const String& filename, std::vector<Mat>& mats, int start, int
return imreadmulti_(filename, flags, mats, start, count);
}... | CV_LOG_ERROR |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/loadsave.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 703
**Code Changes:**
```diff
+ decoder = findDecoder(filename);
+
+ /// if no decoder was found, return false.
+ if (!decoder) {
+ CV_LOG_WARNING(NULL, "Decode... | Log message us useful here |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/loadsave.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 779
**Code Changes:**
```diff
+ }
+
+ if (!decoder->nextPage())
+ {
+ break;
+ }
+ ++current;
+ }
+ animation.bgcolor = deco... | Need to add check, if we do not have unexpected early exit. E.g. header reports 10 frames, but we get only 5 from the very beginning. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | Need to discuss it. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | CV_LOG_ERROR |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -44,17 +44,15 @@
#include "precomp.hpp"
-#include <webp/decode.h>
-#include <webp/encode.h>
-
#include <stdio.h>
#include <limits.h>
-
``` | Need to aandle both RGB(a) and BGR(a) here. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 147
**Code Changes:**
```diff
- m_type = CV_8UC3;
- channels = 3;
+ fs.seekg(0, std::ios::beg); CV_Assert(fs && "File stream error");
+ ... | Assert raises exception. The file is not closed on the next line. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** doc/tutorials/app/animations.markdown
**Change Type:** added
**Context:** PR #25608: Animated WebP and AVIF Support
**Code Changes:**
```diff
@@ -0,0 +1,91 @@
+Handling Animated Image Files {#tutorial_animations}
+===========================
+
+@tableofcontents
+
+| | |
+| -: | :- |
+| Original author ... | Aninmated PNG (APNG) |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgcodecs/src/grfmt_webp.cpp
**Change Type:** modified
**Context:** PR #25608: Animated WebP and AVIF Support
**Review Line:** 147
**Code Changes:**
```diff
- m_type = CV_8UC3;
- channels = 3;
+ fs.seekg(0, std::ios::beg); CV_Assert(fs && "File stream error");
+ ... | ifstream destructor closes the file. fs is decoder field, no need to wary about it here. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.