| 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 | #include "../../overlays/PixelOverlay.h" | ||
| 15 | #include "../../overlays/PixelOverlayModel.h" | ||
| 16 | |||
| 17 | #include <math.h> | ||
| 18 | #include <stdio.h> | ||
| 19 | |||
| 20 | #include "fpp-json.h" | ||
| 21 | |||
| 22 | #include "../../log.h" | ||
| 23 | |||
| 24 | #include "ScaleValueOutputProcessor.h" | ||
| 25 | #include "OutputProcessor.h" | ||
| 26 | |||
| 27 | 2 | ScaleValueOutputProcessor::ScaleValueOutputProcessor(const Json::Value& config) { | |
| 28 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | description = config["description"].asString(); |
| 29 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | active = config["active"].asInt() ? true : false; |
| 30 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | start = config["start"].asInt(); |
| 31 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | count = config["count"].asInt(); |
| 32 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | scale = config["scale"].asFloat(); |
| 33 | |||
| 34 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | ProcessModelConfig(config, model, start, count); |
| 35 | |||
| 36 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | LogInfo(VB_CHANNELOUT, "Scale Channel Value: %d-%d => Scale: %f Model: %s\n", |
| 37 | start + 1, start + count, | ||
| 38 | scale, model.c_str()); | ||
| 39 | |||
| 40 | 2 | float sf = scale; | |
| 41 |
2/2✓ Branch 0 taken 512 times.
✓ Branch 1 taken 2 times.
|
514 | for (int x = 0; x < 256; x++) { |
| 42 | 512 | float f = x * scale; | |
| 43 |
2/2✓ Branch 0 taken 213 times.
✓ Branch 1 taken 299 times.
|
512 | if (f > 255.0) { |
| 44 | 213 | f = 255.0; | |
| 45 | } | ||
| 46 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 512 times.
|
512 | if (f < 0.0) { |
| 47 | ✗ | f = 0.0; | |
| 48 | } | ||
| 49 | 512 | table[x] = round(f); | |
| 50 | } | ||
| 51 | 2 | } | |
| 52 | |||
| 53 | ✗ | ScaleValueOutputProcessor::~ScaleValueOutputProcessor() { | |
| 54 | ✗ | } | |
| 55 | |||
| 56 | 30 | void ScaleValueOutputProcessor::ProcessData(unsigned char* channelData) const { | |
| 57 |
2/2✓ Branch 0 taken 540 times.
✓ Branch 1 taken 30 times.
|
570 | for (int x = 0; x < count; x++) { |
| 58 | 540 | channelData[start + x] = table[channelData[start + x]]; | |
| 59 | } | ||
| 60 | 30 | } | |
| 61 |