nareshmlx/opencv-pr huggingface dataset:
**File:** modules/dnn/src/layers/gridsample_layer.cpp
**Change Type:** added
**Context:** PR #27700: Added gridsample layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,328 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include <opencv2/dnn/shape_utils.hpp>
```

Review comment:
It's enough to specify 16-22
**File:** modules/dnn/src/layers/gridsample_layer.cpp
**Change Type:** added
**Context:** PR #27700: Added gridsample layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,328 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include <opencv2/dnn/shape_utils.hpp>
```

Review comment:
let's: 1. put a loop inside parallel_for to handle a range of rows: ``` int nstripes = Hout*C*N; parallel_for_(Range(0, nstripes), [&](const Range& range) { for (int row = range.start; row < range.end; row++) { int n = row/(Hout*C); int c = (row - n*Hout*C)/Hout; int y = row % Hout; if (type == CV_8U && interpolation == NN) { for (int x = 0; x < Wout; x++) { ... } } else if (type == CV_8U && interpolation == LINEAR) { for (int x = 0; x < Wout; x++) { } } ... }); ``` 2. instead of a single loop over x, have a multiple loops that should be put into a template function, depending on the input data type, interpolation method etc. 3. support different data types, at least, 8U, FP16, BF16, FP32. in total, you will have `4 {8U, FP16, BF16, FP32} * 3 {nearest neighbor, bilinear, bicubic} * 1 {2D} == 12` branches.
**File:** modules/dnn/src/layers/gridsample_layer.cpp
**Change Type:** added
**Context:** PR #27700: Added gridsample layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,328 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include <opencv2/dnn/shape_utils.hpp>
```

Review comment:
Make normToPix branchless to facilitate auto vectorization: ``` static inline void normToPix(float nx, float ny, int W, int H, bool align_corners, float& x, float& y) { float delta = float(align_corners); x = ((nx + 1.f)*(W - delta) + (delta - 1.f))*0.5f; y = ((ny + 1.f)*(H - delta) + (delta - 1.f))*0.5f; } ``` basically, you can precompute constant xscale, xdelta, yscale, ydelta, so that the code above is equivalent to ``` static inline void normToPix(float nx, float ny, float xscale, float yscale, float xdelta, float ydelta, float& x, float& y) { x = nx*xscale + xdelta; y = ny*yscale + ydelta; } ``` compiler will _unlikely_ do this job for you, because it knows about machine arithmetic and rounding errors, so it will value accuracy over speed. You need to do this optimization manually.
**File:** modules/dnn/src/layers/gridsample_layer.cpp
**Change Type:** added
**Context:** PR #27700: Added gridsample layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,328 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include <opencv2/dnn/shape_utils.hpp>
```

Review comment:
this code with nested lambda functions is not going to be fast. Please, rewrite this code without lambda functions that are called inside the innermost loop. Don't use `fetch()` blindly, 'cause it's very slow. Check that the whole 2x2 fetched neighborhood of the pixel is inside the image, in this case simply convert top-left corner to int's (without using `floor`, because of a non-negative number x we always have (int)std::floor(x) == (int)x).
**File:** modules/dnn/src/layers/gridsample_layer.cpp
**Change Type:** added
**Context:** PR #27700: Added gridsample layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,328 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include <opencv2/dnn/shape_utils.hpp>
```

Review comment:
use more correct `saturate_cast<int>(x);`
**File:** modules/dnn/src/layers/gridsample_layer.cpp
**Change Type:** added
**Context:** PR #27700: Added gridsample layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,328 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include <opencv2/dnn/shape_utils.hpp>
```

