hyperion.ng icon indicating copy to clipboard operation
hyperion.ng copied to clipboard

Smoothing broken after PR #1043 ?

Open orecus opened this issue 4 years ago • 16 comments

  • [x] I confirm that this is an issue rather than a question.

Bug report

It seems that Smoothing is completely broken after the #1043 PR. Tested first on commit 36c0514 and going back to commit 8345544 works fine.

If smoothing is enabled on 36c0514 the LEDS never update, regardless of the configuration set for Smoothing, the "outputRate" is always 0hz regardless of what is set in the UI. If I disable Smoothing, they start working directly. The logs show nothing else or indicate that something is wrong, seems that whichever I configure under Smoothing, isn't saved or used. For example, setting and saving an Output Rate, does not do a difference.

While compiling from source, the following is shown, perhaps this is relevant?

/home/osmc/hyperion-vero4k/source/libsrc/hyperion/LinearColorSmoothing.cpp: In static member function ‘static void LinearColorSmoothing::aggregateComponents(const std::vector<ColorRgb>&, std::vector<long long unsigned int>&, float)’: /home/osmc/hyperion-vero4k/source/libsrc/hyperion/LinearColorSmoothing.cpp:273:30: warning: left shift count >= width of type [-Wshift-count-overflow] const uint64_t scale = (1l<<FPShift) * static_cast<double>(weight);

Logs Snippet 2020-11-06T23:13:45.026Z [hyperiond AMLOGICGRABBER] (INFO) VPU mode 2020-11-06T23:13:45.059Z [hyperiond AMLOGICGRABBER] (ERROR) Read of device failed: 61 - No data available 2020-11-06T23:13:55.620Z [hyperiond WEBSOCKET] (DEBUG) (JsonAPI.cpp:81:handleInstanceSwitch()) Client '::ffff:10.20.2.131' switch to Hyperion instance 0 2020-11-06T23:14:15.399Z [hyperiond SMOOTHING] (INFO) linear - Time: -215872984 ms, outputRate 0.000000 Hz, interpolationRate: 25.000000 Hz, timer: 0 ms, Dithering: 1077477376, Decay: 0.000000 -> HalfTime: 702891342714873743676605278412475747484677469503940366047042437365526423213063914723389076187464736254242391118276049603142819263232952367246846459904.000000 ms 2020-11-06T23:14:15.399Z [hyperiond SMOOTHING] (INFO) linear - Time: -206108368 ms, outputRate 0.000000 Hz, interpolationRate: 25.000000 Hz, timer: 0 ms, Dithering: 1077477376, Decay: 0.000000 -> HalfTime: 0.000000 ms 2020-11-06T23:14:26.669Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) Smoothing: disabled 2020-11-06T23:14:26.670Z [hyperiond SMOOTHING] (INFO) linear - Time: -687192832 ms, outputRate 0.000000 Hz, interpolationRate: 25.000000 Hz, timer: 0 ms, Dithering: 1077477376, Decay: 0.000000 -> HalfTime: 0.000000 ms 2020-11-06T23:14:26.671Z [hyperiond SMOOTHING] (INFO) linear - Time: 7 ms, outputRate 0.000000 Hz, interpolationRate: 25.000000 Hz, timer: 0 ms, Dithering: 1077477376, Decay: 0.000000 -> HalfTime: 0.000000 ms 2020-11-06T23:14:34.400Z [hyperiond COMPONENTREG] (DEBUG) (ComponentRegister.cpp:36:setNewComponentState()) Smoothing: enabled 2020-11-06T23:14:34.400Z [hyperiond SMOOTHING] (INFO) linear - Time: -687192832 ms, outputRate 0.000000 Hz, interpolationRate: 25.000000 Hz, timer: 0 ms, Dithering: 1077477376, Decay: 0.000000 -> HalfTime: 0.000000 ms 2020-11-06T23:14:34.401Z [hyperiond SMOOTHING] (INFO) linear - Time: 7 ms, outputRate 0.000000 Hz, interpolationRate: 25.000000 Hz, timer: 0 ms, Dithering: 1077477376, Decay: 0.000000 -> HalfTime: 0.000000 ms

Steps to reproduce

Activate Smoothing, Linear or Decay does not matter.

What is expected?

That it works :)

What is actually happening?

No updates are sent to the LED devices

System

Hyperion Server:

  • Build: (HEAD detached at 36c05142) (GitHub-54707eff/36c05142-1604520240)
  • Build time: Nov 7 2020 00:01:50
  • Git Remote: https://github.com/hyperion-project/hyperion.ng.git
  • Version: 2.0.0-alpha.8
  • UI Lang: en (BrowserLang: sv-SE)
  • UI Access: expert
  • Avail Capt: v4l2,framebuffer,amlogic
  • Database: read/write

