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 <Metal/Metal.h>
|
||||||
|
|
||||||
|
#import <Accelerate/Accelerate.h>
|
||||||
|
|
||||||
#import "analyzer.h"
|
#import "analyzer.h"
|
||||||
|
|
||||||
#import "Logging.h"
|
#import "Logging.h"
|
||||||
|
@ -416,16 +418,14 @@ extern NSString *CogPlaybackDidStopNotificiation;
|
||||||
for(int i = 0; i < 11; ++i) {
|
for(int i = 0; i < 11; ++i) {
|
||||||
float maxValue = 0.0;
|
float maxValue = 0.0;
|
||||||
float maxMax = 0.0;
|
float maxMax = 0.0;
|
||||||
for(int j = 0; j < maxBars; ++j) {
|
{
|
||||||
const int barBase = i * barStep;
|
const int barBase = i * barStep;
|
||||||
const int barIndex = barBase + j;
|
const int barEnd = (barBase + maxBars) <= _draw_data.bar_count ? (barBase + maxBars) : _draw_data.bar_count;
|
||||||
if(barIndex < _draw_data.bar_count) {
|
{
|
||||||
if(bar[barIndex].bar_height > maxValue) {
|
const int stride = sizeof(ddb_analyzer_draw_bar_t) / sizeof(Float32);
|
||||||
maxValue = bar[barIndex].bar_height;
|
const int barCount = barEnd - barBase + 1;
|
||||||
}
|
vDSP_maxv(&bar[barBase].bar_height, stride, &maxValue, barCount);
|
||||||
if(bar[barIndex].peak_ypos > maxMax) {
|
vDSP_maxv(&bar[barBase].peak_ypos, stride, &maxMax, barCount);
|
||||||
maxMax = bar[barIndex].peak_ypos;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SCNNode *node = nodes[i + 1];
|
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
|
#ifndef analyzer_h
|
||||||
#define analyzer_h
|
#define analyzer_h
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,6 +54,7 @@ typedef struct {
|
||||||
float xpos;
|
float xpos;
|
||||||
float peak_ypos;
|
float peak_ypos;
|
||||||
float bar_height;
|
float bar_height;
|
||||||
|
uint32_t unused;
|
||||||
} ddb_analyzer_draw_bar_t;
|
} ddb_analyzer_draw_bar_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in a new issue