From 29107bc427d467ed4a0018e496fa2318ecbe77cd Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Fri, 16 Oct 2020 18:22:42 -0500 Subject: [PATCH] Fixing some additional cpp_test complaints --- src/Clip.cpp | 1 - src/Timeline.cpp | 2 +- src/effects/Mask.cpp | 18 ++++++------------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Clip.cpp b/src/Clip.cpp index 0035d766e..3c2c05190 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -1162,7 +1162,6 @@ void Clip::apply_keyframes(std::shared_ptr 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); diff --git a/src/Timeline.cpp b/src/Timeline.cpp index f7f018e7c..4d12b1374 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -492,7 +492,7 @@ void Timeline::add_layer(std::shared_ptr 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()); } diff --git a/src/effects/Mask.cpp b/src/effects/Mask.cpp index d0e86cd16..a631775fa 100644 --- a/src/effects/Mask.cpp +++ b/src/effects/Mask.cpp @@ -102,12 +102,6 @@ std::shared_ptr Mask::GetFrame(std::shared_ptr 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)); @@ -115,16 +109,16 @@ std::shared_ptr Mask::GetFrame(std::shared_ptr frame, int64_t fram 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