Review comment:
Please, optimize it. Don't use loops here to compute coefficients. In OpenCV we have optimized bicubic intepolation in `cv::resize()`, take the code from there: https://github.com/opencv/opencv/blob/6d889ee74c94124f6492eb8f0d50946d9c31d8e9/modules/imgproc/src/resize.cpp#L964. Make sure that both variants produce the same results.
**File:** modules/dnn/src/layers/gridsample_layer.cpp
**Change Type:** added
**Context:** PR #27700: Added gridsample layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,328 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include <opencv2/dnn/shape_utils.hpp>
```

Review comment:
compute the sumwx and sumwy analytically.
**File:** modules/dnn/src/layers/gridsample_layer.cpp
**Change Type:** added
**Context:** PR #27700: Added gridsample layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,328 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include <opencv2/dnn/shape_utils.hpp>
```

Review comment:
don't use loops to do cubic interpolation
**File:** modules/videoio/src/cap_ffmpeg_impl.hpp
**Change Type:** modified
**Context:** PR #27755: Optimize FFmpeg VideoCapture with swscale threads option

**Code Changes:**
```diff
@@ -607,6 +607,7 @@ struct CvCapture_FFMPEG
     int hw_device;
     int use_opencl;
     int extraDataIdx;
+    int requestedThreads;
 };
 
 void CvCapture_FFMPEG::init()
@@ -658,6 +659,7 @@ void CvCapture_FFMPEG::init()
     hw_device = -1;
```

