Zip.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: Zip.h
  4. * Description: Node to zip a pair of stream
  5. *
  6. * $Date: 06 August 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 _ZIP_H_
  29. #define _ZIP_H_
  30. template<typename IN1, int inputSize1,typename IN2,int inputSize2,typename OUT,int outputSize>
  31. class Zip;
  32. template<typename IN, int inputSize,int outputSize>
  33. class Zip<IN,inputSize,IN,inputSize,IN,outputSize>: public GenericNode21<IN,inputSize,IN,inputSize,IN,outputSize>
  34. {
  35. public:
  36. Zip(FIFOBase<IN> &src1,FIFOBase<IN> &src2,FIFOBase<IN> &dst):
  37. GenericNode21<IN,inputSize,IN,inputSize,IN,outputSize>(src1,src2,dst){};
  38. int run(){
  39. IN *a1=this->getReadBuffer1();
  40. IN *a2=this->getReadBuffer2();
  41. IN *b=this->getWriteBuffer1();
  42. for(int i = 0; i<inputSize; i++)
  43. {
  44. b[2*i] = a1[i];
  45. b[2*i+1] = a2[i];
  46. }
  47. return(0);
  48. };
  49. };
  50. #endif