| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file is part of the Falcon Player (FPP) and is Copyright (C) | ||
| 3 | * 2013-2025 by the Falcon Player Developers. | ||
| 4 | * | ||
| 5 | * The Falcon Player (FPP) is free software, and is covered under | ||
| 6 | * multiple Open Source licenses. Please see the included 'LICENSES' | ||
| 7 | * file for descriptions of what files are covered by each license. | ||
| 8 | * | ||
| 9 | * This source file is covered under the LGPL v2.1 as described in the | ||
| 10 | * included LICENSE.LGPL file. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include "fpp-pch.h" | ||
| 14 | |||
| 15 | #include "fpp-json.h" | ||
| 16 | |||
| 17 | #include "../../log.h" | ||
| 18 | |||
| 19 | #include "ClampValueOutputProcessor.h" | ||
| 20 | |||
| 21 | 1 | ClampValueOutputProcessor::ClampValueOutputProcessor(const Json::Value& config) { | |
| 22 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | description = config["description"].asString(); |
| 23 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | active = config["active"].asInt() ? true : false; |
| 24 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | start = config["start"].asInt(); |
| 25 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | count = config["count"].asInt(); |
| 26 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | value = config["value"].asInt(); |
| 27 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | ProcessModelConfig(config, model, start, count); |
| 28 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | LogInfo(VB_CHANNELOUT, "Clamp Channel Value: %d-%d => %d, Model: %s\n", |
| 29 | start + 1, start + count, | ||
| 30 | value, model.c_str()); | ||
| 31 | 1 | } | |
| 32 | |||
| 33 | ✗ | ClampValueOutputProcessor::~ClampValueOutputProcessor() { | |
| 34 | ✗ | } | |
| 35 | |||
| 36 | 15 | void ClampValueOutputProcessor::ProcessData(unsigned char* channelData) const { | |
| 37 | 15 | const int maxVal = value; | |
| 38 | 15 | int clamped = 0; | |
| 39 |
2/2✓ Branch 0 taken 2250 times.
✓ Branch 1 taken 15 times.
|
2265 | for (int x = 0; x < count; x++) { |
| 40 | 2250 | unsigned char& val = channelData[start + x]; | |
| 41 |
2/2✓ Branch 0 taken 639 times.
✓ Branch 1 taken 1611 times.
|
2250 | if (val > maxVal) { |
| 42 | 639 | val = static_cast<unsigned char>(maxVal); | |
| 43 | 639 | clamped++; | |
| 44 | } | ||
| 45 | } | ||
| 46 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 6 times.
|
15 | if (clamped) { |
| 47 | 9 | LogExcess(VB_CHANNELOUT, "Clamped %d channel(s) to %d\n", clamped, maxVal); | |
| 48 | } | ||
| 49 | 15 | } | |
| 50 |