Review comment:
OpenCV initializes threading for encoder in the following way: ``` if (!enc->thread_count) { int nCpus = cv::getNumberOfCPUs(); int requestedThreads = std::min(nCpus, 16); // [OPENCV:FFMPEG:24] Application has requested XX threads. Using a thread count greater than 16 is not recommended. std::string threads_option = utils::getConfigurationParameterString("OPENCV_FFMPEG_THREADS"); if (!threads_option.empty()) { requestedThreads = atoi(threads_option.c_str()); } enc->thread_count = requestedThreads; } ``` I propose to use `nCpus = cv::getNumberOfCPUs()` here too as initial value.
**File:** modules/dnn/src/layers/bitshift_layer.cpp
**Change Type:** added
**Context:** PR #27666: Added bitshift layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,137 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
```

Review comment:
no need to cast to U — shiftVal is already of U type.
**File:** modules/dnn/src/layers/bitshift_layer.cpp
**Change Type:** added
**Context:** PR #27666: Added bitshift layer to new DNN engine
**Review Line:** 13

**Code Changes:**
```diff
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+
+// ONNX reference: BitShift operator
+// Spec: https://onnx.ai/onnx/operators/onnx__BitShift.html
+// Supported opsets: ai.onnx opset 11 and newer
+// NOTE: Broadcasting is NOT fully supported. Only two cases are handled:
+// 1) array (input[0]) shifted by array (input[1]) of the SAME SHAPE
+// 2) array (input[0]) shifted by a SCALAR (0-D) shift amount
+
+namespace cv {
```

Review comment:
please, put a note here that broadcasting is not fully supported, only the same shapes (`array shift array`) or `array shift scalar`
**File:** modules/dnn/src/layers/bitshift_layer.cpp
**Change Type:** added
**Context:** PR #27666: Added bitshift layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,137 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
```

Review comment:
extra conversion into a temporary array is too big overhead for such a simple operation. Please, rewrite it to avoid the use of temporary array.
**File:** modules/dnn/src/layers/bitshift_layer.cpp
**Change Type:** added
**Context:** PR #27666: Added bitshift layer to new DNN engine

**Code Changes:**
```diff
@@ -0,0 +1,137 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// Copyright (C) 2025, BigVision LLC, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
```

Review comment:
check that inputs[1] == inputs[0] or inputs[1] has 0 dimensions.
**File:** modules/dnn/src/layers/bitshift_layer.cpp
**Change Type:** added
**Context:** PR #27666: Added bitshift layer to new DNN engine
**Review Line:** 90

**Code Changes:**
```diff
+    void getTypes(const std::vector<MatType>& in, const int reqOut, const int reqInt,
+                  std::vector<MatType>& out, std::vector<MatType>& internals) const CV_OVERRIDE
+    {
+        CV_Assert(in.size() >= 2);
+        int t = in[0];
+        CV_Assert(t == CV_8U || t == CV_16U || t == CV_32U || t == CV_64U);
+        CV_Assert(in[1] == in[0]);
+        out.assign(reqOut, MatType(t));
+        internals.assign(reqInt, MatType(t));
+    }
+
```

Review comment:
according to ONNX specification, there must be `in[1] == in[0]`. Please, check it.
**File:** modules/core/misc/java/gen_dict.json
**Change Type:** modified
**Context:** PR #27567: Enable Java wrapper generation for Vec4i

**Code Changes:**
```diff
@@ -648,6 +648,31 @@
             "jni_var": "Vec3d %(n)s(%(n)s_val0, %(n)s_val1, %(n)s_val2)",
             "suffix": "DDD"
         },
+        "Vec4i": {
+            "j_type": "int[]",
+            "jn_args": [
+                [
+                    "int",
+                    ".val[0]"
```

Review comment:
I propose to presume `.val` here and below for compatibility with existing code.
**File:** doc/opencv.bib
**Change Type:** modified
**Context:** PR #27730: doc: fix doxygen warnings for imgcodecs, flann and objdetect
**Review Line:** 1440

**Code Changes:**
```diff
@@ -1431,14 +1431,6 @@ @article{Viola04
   publisher = {Kluwer Academic Publishers},
   url = {https://www.face-rec.org/algorithms/Boosting-Ensemble/16981346.pdf}
 }
-@inproceedings{wang2016iros,
-  author = {John Wang and Edwin Olson},
-  title = {{AprilTag} 2: Efficient and robust fiducial detection},
-  booktitle = {Proceedings of the {IEEE/RSJ} International Conference on Intelligent Robots and Systems {(IROS)}},
-  year = {2016},
-  month = {October},
-  url = {https://april.eecs.umich.edu/pdfs/wang2016iros.pdf}
-}
 @misc{Welch95,
   author = {Welch, Greg and Bishop, Gary},
   title = {An introduction to the Kalman filter},
```

Review comment:
Can you add the url field in the other bibtex file?
**File:** cmake/OpenCVDetectCUDAUtils.cmake
**Change Type:** modified
**Context:** PR #27537: Refactor Blackwell - In CUDA 13: - 10.0 is b100/b200 same for aarch64 (gb200) - 10.3 is GB300 - 11.0 is Thor with new OpenRm driver (moves ...

**Code Changes:**
```diff
@@ -109,7 +109,7 @@ macro(ocv_initialize_nvidia_device_generations)
   set(_arch_ampere   "8.0;8.6")
   set(_arch_lovelace "8.9")
   set(_arch_hopper   "9.0")
-  set(_arch_blackwell "10.0;12.0")
+  set(_arch_blackwell "10.0;10.3;11.0;12.0;12.1")
   if(NOT CMAKE_CROSSCOMPILING)
     list(APPEND _generations "Auto")
   endif()
@@ -273,14 +273,15 @@ macro(ocv_set_cuda_arch_bin_and_ptx nvcc_executable)
```

Review comment:
Hm.. each option here is yet another kernel build. Longer build and fatter binary. I would say, that we do not need all possible combinations, if the target is defined by the arch name. "12.0;12.1" most probably should be just 12.1. The same for 10.x variations, if pure 10.0 devices do not exist and 10.3 is minimal production version.
**File:** cmake/OpenCVDetectCUDAUtils.cmake
**Change Type:** modified
**Context:** PR #27537: Refactor Blackwell - In CUDA 13: - 10.0 is b100/b200 same for aarch64 (gb200) - 10.3 is GB300 - 11.0 is Thor with new OpenRm driver (moves ...

**Code Changes:**
```diff
@@ -109,7 +109,7 @@ macro(ocv_initialize_nvidia_device_generations)
   set(_arch_ampere   "8.0;8.6")
   set(_arch_lovelace "8.9")
   set(_arch_hopper   "9.0")
-  set(_arch_blackwell "10.0;12.0")
+  set(_arch_blackwell "10.0;10.3;11.0;12.0;12.1")
   if(NOT CMAKE_CROSSCOMPILING)
     list(APPEND _generations "Auto")
   endif()
@@ -273,14 +273,15 @@ macro(ocv_set_cuda_arch_bin_and_ptx nvcc_executable)
```

Review comment:
Hello, In CUDA 13 10.0 is b100/b200 same for aarch64 (gb200) 10.3 is GB300 11.0 is Thor with new OpenRm driver (moves to SBSA) 12.0 is RTX/RTX PRO 12.1 is Spark GB10 feel free to change it or recommend me the most optimized codegen there
**File:** cmake/OpenCVDetectCUDAUtils.cmake
**Change Type:** modified
**Context:** PR #27537: Refactor Blackwell - In CUDA 13: - 10.0 is b100/b200 same for aarch64 (gb200) - 10.3 is GB300 - 11.0 is Thor with new OpenRm driver (moves ...

**Code Changes:**
```diff
@@ -109,7 +109,7 @@ macro(ocv_initialize_nvidia_device_generations)
   set(_arch_ampere   "8.0;8.6")
   set(_arch_lovelace "8.9")
   set(_arch_hopper   "9.0")
-  set(_arch_blackwell "10.0;12.0")
+  set(_arch_blackwell "10.0;10.3;11.0;12.0;12.1")
   if(NOT CMAKE_CROSSCOMPILING)
     list(APPEND _generations "Auto")
   endif()
@@ -273,14 +273,15 @@ macro(ocv_set_cuda_arch_bin_and_ptx nvcc_executable)
```

Review comment:
Orin is moving to sbsa (deletes old nvgpu) in Q1 2026. I don’t if it will mantain the same codegen
**File:** cmake/OpenCVDetectCUDAUtils.cmake
**Change Type:** modified
**Context:** PR #27537: Refactor Blackwell - In CUDA 13: - 10.0 is b100/b200 same for aarch64 (gb200) - 10.3 is GB300 - 11.0 is Thor with new OpenRm driver (moves ...

**Code Changes:**
```diff
@@ -109,7 +109,7 @@ macro(ocv_initialize_nvidia_device_generations)
   set(_arch_ampere   "8.0;8.6")
   set(_arch_lovelace "8.9")
   set(_arch_hopper   "9.0")
-  set(_arch_blackwell "10.0;12.0")
+  set(_arch_blackwell "10.0;10.3;11.0;12.0;12.1")
   if(NOT CMAKE_CROSSCOMPILING)
     list(APPEND _generations "Auto")
   endif()
@@ -273,14 +273,15 @@ macro(ocv_set_cuda_arch_bin_and_ptx nvcc_executable)
```

Review comment:
There is new option that is putting f 10.0f and takes optimizarion for all blackwell family
**File:** cmake/OpenCVDetectCUDAUtils.cmake
**Change Type:** modified
**Context:** PR #27537: Refactor Blackwell - In CUDA 13: - 10.0 is b100/b200 same for aarch64 (gb200) - 10.3 is GB300 - 11.0 is Thor with new OpenRm driver (moves ...

**Code Changes:**
```diff
@@ -109,7 +109,7 @@ macro(ocv_initialize_nvidia_device_generations)
   set(_arch_ampere   "8.0;8.6")
   set(_arch_lovelace "8.9")
   set(_arch_hopper   "9.0")
-  set(_arch_blackwell "10.0;12.0")
+  set(_arch_blackwell "10.0;10.3;11.0;12.0;12.1")
   if(NOT CMAKE_CROSSCOMPILING)
     list(APPEND _generations "Auto")
   endif()
@@ -273,14 +273,15 @@ macro(ocv_set_cuda_arch_bin_and_ptx nvcc_executable)
```

Review comment:
Separator needs to be a `;` not a `,` in `...;10.3,11.0;...` for the compute capability autodetection to work.
**File:** cmake/OpenCVDetectCUDAUtils.cmake
**Change Type:** modified
**Context:** PR #27537: Refactor Blackwell - In CUDA 13: - 10.0 is b100/b200 same for aarch64 (gb200) - 10.3 is GB300 - 11.0 is Thor with new OpenRm driver (moves ...

**Code Changes:**
```diff
@@ -109,7 +109,7 @@ macro(ocv_initialize_nvidia_device_generations)
   set(_arch_ampere   "8.0;8.6")
   set(_arch_lovelace "8.9")
   set(_arch_hopper   "9.0")
-  set(_arch_blackwell "10.0;12.0")
+  set(_arch_blackwell "10.0;10.3;11.0;12.0;12.1")
   if(NOT CMAKE_CROSSCOMPILING)
     list(APPEND _generations "Auto")
   endif()
@@ -273,14 +273,15 @@ macro(ocv_set_cuda_arch_bin_and_ptx nvcc_executable)
```

Review comment:
Yeah, good catch. Done!
**File:** modules/core/src/cuda_info.cpp
**Change Type:** modified
**Context:** PR #27636: cuda 13.0 compatibility

**Code Changes:**
```diff
@@ -424,7 +424,9 @@ int cv::cuda::DeviceInfo::clockRate() const
 #ifndef HAVE_CUDA
     throw_no_cuda();
 #else
-    return deviceProps().get(device_id_)->clockRate;
+    int clockRate;
+    cudaSafeCall(cudaDeviceGetAttribute(&clockRate, cudaDevAttrClockRate, device_id_));
+    return clockRate;
 #endif
 }
```

Review comment:
> modules\core\src\cuda_info.cpp(951): error C2039: 'clockRate': is not a member of 'cudaDeviceProp'
**File:** modules/core/src/cuda_info.cpp
**Change Type:** modified
**Context:** PR #27636: cuda 13.0 compatibility

**Code Changes:**
```diff
@@ -424,7 +424,9 @@ int cv::cuda::DeviceInfo::clockRate() const
 #ifndef HAVE_CUDA
     throw_no_cuda();
 #else
-    return deviceProps().get(device_id_)->clockRate;
+    int clockRate;
+    cudaSafeCall(cudaDeviceGetAttribute(&clockRate, cudaDevAttrClockRate, device_id_));
+    return clockRate;
 #endif
 }
```

Review comment:
`maxTexture1DLinear` has been depreciated not `maxTexture1D` See > opencv\modules\core\src\cuda_info.cpp(566): error C2039: 'maxTexture1DLinear': is not a member of 'cudaDeviceProp'
**File:** modules/imgcodecs/src/grfmt_bmp.cpp
**Change Type:** modified
**Context:** PR #27559: imgcodecs: bmp: support to write 32bpp BMP with BI_BITFIELDS

**Code Changes:**
```diff
@@ -42,6 +42,7 @@
 
 #include "precomp.hpp"
 #include "grfmt_bmp.hpp"
+#include "opencv2/core/utils/logger.hpp"
 
 namespace cv
 {
@@ -603,6 +604,7 @@ BmpEncoder::BmpEncoder()
 {
```

Review comment:
According to the documentation (32-bit section of the table): > The bitmap has a maximum of 2^32 colors. If the bV5Compression member of the BITMAPV5HEADER is BI_RGB, the bmiColors member of [BITMAPINFO](https://learn.microsoft.com/en-us/windows/desktop/api/wingdi/ns-wingdi-bitmapinfo) is NULL. Each DWORD in the bitmap array represents the relative intensities of blue, green, and red for a pixel. The value for blue is in the least significant 8 bits, followed by 8 bits each for green and red. The high byte in each DWORD is not used. The bmiColors color table is used for optimizing colors used on palette-based devices, and must contain the number of entries specified by the bV5ClrUsed member of the BITMAPV5HEADER.If the bV5Compression member of the BITMAPV5HEADER is BI_BITFIELDS, the bmiColors member contains three DWORD color masks that specify the red, green, and blue components of each pixel. Each DWORD in the bitmap array represents a single pixel. The bitmap with BMP_RGB flag and 32-bit per channel is 3 channel image. The high byte is not used. I propose to revert imread changes and corresponding test. Images with BI_RBG/BMP_RGB should be 3 channel images. Images with BI_BITFIELD/RGB_BITFIELD - 4 channel images.
**File:** modules/imgcodecs/src/grfmt_bmp.cpp
**Change Type:** modified
**Context:** PR #27559: imgcodecs: bmp: support to write 32bpp BMP with BI_BITFIELDS

**Code Changes:**
```diff
@@ -42,6 +42,7 @@
 
 #include "precomp.hpp"
 #include "grfmt_bmp.hpp"
+#include "opencv2/core/utils/logger.hpp"
 
 namespace cv
 {
@@ -603,6 +604,7 @@ BmpEncoder::BmpEncoder()
 {
```

Review comment:
In case if BI_RGB format is set in header it's not RGBX, it's RGB according to the documentation. Need to understand how the user generated it.
**File:** modules/imgcodecs/src/grfmt_bmp.cpp
**Change Type:** modified
**Context:** PR #27559: imgcodecs: bmp: support to write 32bpp BMP with BI_BITFIELDS

**Code Changes:**
```diff
@@ -42,6 +42,7 @@
 
 #include "precomp.hpp"
 #include "grfmt_bmp.hpp"
+#include "opencv2/core/utils/logger.hpp"
 
 namespace cv
 {
@@ -603,6 +604,7 @@ BmpEncoder::BmpEncoder()
 {
```

Review comment:
OK, I revert to support reading. With ffmpeg , Windows Bitmap files saved in AV_PIX_FMT_BGRA format seems not able to read after this fix. - BITMAPINFOHEADER - biBitCount = 32 - biCompression = BI_RGB - BGRA data is stored. https://github.com/FFmpeg/FFmpeg/blob/2fffa01ddb777871cd53ef6c92f5c19cae8afe16/libavcodec/bmpenc.c#L119-L135 ||OpenCV v4.12.0(Before) | After| |:-|-|-| |Read RGBA BMP with BI_RGB | Not supported | Not supported (Only handled as RGB) | |Read RGBA BMP with BI_BITFIELDS | Supported | Supported | |Write RGBA BMP with BI_RGB | Supported (Default) |Supported | |Write RGBA BMP with BI_BITFIELDS| Not supported|Supported (Default) |
**File:** modules/videoio/src/cap_ffmpeg_impl.hpp
**Change Type:** modified
**Context:** PR #27691: FFmpeg 8.0 support.
**Review Line:** 690

**Code Changes:**
```diff
     if( video_st )
     {
 #ifdef CV_FFMPEG_CODECPAR
+// avcodec_close removed in FFmpeg release 8.0
+# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100))
         avcodec_close( context );
+# endif
 #endif
         video_st = NULL;
     }
@@ -2005,7 +2008,18 @@ void CvCapture_FFMPEG::get_rotation_angle()
```

Review comment:
avcodec_free_context in the `#else`?
**File:** modules/videoio/src/cap_ffmpeg_impl.hpp
**Change Type:** modified
**Context:** PR #27691: FFmpeg 8.0 support.
**Review Line:** 690

**Code Changes:**
```diff
     if( video_st )
     {
 #ifdef CV_FFMPEG_CODECPAR
+// avcodec_close removed in FFmpeg release 8.0
+# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100))
         avcodec_close( context );
+# endif
 #endif
         video_st = NULL;
     }
@@ -2005,7 +2008,18 @@ void CvCapture_FFMPEG::get_rotation_angle()
```

Review comment:
I think it should be `avcodec_free_context(&context);` for any version