Hyperion Server OS:

  • Distribution: Open Source Media Center
  • Architecture: arm64
  • CPU Hardware: Vero4KPlus
  • Kernel: linux (3.14.29-160-osmc (WS: 32))
  • Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36

orecus avatar Nov 06 '20 23:11 orecus

@orecus Could you re-test with #1075, pleae?

Lord-Grey avatar Nov 07 '20 06:11 Lord-Grey

@Lord-Grey Still the same i'm afraid. I've set Output Rate to 25 in the GUI, saved and restarted the Hyperion Service to verify that it's actually saved. Still shows 25 in GUI but logs says 0.

2020-11-07T12:37:28.579Z [hyperiond SMOOTHING] (DEBUG) (LinearColorSmoothing.cpp:701:selectConfig()) Type: decay - Time: 7 ms, outputRate 0.000000 Hz, interpolationRate: 25.000000 Hz, timer: 0 ms, Dithering: 1077477376, Decay: 0.000000 -> HalfTime: 1.000000 ms
Hyperion Server: 
- Build:       Test (LordGrey-722eb79b/228c6c4f-1604732075)
- Build time:  Nov  7 2020 13:26:15
- Git Remote:  https://github.com/hyperion-project/hyperion.ng.git
- Version:     2.0.0-alpha.8
- UI Lang:     en (BrowserLang: sv-SE)
- UI Access:   expert
- Avail Capt:  v4l2,framebuffer,amlogic
- Database:    read/write

Hyperion Server OS: 
- Distribution: Open Source Media Center
- Architecture: arm64
- CPU Hardware: Vero4KPlus
- Kernel:       linux (3.14.29-160-osmc (WS: 32))
- Browser:      Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36

orecus avatar Nov 07 '20 12:11 orecus

@orecus Sorry, did you load a pre-build artifact from git or built one by your own?

https://github.com/hyperion-project/hyperion.ng/pull/1075/checks?check_run_id=1367080469

For testing, I loaded the Window Build, did updates to all fields (with values easily recognisable) and those values perfectly made it to the log output.

image

2020-11-07T16:22:52.028 hyperiond SMOOTHING : <DEBUG> LinearColorSmoothing.cpp:701:LinearColorSmoothing::selectConfig() | Type: decay - Time: 190 ms, outputRate 15.000000 Hz, interpolationRate: 20.000000 Hz, timer: 33 ms, Dithering: 0, Decay: 2.000000 -> HalfTime: 55.649712 ms

Even after restart, I get the same value again:

2020-11-07T16:25:40.055 hyperiond SMOOTHING : <DEBUG> LinearColorSmoothing.cpp:701:LinearColorSmoothing::selectConfig() | Type: decay - Time: 190 ms, outputRate 15.000000 Hz, interpolationRate: 20.000000 Hz, timer: 33 ms, Dithering: 0, Decay: 2.000000 -> HalfTime: 55.649712 ms

Maybe you start with a fresh configuration DB?

Lord-Grey avatar Nov 07 '20 15:11 Lord-Grey

Seems "Build: Test (LordGrey-722eb79b/228c6c4f-1604732075)" incorporate that fix. Lord-Grey check it please with some old user config with enabled linear smoothing before, for example 2.0.0.8 release. In my case it starts to lose settings and it jumps in some kind of loop. Removing config fixes it but isnt an option for most users.

awawa-dev avatar Nov 07 '20 17:11 awawa-dev

@Lord-Grey The basic steps I did when I found this issue and my test today;

  1. Started fresh with a clean install (and no exsisting configuration) and built from source based on 36c0514.
  2. Discovered the issue once I had setup my devices, they only worked if Smoothing was fully off.
  3. Downgraded to 8345544 ontop of my configuration and enabled Smoothing, works as expected.
  4. Tested PR #1075 by cloning 36c0514, then sudo git fetch origin pull/1075/head:Test and sudo git checkout Test. Once that was done I did a new build from source and tested, issue persisted.

I never wiped my configuration after the clean install in step 1 for the test today either, I also had other errors in the GUI that was solved by removing sessionStorage and localStorage when I first tested 36c0514 which is also why I started fully fresh with it and wiped my configuration for step 1.

orecus avatar Nov 07 '20 17:11 orecus

@orecus I will have another look. Nevertheless, a valid test scenario is to install alpha 8 and create a configuration. Then install the latest PR and see, if it is working. If the configuration was spoiled due to some interim PRs, is the risk of running interim versions.

@awawa-dev/ @orecus I tested with old config records in the DB and then started Hyperion and it worked at my end. Could you share your configuration, please?

