1004,West-CBD,No.139 Binhe Rd,Futian District,Shenzhen, China Post Code:518048

+86-18682200597

sales@szhaiwang.com

  • About Us
    Company Profile Enterprise Honor Factory Environment Company Culture Development Path
  • Product
    Microwave Sensor Series PIR Sensor Series LDR Sensor and Light Sensor Thermistor Sensor Series Fresnel Lens Reminder Alarm Sensor
  • News
    Company News Industry News Latest News
  • Service
    FAQ Download
  • Contacts

    Home  -  News  -  Industry News

    How do I fake circular buffers in FIR software?5.8G Frequency microwave module

    source:Industry News release time:2023-03-15 Hits:     Popular:Infrared sensing module

      

      When hardware support for circular buffers isn't available, you have to "fake" them. Also, since ANSI C has no construct to describe circular buffers, most C compilers can't generate code to use them, even if the target processor has them.

      You can always implement a circular buffer by duplicating the logic of a circular buffer in software (and many have), but the overhead can be prohibitive; the circular-fake might take several instructions to implement, compared to just a single instruction to do the multiply-accumulate operation. Therefore you need to fake it.

      Here are several basic techniques to fake circular buffers:

      1. Split the calculation: You can split any FIR calculation into its "pre-wrap" and "post-wrap" parts. By splitting the calculation into these two parts, you essentially can do the circular logic only once, rather than once per tap. (See fir_double_z in FirAlgs.c above.)

      2. Duplicate the delay line: For a FIR with N taps, use a delay line of size 2N. Copy each sample to its proper location, as well as at location-plus-N. Therefore, the FIR calculation's MAC loop can be done on a flat buffer of N points, starting anywhere within the first set of N points. The second set of N delayed samples provides the "wrap around" comparable to a true circular buffer. (See fir_double_z in FirAlgs.c above.)

      3. Duplicate the coefficients: This is similar to the above, except that the duplication occurs in terms of the coefficients, not the delay line. Compared to the previous method, this has a calculation advantage of not having to store each incoming sample twice, and it also has a memory advantage when the same coefficient set will be used on multiple delay lines. (See fir_double_h in FirAlgs.c above.)

      4. Use block processing: In block processing, you use a delay line which is a multiple of the number of taps. You therefore only have to move the data once per block to implement the delay-line mechanism. When the block size becomes "large", the overhead of a moving the delay line once per block becomes negligible.


    Read recommendations:

    What NTC thermal resistance is used for Xiaomi wireless charging treasure.SMD Photosensitive sensor

    Can replace Ishizuka NTC10KB3435 thermistor.Microwave Sensor Module Radar Sensor

    PIR Lens 7805

    8308-C PIR lens

    8308-D PIR lens

    Popular Recommended Products