Skip to content

Commit

Permalink
Fixing whitespace on effects
Browse files Browse the repository at this point in the history
  • Loading branch information
jonoomph committed Dec 22, 2022
1 parent 29c2cde commit 7e9cd26
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
22 changes: 11 additions & 11 deletions src/effects/Brightness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ std::shared_ptr<openshot::Frame> Brightness::GetFrame(std::shared_ptr<openshot::
// Compute contrast adjustment factor
float factor = (259 * (contrast_value + 255)) / (255 * (259 - contrast_value));

// Calculate alpha % (to be used for removing pre-multiplied alpha value)
int A = pixels[pixel * 4 + 3];
float alpha_percent = A / 255.0;
// Calculate alpha % (to be used for removing pre-multiplied alpha value)
int A = pixels[pixel * 4 + 3];
float alpha_percent = A / 255.0;

// Get RGB values, and remove pre-multiplied alpha
unsigned char R = pixels[pixel * 4 + 0] / alpha_percent;
unsigned char G = pixels[pixel * 4 + 1] / alpha_percent;
unsigned char B = pixels[pixel * 4 + 2] / alpha_percent;
// Get RGB values, and remove pre-multiplied alpha
unsigned char R = pixels[pixel * 4 + 0] / alpha_percent;
unsigned char G = pixels[pixel * 4 + 1] / alpha_percent;
unsigned char B = pixels[pixel * 4 + 2] / alpha_percent;

// Apply constrained contrast adjustment
R = constrain((factor * (R - 128)) + 128);
Expand All @@ -82,10 +82,10 @@ std::shared_ptr<openshot::Frame> Brightness::GetFrame(std::shared_ptr<openshot::
pixels[pixel * 4 + 1] = constrain(G + (255 * brightness_value));
pixels[pixel * 4 + 2] = constrain(B + (255 * brightness_value));

// Pre-multiply the alpha back into the color channels
pixels[pixel * 4 + 0] *= alpha_percent;
pixels[pixel * 4 + 1] *= alpha_percent;
pixels[pixel * 4 + 2] *= alpha_percent;
// Pre-multiply the alpha back into the color channels
pixels[pixel * 4 + 0] *= alpha_percent;
pixels[pixel * 4 + 1] *= alpha_percent;
pixels[pixel * 4 + 2] *= alpha_percent;
}

// return the modified frame
Expand Down
22 changes: 11 additions & 11 deletions src/effects/Hue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,24 @@ std::shared_ptr<openshot::Frame> Hue::GetFrame(std::shared_ptr<openshot::Frame>
#pragma omp parallel for shared (pixels)
for (int pixel = 0; pixel < pixel_count; ++pixel)
{
// Calculate alpha % (to be used for removing pre-multiplied alpha value)
int A = pixels[pixel * 4 + 3];
float alpha_percent = A / 255.0;
// Calculate alpha % (to be used for removing pre-multiplied alpha value)
int A = pixels[pixel * 4 + 3];
float alpha_percent = A / 255.0;

// Get RGB values, and remove pre-multiplied alpha
int R = pixels[pixel * 4 + 0] / alpha_percent;
int G = pixels[pixel * 4 + 1] / alpha_percent;
int B = pixels[pixel * 4 + 2] / alpha_percent;
// Get RGB values, and remove pre-multiplied alpha
int R = pixels[pixel * 4 + 0] / alpha_percent;
int G = pixels[pixel * 4 + 1] / alpha_percent;
int B = pixels[pixel * 4 + 2] / alpha_percent;

// Multiply each color by the hue rotation matrix
pixels[pixel * 4] = constrain(R * matrix[0] + G * matrix[1] + B * matrix[2]);
pixels[pixel * 4 + 1] = constrain(R * matrix[2] + G * matrix[0] + B * matrix[1]);
pixels[pixel * 4 + 2] = constrain(R * matrix[1] + G * matrix[2] + B * matrix[0]);

// Pre-multiply the alpha back into the color channels
pixels[pixel * 4 + 0] *= alpha_percent;
pixels[pixel * 4 + 1] *= alpha_percent;
pixels[pixel * 4 + 2] *= alpha_percent;
// Pre-multiply the alpha back into the color channels
pixels[pixel * 4 + 0] *= alpha_percent;
pixels[pixel * 4 + 1] *= alpha_percent;
pixels[pixel * 4 + 2] *= alpha_percent;
}

// return the modified frame
Expand Down
22 changes: 11 additions & 11 deletions src/effects/Saturation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ std::shared_ptr<openshot::Frame> Saturation::GetFrame(std::shared_ptr<openshot::
#pragma omp parallel for shared (pixels)
for (int pixel = 0; pixel < pixel_count; ++pixel)
{
// Calculate alpha % (to be used for removing pre-multiplied alpha value)
int A = pixels[pixel * 4 + 3];
float alpha_percent = A / 255.0;
// Calculate alpha % (to be used for removing pre-multiplied alpha value)
int A = pixels[pixel * 4 + 3];
float alpha_percent = A / 255.0;

// Get RGB values, and remove pre-multiplied alpha
int R = pixels[pixel * 4 + 0] / alpha_percent;
int G = pixels[pixel * 4 + 1] / alpha_percent;
int B = pixels[pixel * 4 + 2] / alpha_percent;
// Get RGB values, and remove pre-multiplied alpha
int R = pixels[pixel * 4 + 0] / alpha_percent;
int G = pixels[pixel * 4 + 1] / alpha_percent;
int B = pixels[pixel * 4 + 2] / alpha_percent;

/*
* Common saturation adjustment
Expand Down Expand Up @@ -137,10 +137,10 @@ std::shared_ptr<openshot::Frame> Saturation::GetFrame(std::shared_ptr<openshot::
pixels[pixel * 4 + 1] = G;
pixels[pixel * 4 + 2] = B;

// Pre-multiply the alpha back into the color channels
pixels[pixel * 4 + 0] *= alpha_percent;
pixels[pixel * 4 + 1] *= alpha_percent;
pixels[pixel * 4 + 2] *= alpha_percent;
// Pre-multiply the alpha back into the color channels
pixels[pixel * 4 + 0] *= alpha_percent;
pixels[pixel * 4 + 1] *= alpha_percent;
pixels[pixel * 4 + 2] *= alpha_percent;
}

// return the modified frame
Expand Down

0 comments on commit 7e9cd26

Please sign in to comment.