opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
75.69k stars 55.61k forks source link

imgcodecs: jpeg: refactoring JpegEncoder with/without libjpeg turbo #25452

Closed Kumataro closed 1 week ago

Kumataro commented 1 week ago

Describe the feature and motivation

Currently, JpegEncoder extends to support extended color space(BGR/BGEX) with JCS_EXTENSIONS.

However old codes for libjpeg are left, so it is not easy to read.

I think to refactor it is needed for future works.

Additional context

For non-continuous source, I think updating to use Mat::ptr() insted of Mat::data + bias is better way.

- uchar *data = img.data + img.step*y, *ptr = data;
+ uchar *data = const_cast<uchar*>(img.ptr<uchar>(y));