dspx 1.4.8 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dspx",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "description": "High-performance DSP library with native C++ acceleration and Redis state persistence",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
Binary file
@@ -342,19 +342,19 @@ namespace dsp
342
342
  throw std::runtime_error("setState() requires stateful mode");
343
343
  }
344
344
 
345
- // Validate size - must match the power-of-2 buffer size, not coefficient count
346
- if (state.size() != m_state.size())
347
- {
348
- throw std::invalid_argument("state size must match internal buffer size");
349
- }
350
- if (stateIndex >= state.size() && !state.empty())
351
- {
352
- throw std::invalid_argument("stateIndex out of range");
353
- }
354
-
355
345
  #if defined(__ARM_NEON) || defined(__aarch64__)
356
346
  if (m_useNeon && m_neonFilter)
357
347
  {
348
+ // Validate against NEON buffer size on ARM
349
+ if (state.size() != m_neonFilter->getBufferSize())
350
+ {
351
+ throw std::invalid_argument("state size must match internal buffer size");
352
+ }
353
+ if (stateIndex >= state.size() && !state.empty())
354
+ {
355
+ throw std::invalid_argument("stateIndex out of range");
356
+ }
357
+
358
358
  // Convert to float vector for NEON filter's linearization
359
359
  std::vector<float> floatState(state.size());
360
360
  for (size_t i = 0; i < state.size(); ++i)
@@ -365,6 +365,17 @@ namespace dsp
365
365
  return;
366
366
  }
367
367
  #endif
368
+
369
+ // Validate size - must match the power-of-2 buffer size, not coefficient count
370
+ if (state.size() != m_state.size())
371
+ {
372
+ throw std::invalid_argument("state size must match internal buffer size");
373
+ }
374
+ if (stateIndex >= state.size() && !state.empty())
375
+ {
376
+ throw std::invalid_argument("stateIndex out of range");
377
+ }
378
+
368
379
  m_state = state;
369
380
  m_stateIndex = stateIndex;
370
381
  }