AppNodes.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: AppNodes.h
  4. * Description: Application nodes for Example 2
  5. *
  6. * $Date: 29 July 2021
  7. * $Revision: V1.10.0
  8. *
  9. * Target Processor: Cortex-M and Cortex-A cores
  10. * -------------------------------------------------------------------- */
  11. /*
  12. * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
  13. *
  14. * SPDX-License-Identifier: Apache-2.0
  15. *
  16. * Licensed under the Apache License, Version 2.0 (the License); you may
  17. * not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  24. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. */
  28. #ifndef _APPNODES_H_
  29. #define _APPNODES_H_
  30. #include <iostream>
  31. #include "Unzip.h"
  32. template<typename IN, int inputSize>
  33. class TFLite: public GenericSink<IN, inputSize>
  34. {
  35. public:
  36. TFLite(FIFOBase<IN> &src):GenericSink<IN,inputSize>(src){};
  37. int run()
  38. {
  39. IN *b=this->getReadBuffer();
  40. printf("TFLite\n");
  41. for(int i=0;i<inputSize;i++)
  42. {
  43. std::cout << (int)b[i] << std::endl;
  44. }
  45. return(0);
  46. };
  47. };
  48. template<typename OUT,int outputSize>
  49. class StereoSource: GenericSource<OUT,outputSize>
  50. {
  51. public:
  52. StereoSource(FIFOBase<OUT> &dst):GenericSource<OUT,outputSize>(dst),mCounter(0){};
  53. int run(){
  54. OUT *b=this->getWriteBuffer();
  55. printf("StereoSource\n");
  56. for(int i=0;i<outputSize;i++)
  57. {
  58. b[i] = (OUT)mCounter++;
  59. }
  60. return(0);
  61. };
  62. int mCounter;
  63. };
  64. template<typename IN, int inputSize,typename OUT,int outputSize>
  65. class MFCC: public GenericNode<IN,inputSize,OUT,outputSize>
  66. {
  67. public:
  68. MFCC(FIFOBase<IN> &src,FIFOBase<OUT> &dst):GenericNode<IN,inputSize,OUT,outputSize>(src,dst){};
  69. int run(){
  70. printf("MFCC\n");
  71. IN *a=this->getReadBuffer();
  72. OUT *b=this->getWriteBuffer();
  73. b[0] =(OUT)a[0];
  74. return(0);
  75. };
  76. };
  77. #endif