SceneKit Visualization: Minor vDSP optimization
Some checks failed
Check if Cog buildable / Build Universal Cog.app (push) Has been cancelled
Some checks failed
Check if Cog buildable / Build Universal Cog.app (push) Has been cancelled
Gather maximum bands using vDSP, and also align the structure size to 4 floats per step. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
43e4dc4955
commit
67fdd0741f
2 changed files with 12 additions and 9 deletions
|
@ -11,6 +11,8 @@
|
|||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#import <Accelerate/Accelerate.h>
|
||||
|
||||
#import "analyzer.h"
|
||||
|
||||
#import "Logging.h"
|
||||
|
@ -416,16 +418,14 @@ extern NSString *CogPlaybackDidStopNotificiation;
|
|||
for(int i = 0; i < 11; ++i) {
|
||||
float maxValue = 0.0;
|
||||
float maxMax = 0.0;
|
||||
for(int j = 0; j < maxBars; ++j) {
|
||||
{
|
||||
const int barBase = i * barStep;
|
||||
const int barIndex = barBase + j;
|
||||
if(barIndex < _draw_data.bar_count) {
|
||||
if(bar[barIndex].bar_height > maxValue) {
|
||||
maxValue = bar[barIndex].bar_height;
|
||||
}
|
||||
if(bar[barIndex].peak_ypos > maxMax) {
|
||||
maxMax = bar[barIndex].peak_ypos;
|
||||
}
|
||||
const int barEnd = (barBase + maxBars) <= _draw_data.bar_count ? (barBase + maxBars) : _draw_data.bar_count;
|
||||
{
|
||||
const int stride = sizeof(ddb_analyzer_draw_bar_t) / sizeof(Float32);
|
||||
const int barCount = barEnd - barBase + 1;
|
||||
vDSP_maxv(&bar[barBase].bar_height, stride, &maxValue, barCount);
|
||||
vDSP_maxv(&bar[barBase].peak_ypos, stride, &maxMax, barCount);
|
||||
}
|
||||
}
|
||||
SCNNode *node = nodes[i + 1];
|
||||
|
|
3
Visualization/ThirdParty/deadbeef/analyzer.h
vendored
3
Visualization/ThirdParty/deadbeef/analyzer.h
vendored
|
@ -23,6 +23,8 @@
|
|||
#ifndef analyzer_h
|
||||
#define analyzer_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -52,6 +54,7 @@ typedef struct {
|
|||
float xpos;
|
||||
float peak_ypos;
|
||||
float bar_height;
|
||||
uint32_t unused;
|
||||
} ddb_analyzer_draw_bar_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in a new issue