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));