In case you are running multiple installations, have you updated the Webserver path to ensure that the lastest JavaScript files are used? A mismatch of Js with backend code is sometimes the reason for misbehavior...

Lord-Grey avatar Nov 07 '20 19:11 Lord-Grey

@Lord-Grey I'm only running one installation (but with three WLED devices configured) on my end, attached is my configuration. outputRate seems correct in there, but the that value does not seem to be used as mentioned and in the logs.

Hyperion-2.0.0-alpha.8-Backup (Ambilight Config) 2020.11.07.json.txt

orecus avatar Nov 07 '20 19:11 orecus

@awawa-dev

Please find below the test-scenario moving from Alpha-8" to "new".

Have the smoothing configuration as in Alpha-8 (I put some odd numbers for traceability).

image

Start hyperion It reads the old-config, plus values are mapped and new values are defaulted correctly.

2020-11-07T20:44:17.983 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:91:handleSettingsUpdate() | config: [{"continuousOutput":true,"enable":true,"time_ms":210,"type":"linear","updateDelay":10,"updateFrequency":30}]
2020-11-07T20:44:17.983 hyperiond COMPONENTREG : <DEBUG> ComponentRegister.cpp:36:setNewComponentState() | Smoothing: enabled
2020-11-07T20:44:17.983 hyperiond JSONSERVER   : <INFO> Started on port 19444
2020-11-07T20:44:17.983 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:120:handleSettingsUpdate() | smoothing cfg_id 0: pause: 0 bool, settlingTime: 210 ms, interval: 33 ms (30 Hz), updateDelay: 10 frames
2020-11-07T20:44:17.983 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:703:selectConfig() | Type: linear - Time: 210 ms, outputRate 25.000000 Hz, interpolationRate: 25.000000 Hz, timer: 33 ms, Dithering: 0, Decay: 1.000000 -> HalfTime: 105.000000 ms

image

Update Output_Rate = 20, Save

2020-11-07T20:46:02.728 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:703:selectConfig() | Type: linear - Time: 210 ms, outputRate 20.000000 Hz, interpolationRate: 1.000000 Hz, timer: 33 ms, Dithering: 1, Decay: 1.000000 -> HalfTime: 105.000000 ms
2020-11-07T20:46:02.729 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:91:handleSettingsUpdate() | config: [{"continuousOutput":true,"decay":1,"dithering":true,"enable":true,"interpolationRate":1,"outputRate":20,"time_ms":210,"type":"linear","updateDelay":10,"updateFrequency":30}]
2020-11-07T20:46:02.729 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:120:handleSettingsUpdate() | smoothing cfg_id 0: pause: 0 bool, settlingTime: 210 ms, interval: 33 ms (30 Hz), updateDelay: 10 frames
2020-11-07T20:46:02.729 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:703:selectConfig() | Type: linear - Time: 210 ms, outputRate 20.000000 Hz, interpolationRate: 1.000000 Hz, timer: 33 ms, Dithering: 1, Decay: 1.000000 -> HalfTime: 105.000000 ms

image

Database is fully in line with the saved values.

Lord-Grey avatar Nov 07 '20 19:11 Lord-Grey

@orecus I guess I now know what might confuse you....

You see different selectConfig log-lines. Some with e.g. decay and some even with linear and different value sets, correct.

Similar to those:

./build-x86x64/bin/hyperiond -d -u atomorb |grep LinearColorSmoothing.cpp

2020-11-07T21:40:17.959 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:701:selectConfig() | Cfg: 0,  Type: decay - Time: 200 ms, outputRate 10.000000 Hz, interpolationRate: 1.000000 Hz, timer: 66 ms, Dithering: 1, Decay: 1.000000 -> HalfTime: 100.000000 ms
2020-11-07T21:40:17.959 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:701:selectConfig() | Previous line repeats 1 times
2020-11-07T21:40:18.013 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:701:selectConfig() | Cfg: 2,  Type: linear - Time: 200 ms, outputRate 25.000000 Hz, interpolationRate: 25.000000 Hz, timer: 40 ms, Dithering: 0, Decay: 1.000000 -> HalfTime: 100.000000 ms
2020-11-07T21:40:21.112 hyperiond SMOOTHING    : <DEBUG> LinearColorSmoothing.cpp:701:selectConfig() | Cfg: 0,  Type: decay - Time: 200 ms, outputRate 10.000000 Hz, interpolationRate: 1.000000 Hz, timer: 66 ms, Dithering: 1, Decay: 1.000000 -> HalfTime: 100.000000 ms

The reason for the different logs is that one could configure a different smoothing configuration set per effect. Given that you might run a start or background effect, you see different lines. I did a small change to the debug statement and there you find the configuration set used. In the sample above (Cfg: 0 and Cfg: 2). Cfg: 0 is the default configuration that you see in the UI.

