FrameTransformations: Minor adjustments between functions

This commit is contained in:
2023-05-01 18:36:37 +02:00
parent a05b59c6a5
commit e48474e97c
2 changed files with 27 additions and 26 deletions

View File

@@ -74,34 +74,39 @@ void FrameTransformation::PackSummation() {
for (auto &i: summation_buffer[m])
i = 0;
}
}
if (binning_2x2)
Bin2x2_sum<int32_t>((int32_t *) precompression_buffer.data(),
(int32_t *) full_image_buffer.data(),
experiment.GetXPixelsNumFullImage(),
experiment.GetYPixelsNumFullImage(),
static_cast<int32_t>(experiment.GetUnderflow()),
static_cast<int32_t>(experiment.GetOverflow()));
void FrameTransformation::Generate16BitPreview() {
// Generate 16-bit preview image
auto arr = (int32_t *) precompression_buffer.data();
if (pixel_depth == 4) {
// Generate 16-bit preview image
auto arr = (int32_t *) precompression_buffer.data();
for (int pxl = 0; pxl < experiment.GetPixelsNum(); pxl++) {
if (arr[pxl] >= INT16_MAX)
image16bit[pxl] = INT16_MAX;
else if (arr[pxl] <= INT16_MIN)
image16bit[pxl] = INT16_MIN;
else
image16bit[pxl] = static_cast<int16_t>(arr[pxl]);
}
for (int pxl = 0; pxl < experiment.GetPixelsNum(); pxl++) {
if (arr[pxl] >= INT16_MAX)
image16bit[pxl] = INT16_MAX;
else if (arr[pxl] <= INT16_MIN)
image16bit[pxl] = INT16_MIN;
else
image16bit[pxl] = static_cast<int16_t>(arr[pxl]);
}
}
size_t FrameTransformation::PackStandardOutput() {
if (summation > 1)
if (standard_output == nullptr)
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Default stream output not initialized");
if (summation > 1) {
PackSummation();
else {
if (binning_2x2)
Bin2x2_sum<int32_t>((int32_t *) precompression_buffer.data(),
(int32_t *) full_image_buffer.data(),
experiment.GetXPixelsNumFullImage(),
experiment.GetYPixelsNumFullImage(),
static_cast<int32_t>(experiment.GetUnderflow()),
static_cast<int32_t>(experiment.GetOverflow()));
if (pixel_depth == 4)
Generate16BitPreview();
} else {
if (binning_2x2)
Bin2x2_sum<int16_t>((int16_t *) precompression_buffer.data(),
(int16_t *) full_image_buffer.data(),
@@ -114,8 +119,6 @@ size_t FrameTransformation::PackStandardOutput() {
}
void FrameTransformation::ProcessModule(const int16_t *input, uint16_t module_number, int data_stream) {
if (standard_output == nullptr)
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Default stream output not initialized");
size_t module_number_abs = experiment.GetFirstModuleOfDataStream(data_stream) + module_number;
@@ -151,9 +154,6 @@ int16_t *FrameTransformation::GetPreview16BitImage() {
}
void FrameTransformation::ProcessModule(JFConversion &conv, const int16_t *input, uint16_t module_number, int data_stream) {
if (standard_output == nullptr)
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Default stream output not initialized");
size_t module_number_abs = experiment.GetFirstModuleOfDataStream(data_stream) + module_number;
if (summation == 1) {