Skip to content

Commit

Permalink
Fixing some additional cpp_test complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
jonoomph committed Oct 16, 2020
1 parent f4d0d9d commit 29107bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/Clip.cpp
Expand Up @@ -1162,7 +1162,6 @@ void Clip::apply_keyframes(std::shared_ptr<Frame> frame, int width, int height)
pixels[byte_index + 2] *= alpha_value;
pixels[byte_index + 3] *= alpha_value;
}
pixels = NULL;

// Debug output
ZmqLogger::Instance()->AppendDebugMethod("Clip::apply_keyframes (Set Alpha & Opacity)", "alpha_value", alpha_value, "frame->number", frame->number);
Expand Down
2 changes: 1 addition & 1 deletion src/Timeline.cpp
Expand Up @@ -492,7 +492,7 @@ void Timeline::add_layer(std::shared_ptr<Frame> new_frame, Clip* source_clip, in

/* Apply effects to the source frame (if any). If multiple clips are overlapping, only process the
* effects on the top clip. */
if (is_top_clip && source_frame) {
if (is_top_clip) {
#pragma omp critical (T_addLayer)
source_frame = apply_effects(source_frame, timeline_frame_number, source_clip->Layer());
}
Expand Down
18 changes: 6 additions & 12 deletions src/effects/Mask.cpp
Expand Up @@ -102,29 +102,23 @@ std::shared_ptr<Frame> Mask::GetFrame(std::shared_ptr<Frame> frame, int64_t fram
unsigned char *pixels = (unsigned char *) frame_image->bits();
unsigned char *mask_pixels = (unsigned char *) original_mask->bits();

int R = 0;
int G = 0;
int B = 0;
int A = 0;
int gray_value = 0;
float factor = 0.0;
double contrast_value = (contrast.GetValue(frame_number));
double brightness_value = (brightness.GetValue(frame_number));

// Loop through mask pixels, and apply average gray value to frame alpha channel
for (int pixel = 0, byte_index=0; pixel < original_mask->width() * original_mask->height(); pixel++, byte_index+=4)
{
// Get the RGB values from the pixel
R = mask_pixels[byte_index];
G = mask_pixels[byte_index + 1];
B = mask_pixels[byte_index + 2];
A = mask_pixels[byte_index + 3];
int R = mask_pixels[byte_index];
int G = mask_pixels[byte_index + 1];
int B = mask_pixels[byte_index + 2];
int A = mask_pixels[byte_index + 3];

// Get the average luminosity
gray_value = qGray(R, G, B);
int gray_value = qGray(R, G, B);

// Adjust the contrast
factor = (259 * (contrast_value + 255)) / (255 * (259 - contrast_value));
float factor = (259 * (contrast_value + 255)) / (255 * (259 - contrast_value));
gray_value = constrain((factor * (gray_value - 128)) + 128);

// Adjust the brightness
Expand Down

0 comments on commit 29107bc

Please sign in to comment.