Hoping that explains the background....

Lord-Grey avatar Nov 07 '20 20:11 Lord-Grey

Compiled PR myself and it doesnt work, jumps from one settings to other after start

2020-11-07T20:39:49.057Z [hyperiond SMOOTHING] (DEBUG) (LinearColorSmoothing.cpp:701:LinearColorSmoothing::selectConfig()) Type: linear - Time: 150 ms, outputRate 25.000000 Hz, interpolationRate: 25.000000 Hz, timer: 10 ms, Dithering: 0, Decay: 1.000000 -> HalfTime: 75.000000 ms
2020-11-07T20:39:49.132Z [hyperiond SMOOTHING] (DEBUG) (LinearColorSmoothing.cpp:701:LinearColorSmoothing::selectConfig()) Type: linear - Time: 200 ms, outputRate 25.000000 Hz, interpolationRate: 25.000000 Hz, timer: 40 ms, Dithering: 0, Decay: 1.000000 -> HalfTime: 100.000000 ms

image image

image

As you can see it's only linear...which settings are applied and what is the difference between 'Update freqency' and 'Output rate'? I think that it's important because now I'm lost how to setup linear smoothing. Humbly remind that it's a crucial modul of the Hyperion.

awawa-dev avatar Nov 07 '20 20:11 awawa-dev

see previous post for the explanation. seems feedback cross...

Lord-Grey avatar Nov 07 '20 20:11 Lord-Grey

nope, there is no 'decay' in my log

awawa-dev avatar Nov 07 '20 20:11 awawa-dev

nope, there is no 'decay' in my log

You will only see "decay", if you configured decay. You configured "linear". I just refereed in the explanation to my sample provided. If you change the mode to "decay" you will see the default config 0 = "decay" and the other config sets as"linear".

I just pushed a small change that you see the config# before the type of configuration.

cfg [0] matchs the values on the UI

Sample:

DEBUG> LinearColorSmoothing.cpp:701:selectConfig() | cfg [0]: Type: decay - Time: 190 ms, outputRate 25.000000 Hz, interpolationRate: 2.000000 Hz, timer: 38 ms, Dithering: 1, Decay: 2.000000 -> HalfTime: 55.649712 ms

image

Lord-Grey avatar Nov 07 '20 21:11 Lord-Grey

OK, I've completely disabled effects. Now I have double initialization but at least the settings are correct:

2020-11-07T21:11:55.697Z [hyperiond SMOOTHING] (DEBUG) (LinearColorSmoothing.cpp:701:LinearColorSmoothing::selectConfig()) Type: linear - Time: 150 ms, outputRate 3.000000 Hz, interpolationRate: 2.000000 Hz, timer: 10 ms, Dithering: 1, Decay: 1.000000 -> HalfTime: 75.000000 ms
2020-11-07T21:11:55.697Z [hyperiond SMOOTHING] (DEBUG) (LinearColorSmoothing.cpp:701:LinearColorSmoothing::selectConfig()) Type: linear - Time: 150 ms, outputRate 3.000000 Hz, interpolationRate: 2.000000 Hz, timer: 10 ms, Dithering: 1, Decay: 1.000000 -> HalfTime: 75.000000 ms

But still I dont know how to setup linear smoothing. Which settings holds frequency for LEDs.

awawa-dev avatar Nov 07 '20 21:11 awawa-dev

When you use linear mode, the only settings that matter are Time and Update Frequency. They should work exactly like they used before.

e.g.:

Type: Linear Time: 190 Update Frequency: 25

Should update the LEDs every 40ms = 25 times a second, and target a linear interpolation time of 190ms between frames. This just behaves like it used to before introduction of decay. The values of interpolationRate and outputRate are not taken into account, these are only used for Type = Decay.

Edit: You could achieve a similar behaviour for decay-mode when you select:

Type: Decay Time: 190 Update Frequency: 25 (*or any value >= 25, even 1000) InterpolationRate: 25 OutputRate: 25 Decay: 1 Dithering: Off

This will calculate a new frame that consists of the last 190ms average colors per LED every 40ms = 25 times a second and output it every time to the LEDs.

The-Master777 avatar Nov 07 '20 22:11 The-Master777

@Lord-Grey That explains the values in the logs, good that you added cfg [i] so you can see the difference, but it still doesn't work. Neither Linear or Decay, so there seems to be something broken with smoothing.

I still see outputRate = 0 for both the configurations in the log, even when I've set it to 25 in the GUI, I would expect one of them to show 25 since that is set in the UI.

orecus avatar Nov 08 '20 08:11 orecus