Initial support for pixel-shift for the Sony A7RIII

Only with ARQ files for now, and no sony-specific constants for motion correction yet
This commit is contained in:
Alberto Griggio
2017-12-12 20:49:43 +01:00
parent 4cc7861125
commit 890d896817
3 changed files with 81 additions and 0 deletions

View File

@@ -2349,6 +2349,35 @@ void CLASS unpacked_load_raw()
&& (unsigned) (col-left_margin) < width) derror();
}
// RT
void CLASS sony_arq_load_raw()
{
int row, col, bits=0;
ushort samples[4];
while (1 << ++bits < maximum);
for (row=0; row < ((shot_select < 2) ? 1 : raw_height); row++) {
for (col=0; col < ((row == 0) ? raw_width : 1); col++) {
RAW(row,col) = 0;
}
}
for (row=0; row < raw_height; row++) {
int r = row + (shot_select & 1);
for (col=0; col < raw_width; col++) {
int c = col + ((shot_select >> 1) & 1);
read_shorts(samples, 4);
if (r < raw_height && c < raw_width) {
RAW(r,c) = samples[(2 * (r & 1)) + (c & 1)];
if ((RAW(r,c) >>= load_flags) >> bits
&& (unsigned) (row-top_margin) < height
&& (unsigned) (col-left_margin) < width) derror();
}
}
}
}
void CLASS sinar_4shot_load_raw()
{
ushort *pixel;
@@ -6524,6 +6553,17 @@ void CLASS apply_tiff()
if (!strncmp(make,"OLYMPUS",7) &&
tiff_ifd[raw].bytes*7 > raw_width*raw_height)
load_raw = &CLASS olympus_load_raw;
// ------- RT -------
if (!strncmp(make,"SONY",4) &&
!strncmp(model,"ILCE-7RM3",9) &&
tiff_samples == 4 &&
tiff_ifd[raw].bytes == raw_width*raw_height*tiff_samples*2) {
load_raw = &CLASS sony_arq_load_raw;
colors = 3;
is_raw = 4;
filters = 0x94949494;
}
// ------------------
}
break;
case 6: case 7: case 99:

View File

@@ -409,6 +409,7 @@ sony_decrypt_t sony_decrypt;
void sony_load_raw();
void sony_arw_load_raw();
void sony_arw2_load_raw();
void sony_arq_load_raw(); // RT
void smal_decode_segment (unsigned seg[2][2], int holes);
void smal_v6_load_raw();

View File

@@ -295,6 +295,43 @@ void calcFrameBrightnessFactor(unsigned int frame, uint32_t datalen, LUT<uint32_
}
class RawDataFrameReorder {
public:
typedef array2D<float> *array2D_ptr;
RawDataFrameReorder(const std::string &model, array2D_ptr *rawDataFrames):
model_(model),
frames_(rawDataFrames)
{
if (model_ == "ILCE-7RM3") {
std::swap(frames_[2], frames_[3]);
}
}
~RawDataFrameReorder()
{
if (model_ == "ILCE-7RM3") {
std::swap(frames_[2], frames_[3]);
}
}
unsigned int getframe(unsigned int frame)
{
if (model_ == "ILCE-7RM3") {
if (frame == 2) {
return 3;
} else if (frame == 3) {
return 2;
}
}
return frame;
}
private:
std::string model_;
array2D_ptr *frames_;
};
}
using namespace std;
@@ -307,6 +344,9 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA
return;
}
RawDataFrameReorder reorder_frames(model, rawDataFrames);
frame = reorder_frames.getframe(frame);
RAWParams::BayerSensor bayerParams = bayerParamsIn;
bayerParams.pixelShiftAutomatic = true;