Iir filter component, audio device and coefficient switching method
By adding a weighted superposition circuit to the IIR filter, the weight of the output signal can be adjusted without changing the filter coefficients, thus solving the instability problem during the filter coefficient switching process and ensuring system stability and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2021-12-17
- Publication Date
- 2026-06-23
AI Technical Summary
When switching the coefficients of an IIR filter, existing technology cannot guarantee the stability of the filtering system, resulting in discontinuous output signals and affecting the user experience.
By adding a set of IIR filter resources and adjusting the weights of the output signal using a weighted superposition method without changing the filter coefficients, the Z-domain poles remain unchanged, thus maintaining system stability.
The system achieves stability during the switching of filter coefficients, avoids increased computational overhead and latency, and improves user experience.
Smart Images

Figure CN116648856B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electronics, and in particular to an infinite impulse response (IIR) filter assembly, an audio device, and a coefficient switching method. BACKGROUND
[0002] IIR filters are widely used in the field of digital audio, such as for noise reduction or sound effect adjustment, etc. In some scenarios, the coefficients of the IIR filter need to be switched. Currently, when the coefficients of the IIR filter are switched, the filter coefficients of the IIR filter are directly adjusted, i.e., the source filter coefficients are gradually switched to the target filter coefficients. If the IIR filter is to be stable, it is necessary to ensure that the Z-domain poles of the IIR filter system are located within the unit circle. However, in the process of gradually adjusting the filter coefficients of the IIR filter, the Z-domain poles of the IIR filter coefficients change with the change of the filter coefficients, and it is impossible to ensure that the Z-domain poles of the IIR filter system are always located within the unit circle during the process of gradually switching the source filter coefficients of the IIR filter to the target filter coefficients. Therefore, it is impossible to ensure the stability of the IIR filter system during the coefficient switching process of the IIR filter. SUMMARY
[0003] The present application provides an IIR filter switching assembly, an audio device, and a coefficient switching method, which are used to improve the stability of the system and improve the user experience during the switching of the IIR filter coefficients.
[0004] In a first aspect, the present application provides an IIR filter assembly, which comprises a first IIR filter, a second IIR filter, a control circuit, and a signal processing circuit. The first IIR filter is configured to process an input signal using first filter coefficients to obtain a first output signal. The second IIR filter is configured to process the input signal using second filter coefficients to obtain a second output signal. The control circuit is configured to adjust a first weight signal corresponding to the first output signal and a second weight signal corresponding to the second output signal. The signal processing circuit is configured to weight and superimpose the first output signal and the second output signal according to the first weight signal and the second weight signal to obtain a filter output signal. The weighting and superimposition of the first output signal and the second output signal according to the first weight signal and the second weight signal can be understood as adjusting the first output signal according to the first weight signal and adjusting the second output signal according to the second weight signal, and then superimposing the adjusted first output signal and the adjusted second output signal together. Alternatively, the weighting and superimposition of the first output signal and the second output signal can be represented as the first output signal*alpha+the second output signal*beta, where alpha represents the first weight signal and beta represents the second weight signal.
[0005] In the above scheme, an additional set of IIR filter resources is used for switching filter coefficients. The filter coefficients of the first and second IIR filters do not need to be adjusted. Instead, when it is necessary to adjust the filter coefficients used to filter the input signal, the weights of the first output signal using the first filter coefficient and the second output signal using the second filter coefficient are adjusted. This means adjusting the proportions of the output signal components corresponding to the source filter coefficient and the target filter coefficient in the filtered output signal, gradually adjusting the filtered output signal from the output corresponding to the source filter coefficient to the output corresponding to the target filter coefficient. The IIR filtering component provided in this application allows for adjustment of only the weights of the output signals of the two IIR filters during the filter coefficient switching process. The coefficients of the two IIR filters remain unchanged, thus ensuring that the Z-domain poles of the two IIR filters do not change due to the filter coefficient changes, thereby guaranteeing the stability of the filtering system during the switching process.
[0006] In one possible design, an IIR filter component is applied to an audio device, specifically a second IIR filter used to process the input signal with a second filter coefficient to obtain a second output signal when the audio device switches from a first mode to a second mode; and a control circuit used to adjust (e.g., decrease) the first weight signal corresponding to the first output signal and adjust (e.g., increase) the second weight signal corresponding to the second output signal when the audio device switches from the first mode to the second mode.
[0007] In the above scheme, the filter coefficients of the first and second IIR filters do not need to be adjusted. Instead, during the switch from the first mode to the second mode, the weight of the first output signal using the first filter coefficient (source filter coefficient) is reduced, and the weight of the second output signal using the second filter coefficient (target filter coefficient) is increased. This reduces the proportion of the output signal component using the source filter coefficient in the adjusted output signal, while gradually increasing the proportion of the output signal component using the target filter coefficient. After the switch, the filtered output signal is the output signal corresponding to the second mode. Since only the weights of the output signals of the two IIR filters are adjusted during the switch, and the coefficients of the two IIR filters do not change, the Z-domain poles of the two IIR filters will not change due to the change in the filter coefficients. This ensures the stability of the filtering system of the two IIR filters during the switch.
[0008] In one possible design, the control circuit adjusts the value of the first weighting signal from a first value to a third value, and the value of the second weighting signal from a second value to a fourth value within a set time period. The first value is greater than 0 and less than or equal to 1, the third value is less than or equal to 0 and less than the first value, the second value is greater than or equal to 0 and less than 1, and the fourth value is less than or equal to 1 and greater than the second value. In some designs, the third value is 0 and the fourth value is 1. In still other designs, the second value is 1 and the third value is 0.
[0009] In the above design, the weight of the second IIR filter using the target filtering coefficient is reduced, for example, to 1, while the weight of the first IIR filter using the first filtering coefficient is increased, for example, to 1. This reduces the proportion of the output signal component of the source filtering coefficient in the filtered output signal until it becomes 0, while the proportion of the output signal component of the target filtering coefficient gradually increases until it becomes 1. After the switching is completed, the filtered output signal is the output signal corresponding to the second mode. This design is simple to implement and ensures the stability of the system.
[0010] In one possible design, the control circuit increments the value of the first weighting signal from a first value to a third value and the value of the second weighting signal from a second value to a fourth value within a set time period.
[0011] The first step is the third value, which can be understood as the first value decreasing to the third value multiple times, and the magnitudes of these decreases can be the same or different. The second step is the fourth value, which can be understood as the fourth value increasing to the fourth value multiple times, and the magnitudes of these increases can be the same or different. In the above design, when the filter coefficients need to be switched, a method of smoothly switching weights within a set time period is used. However, unlike the smooth switching of the filter coefficients themselves, this application uses a weighted superposition of the output signals corresponding to the first filter coefficient and the output signals corresponding to the second filter coefficient, and the weights used for weighting are smoothly stepped. Since only the weights of the output signals of the two IIR filters are adjusted during the switching process, and the coefficients of the two IIR filters do not change, the Z-domain poles of the two IIR filters will not change due to the change in the filter coefficients, thus ensuring the stability of the filtering system of the two IIR filters during the switching process.
[0012] Furthermore, to ensure the stability of the filtering system, current methods involve first calculating the Z-domain poles corresponding to the source and destination filter coefficients, and then switching the filter coefficients by performing pole switching in the Z-domain. However, Z-domain transformation increases computational overhead, and since Z-transform is essentially a frequency domain analysis, it also increases latency. This application, however, uses a method that eliminates the need for Z-transform to ensure system stability, thus avoiding the increased computational overhead and filtering latency caused by Z-transform.
[0013] In one possible design, the number of steps the first weight signal takes to increase from its first value to its third value is the same as the number of steps the second weight signal takes to increase from its second value to its fourth value. In this design, the second weight signal increases as the first weight signal decreases, resulting in a more balanced adjustment between the first and second weight signals.
[0014] In one possible design, the signal processing circuit includes a first multiplier, a second multiplier, and an adder; the input signals of the first multiplier include a first output signal and a first weight signal, the input signals of the second multiplier include a second output signal and a second weight signal, the input signals of the adder include the output signals of the first multiplier and the second multiplier, and the output signal of the adder is a filtered output signal.
[0015] The above design provides a simple circuit for implementing weighted superposition, which is low in cost and low in complexity.
[0016] In one possible design, the control circuit is also used to update the filter coefficients of the first IIR filter to the second filter coefficients after the adjustment of the first weight signal and the second weight signal is completed.
[0017] In the above design, adjusting the first and second weight signals can be understood as decreasing the first weight signal and increasing the second weight signal. Since the first IIR filter is always used as the working filter in this design, there is no need to maintain which filter is currently working, nor is it necessary to determine the current working filter before each switch. This simplifies implementation and reduces switching delay caused by determining the working filter.
[0018] In one possible design, the control circuit is also used to update the state of the second IIR filter to the blocking state after the first weight signal and the second weight signal adjustment are completed.
[0019] In one possible design, the control circuit, when updating the state of the second IIR filter to the blocking state, specifically updates the filter coefficients of the second IIR filter to 0; or updates the weights of the second output signal to 0; or de-energizes the second IIR filter.
[0020] In one possible design, the control circuit receives a control signal when the audio device switches from a first mode to a second mode, and configures the second filter coefficients to the second IIR filter according to the control signal. In the above design, the second IIR filter only takes effect when mode switching is required, making it simple to implement.
[0021] Secondly, embodiments of this application provide an audio device including the IIR filter component described in the first aspect or any design of the first aspect.
[0022] In one possible design, the audio device is either headphones or a car infotainment system.
[0023] Thirdly, embodiments of this application provide a coefficient switching method for IIR filtering. The method is applied to an IIR filtering component, which includes a first IIR filter, a second IIR filter, a control circuit, and a signal processing circuit. The first IIR filter processes an input signal to obtain a first output signal, and the first IIR filter uses a first filtering coefficient. When an audio device switches from a first mode to a second mode, a second filtering coefficient is configured for the second IIR filter, and the second IIR filter processes the input signal to obtain a second output signal. The audio device has an IIR filter component deployed therein. During the switching process, a first weighting signal corresponding to the first output signal is reduced, and a second weighting signal corresponding to the second output signal is increased. The first filtering coefficient is the current filtering coefficient corresponding to the first mode, and the second filtering coefficient is the target filtering coefficient corresponding to the second mode. The first output signal and the second output signal are weighted and superimposed according to the first weighting signal and the second weighting signal to obtain a filtered output signal.
[0024] In one possible design, reducing the first weight signal corresponding to the first output signal and increasing the second weight signal corresponding to the second output signal includes: adjusting the value of the first weight signal from a first value to a third value within a set time period, and adjusting the value of the second weight signal from a second value to a fourth value, wherein the first value is greater than 0 and less than or equal to 1, the third value is less than or equal to 0 and less than the first value, the second value is greater than or equal to 0 and less than 1, and the fourth value is less than or equal to 1 and greater than the second value.
[0025] In one possible design, adjusting the value of the first weight signal from a first value to a third value and adjusting the value of the second weight signal from a second value to a fourth value within a set time period includes: stepping the value of the first weight signal from a first value to a third value within a set time period and stepping the value of the second weight signal from a second value to a fourth value.
[0026] In one possible design, the number of steps the first weight signal takes from a first value to a third value is the same as the number of steps the second weight signal takes from a second value to a fourth value.
[0027] In one possible design, the method further includes updating the filter coefficients of the first IIR filter to the second filter coefficients after adjusting the first weight signal and the second weight signal.
[0028] In one possible design, the method further includes updating the state of the second IIR filter to the blocking state after the first and second weight signals have been adjusted.
[0029] In one possible design, updating the state of the second IIR filter to a blocking state includes: updating the filter coefficients of the second IIR filter to 0; or updating the weights of the second output signal to 0.
[0030] In one possible design, the method further includes: receiving a control signal when the audio device switches from a first mode to a second mode; and configuring a second filter coefficient to a second IIR filter according to the control signal before processing the input signal through a second IIR filter to obtain a second output signal.
[0031] The beneficial effects of the second and third aspects mentioned above can be found in the description of the relevant beneficial effects of the first aspect, and will not be repeated here. Attached Figure Description
[0032] Figure 1 A schematic diagram illustrating the implementation of a set of cascaded dual second-order IIR filters;
[0033] Figure 2 This is a schematic diagram of a possible implementation of a dual second-order IIR filter;
[0034] Figure 3 A schematic diagram of the Z-domain of an IIR filter for an unstable system;
[0035] Figure 4 A schematic diagram illustrating the smoothing of poles in the Z-domain;
[0036] Figure 5 This is a schematic diagram illustrating an application scenario of the IIR filter component provided in the embodiments of this application;
[0037] Figure 6 This is a schematic diagram of an IIR filter component structure provided in an embodiment of this application;
[0038] Figure 7 This is a schematic diagram of another IIR filter component structure provided in an embodiment of this application;
[0039] Figure 8 A schematic diagram of another IIR filter component structure provided in the embodiments of this application;
[0040] Figure 9 A schematic diagram of another IIR filter component structure provided in the embodiments of this application;
[0041] Figure 10 A schematic diagram illustrating the implementation of weight adjustment provided in the embodiments of this application;
[0042] Figure 11 A schematic diagram of a curve function for first weight adjustment provided in an embodiment of this application;
[0043] Figure 12 A schematic diagram of another curve function for first weight adjustment provided in an embodiment of this application;
[0044] Figure 13 A schematic diagram of the input and output waveforms of the IIR filter component provided in an embodiment of this application;
[0045] Figure 14 This is a schematic flowchart of the coefficient switching method for IIR filtering provided in an embodiment of this application. Detailed Implementation
[0046] The following is an explanation of the terms and techniques used in the embodiments of this application.
[0047] 1) The term "at least one" in this application refers to one or more, including one, two, three, or more; "multiple" refers to two or more, including two, three, or more. Furthermore, it should be understood that in the description of this application, words such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, or B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0048] 2) The first IIR filter and the second IIR filter involved in this application may each include one IIR filter, or they may each be composed of multiple cascaded IIR filters. This application does not specifically limit this. It should be noted that when composed of multiple cascaded IIR filters, the filter coefficients of the multiple IIR filters may be different. That is, it can be understood that the source filter coefficients before switching are different, and the target filter coefficients after switching are also different. The filter coefficients of the multiple IIR filters may also be the same. The filter coefficients are determined according to the current scenario requirements. This application does not specifically limit this in its embodiments.
[0049] As an example, the first IIR filter and the second IIR filter are of the same type of IIR filter, such as both being bisecond-order IIR filters. IIR filters are a class of recursive linear time-invariant causal systems, and their difference equations can be represented by formula (1).
[0050]
[0051] Among them, a i and b j All of these represent the filter coefficients of the IIR filter. This indicates that the input signal and the delayed input signal are combined into an M-section delay network. This indicates that the output signal is delayed to form an N-section delay network.
[0052] As an example, see Figure 1 The diagram illustrates the implementation of a cascaded biquad IIR filter. Multiple biquad IIR filters are cascaded to filter the input audio signal. Different scenarios require different filtering capabilities; for example, in noise reduction scenarios, multiple cascaded biquad IIR filters can be used to remove noise from the input audio signal. See also... Figure 2 The diagram shown illustrates a possible implementation of a dual second-order IIR filter. The difference equation of the dual second-order IIR filter can be expressed by the following formula (2).
[0053] y = b0x + b1x n-1 +b2x n-2 -a1y n-1 -a2y n-2 Formula (2)
[0054] Where a1, a2, b0, b1, and b2 all represent filter coefficients. Figure 2 In the diagram, x represents the input signal, y represents the output signal, and z represents the output signal. -1 This indicates a unit delay, which is a signal delay of one clock cycle.
[0055] The Z-domain transfer function of the IIR filter system determined by the above formula (1) can be expressed by the following formula (3).
[0056]
[0057] As can be seen from formula (3), B(z) only involves zero-point characteristics and does not have a stability problem. However, A(z) has a stability problem. According to polynomial theory, A(z) can be decomposed into the following formula (4).
[0058]
[0059] From formula (4) and formula (3), it can be seen that the IIR filter system has a pole at p. i According to the properties of the z-transform, if an IIR filter system has poles outside the unit circle, its transfer function will have infinite gain at some frequency. Filters derived from such an IIR filter system will be unstable. In other words, if an audio signal passes through such an unstable IIR filter, a howling phenomenon will occur at the output. Therefore, for an IIR filter to be stable, all p... i All are inside the unit circle in the z-domain. For example, see [link to example]. Figure 3 The IIR filter system shown is an unstable system because one of its poles lies outside the unit circle. Figure 3 (where "x" represents the pole).
[0060] In some scenarios, it is necessary to switch the filter coefficients to adapt to environmental changes or meet user needs. It should be noted that when configuring the IIR filter coefficients, the stability of the IIR filtering system is considered. Therefore, generally, the IIR filtering system corresponding to the source filter coefficients used before the switch is stable, and the IIR filtering system corresponding to the target filter coefficients used after the switch is also stable. However, how to ensure the stability of the IIR filtering system during the filter coefficient switching process is worth studying.
[0061] The first possible switching method is to directly update the coefficients of the IIR filter from the source filter coefficients to the target filter coefficients. However, this switching method will cause discontinuous transitions in the output signal at the output end of the IIR filter, thus affecting the user experience.
[0062] The second possible switching method is to use a smooth, step-by-step switching approach, gradually switching the IIR filter coefficients from the source filter coefficients to the target filter coefficients. As described earlier, to ensure the stability of the IIR filter system, it is necessary to ensure that all Z-domain poles of the IIR filter system are located within the unit circle. However, during the gradual adjustment of the IIR filter coefficients, the Z-domain poles of the IIR filter coefficients change along with the changes in the filter coefficients.
[0063] For example, combining the above formulas (3) and (4), the transfer function of the IIR filter system can be expressed by the following formula (5).
[0064]
[0065] in, This represents the adjusted filter coefficients at each step. During the filter coefficient adjustment process, the poles of the IIR filter system are updated as follows: Although the second possible switching method can ensure that the IIR filter system corresponding to the source filter coefficient before switching and the IIR filter system corresponding to the target filter coefficient after switching are both stable, the switching method performs smoothing on the filter coefficients. During the smoothing process, a certain updated filter coefficient may cause a pole to fall outside the unit circle, which may lead to instability of the IIR filter system during the switching of filter coefficients.
[0066] A third possible switching method: To prevent instability in the IIR filter system during the filter coefficient switching process, the poles of the IIR filter system corresponding to the source filter coefficients and the target filter coefficients can be calculated. Then, a smoothing method is used to switch the filter coefficients from the source filter coefficients to the target filter coefficients. Since the poles of both the source and target filter coefficients are located inside the unit circle, the poles of the IIR filter system corresponding to each updated filter coefficient will also be located inside the unit circle during the smoothing process, ensuring the stability of the IIR filter system during the smooth switching process. For example, see... Figure 4 As shown, while the third possible switching method fundamentally solves the instability problem of the IIR filter coefficients during the adjustment process that occurred with the second possible switching method, it requires the use of z-transform and inverse z-transform to calculate the poles, thus increasing computational overhead. Furthermore, since the z-transform is essentially a frequency domain analysis, it introduces a time delay. For noise reduction scenarios, a larger delay results in a worse noise reduction effect, failing to meet noise reduction requirements.
[0067] This application provides an IIR filtering component. When switching the filter coefficients used for filtering the input signal, the IIR filtering component provided in this application ensures the stability of the IIR filtering system. The IIR filtering component can be applied to scenarios requiring filtering and switching of the filtering system, such as active noise cancellation, vehicle-to-everything (V2X) noise reduction, or vehicle-to-engine noise reduction. The IIR filtering component can be deployed in in-vehicle infotainment systems (IVRs) or headphones. An IVR refers to an in-vehicle infotainment system installed in a car, used to enable information communication between people and the vehicle or between the vehicle and the outside world (e.g., between vehicles). For example, see... Figure 5 The diagram shown illustrates an application scenario for an IIR filter component. As an example, the headphones can be in-ear headphones, neckband headphones, ear-hook headphones, or over-ear headphones, etc. The headphones can be wireless or wired, etc. This application does not specifically limit the particular form of the headphones.
[0068] In some embodiments, when the filtering coefficients used for filtering the input signal need to be switched, it can be a mode switch of the audio device. For example, in an active noise cancellation (ANC) scenario, the mode switch is triggered when the environment in which the audio device is located changes from one scene to another. For example, moving from a meeting room to a quiet office, or vice versa. Another example is moving from a quiet neighborhood to a noisy street. Furthermore, the mode switch of the audio device can be a function switch, such as headphones having active noise cancellation (ANC), ambient sound pass-through (HT), and augmentation hearing (AH) functions. The mode switch of the audio device can be a switch between these three functions, such as switching from ANC to HT. ANC reduces unwanted external noise when the user wears the headphones. HT allows external ambient sound to pass through, allowing the user to experience external sounds as if they were not wearing headphones. AH can be considered as ANC and HT functions being activated simultaneously, used to deliver the desired sound signal to the user and filter out unwanted sound signals. The mode switching of an audio device can also be from a function without any processing effects to ANC (or HT or AH). Of course, the audio device can have other functions; different functions achieve different filtering effects, or different functions require different filtering coefficients for filtering the input signal. This application does not specifically limit the functions of the audio device or the switching between different functions. For ease of description, the mode before the switch will be referred to as the first mode, and the mode after the switch will be referred to as the second mode. The filtering coefficient required before the switch will be referred to as the first filtering coefficient, and the filtering coefficient required after the switch will be referred to as the second filtering coefficient. The first filtering coefficient is the current filtering coefficient (or source filtering coefficient) corresponding to the first mode, and the second filtering coefficient is the target filtering coefficient corresponding to the second mode. In some embodiments, the first filtering coefficient is also referred to as the source filtering coefficient, and the second filtering coefficient is also referred to as the target filtering coefficient.
[0069] See Figure 6 The diagram shown is a schematic diagram of an IIR filter component structure provided in an embodiment of this application. Figure 6In this configuration, the IIR filtering component includes a first IIR filter 410, a second IIR filter 420, and a signal processing circuit 430. The first IIR filter 410 filters the input signal using a first filtering coefficient, while the second IIR filter 420 filters the input signal using a second filtering coefficient. The signal processing circuit 430 performs a weighted superposition of the signals output from the first IIR filter 410 and the second IIR filter 420. The weights corresponding to the signals output from the first IIR filter 410 and the second IIR filter 420 can be adjusted. For example, the weights can be adjusted by a control circuit. The control circuit will be described in detail later and will not be repeated here.
[0070] In some embodiments, when the first IIR filter 410 and the second IIR filter 420 are not switched, only one IIR filter may be used to filter the input signal; this set of filters can be referred to as the working filter. In this embodiment, when the first IIR filter 410 is not switched, it uses the first filtering coefficient to filter the input signal. That is, the first IIR filter 410 is used as the working filter. Here, the output signal of the first IIR filter 410 is referred to as the first output signal. It should be noted that in some scenarios, the working filter may not be fixed; for example, the working filter before switching may be one set of working filters, and the working filter after switching may be another set of working filters. In some embodiments, when the audio device switches from the first mode to the second mode, the second IIR filter 420 starts using the second filtering coefficient to filter the input signal. To facilitate differentiation from the output signal of the first IIR filter 410, the output signal of the second IIR filter 420 is referred to as the second output signal. The signal processing circuit 430 is used to perform weighted superposition processing on the first output signal of the first IIR filter 410 and the second output signal of the second IIR filter 420 to obtain a filtered output signal. For example, the IIR filters are digital filters, therefore both the first and second output signals are digital signals. The weighted superposition of the first and second output signals can be expressed as first output signal * alpha + second output signal * beta, where alpha represents the weight of the first output signal and beta represents the weight of the second output signal. The signal processing circuit 430 can also be called a weighting circuit, or use other names; this application does not specifically limit this. During the switch from the first mode to the second mode, the first weight signal corresponding to the first output signal decreases, and the second weight signal corresponding to the second output signal increases. During the switch from the first mode to the second mode, the weight of the first output signal using the first filter coefficient decreases, while the weight of the second output signal using the second filter coefficient increases. This results in a gradual decrease in the component of the first output signal and a gradual increase in the component of the second output signal in the filtered output signal. Consequently, the filtered output signal gradually transforms from the first output signal to the second output signal during the switch, effectively completing the switching of the filter coefficients. This embodiment does not directly switch the filter coefficients, but rather adjusts the output weights corresponding to the output signals of the two sets of IIR filters. The coefficients of the two sets of IIR filters do not change during the switching process, thus the Z-domain poles of the two sets of IIR filters do not change, thereby ensuring the stability of the IIR filtering system during coefficient switching.Furthermore, compared to the third possible switching method, the scheme adopted in this application embodiment can avoid the increase in computational overhead and filtering delay caused by Z-transformation.
[0071] In some embodiments, the weight of the first output signal of the first IIR filter 410 decreases monotonically, while the weight of the second output signal of the second IIR filter 420 increases monotonically. This prevents excessively large adjustments to the weight values between adjacent tests from causing small jumps in the output signal that could negatively impact the user experience.
[0072] Taking the first IIR filter 410 using source filter coefficients as an example, that is, when the audio device is in the first mode, or before the filter coefficients are switched, the first IIR filter 410 uses the source filter coefficients (i.e., the first filter coefficients) to filter the input signal. The second IIR filter 420 can be in a blocking state. For example, if all the filter coefficients of the second IIR filter 420 are 0, then the second IIR filter 420 is in a blocking state. As another example, if the weight of the second IIR filter 420 is 0, then the second IIR filter 420 is in a blocking state.
[0073] The first IIR filter 410 filters the input signal using source filter coefficients to obtain a first output signal. During the switching process of the audio device from the first mode to the second mode, the second IIR filter 420 filters the input signal using target filter coefficients to obtain a second output signal. The signal processing circuit 430 performs weighted superposition of the first and second output signals to obtain a filtered output signal. In some embodiments, within a set time period during the switching from the first mode to the second mode, the weight of the first output signal can be reduced from a first value to a third value, and the weight of the second output signal can be increased from a second value to a fourth value. The first value is greater than 0 and less than or equal to 1, the third value is less than or equal to 0 and less than the first value, the second value is greater than 0 and less than or equal to 1, and the fourth value is less than or equal to 1 and greater than the second value. In some embodiments, the third value is 0 and the fourth value is 1. In still other embodiments, the second value is 1 and the second value is 0. By using the above method, the proportion of the output signal component of the source filter coefficient in the filtered output signal is reduced to 0, while the proportion of the output signal component of the target filter coefficient is gradually increased to 1. After the switching is completed, the filtered output signal is the output signal corresponding to the second mode. This method is simple to implement and can ensure the stability of the system.
[0074] In some embodiments, the weights of the first output signal and the second output signal can be adjusted in steps. Taking a third value of 0 and a fourth value of 1 as an example, for instance, within a set time period, the weight of the first output signal is adjusted multiple times, decreasing from the first value to 0. The weight of the second output signal is adjusted multiple times, increasing from the second value to 1. The number of steps the weight of the first output signal takes from the first value to 0 can be the same as the number of steps the weight of the second output signal takes from the second value to 1. In some embodiments, the weight of the second output signal = 1 - the weight of the first output signal, and the second value = 1 - the first value. In some embodiments, the step size of the weight of the first output signal can satisfy a curvilinear function relationship. The curvilinear function can be a linear function or a nonlinear function; this application does not specifically limit this.
[0075] Taking the weight of the first output signal as alpha and the weight of the second output signal as beta as an example, the value of alpha decreases monotonically within a set time period, and the value of beta decreases monotonically within the set time period. The set time period can also be called the smoothing time. In some embodiments, the step size of alpha and the step size of beta can be the same or different. This application does not specifically limit this. The signals output by the first IIR filter 410 and the second IIR filter 420 are both digital signals. The number of sampling points (or the interval time) required for each smoothing step of the first output signal or the second output signal can be determined according to the sampling frequency of the output digital signal, the smoothing time (set time period), and the number of smoothing steps (or the number of steps).
[0076] In one possible implementation, the signal processing circuit 430 can be adopted as follows: Figure 7 The structure is shown. The signal processing circuit 430 may include a first multiplier 431, a second multiplier 432, and an adder 433. The input digital signal of the first multiplier 431 includes the weights of the first and second output signals, and the input digital signal of the second multiplier 432 includes the weights of the second and second output signals. The input digital signal of the adder 433 includes the output digital signals of the first multiplier 431 and the output digital signals of the second multiplier 432. The output digital signal of the adder 433 is a filtered output signal.
[0077] In one possible implementation, the IIR filter assembly may further include a control circuit 440, see [link to relevant documentation]. Figure 8As shown. During the switching process of the audio device from the first mode to the second mode, the control circuit 440 decreases the first weight signal corresponding to the first output signal and increases the second weight signal corresponding to the second output signal. For example, within a set time period, the control circuit 440 adjusts the value of the first weight signal from a first value to 0 and the value of the second weight signal from a second value to 1, where the first value is greater than 0 and less than or equal to 1, and the second value is greater than or equal to 0 and less than 1. The value of the first weight signal is the weight of the first output signal, and the value of the second weight signal is the weight of the second output signal. Taking an example where the number of steps for the first weight signal to step from the first value to 0 and the number of steps for the second weight signal to step from the second value to 1 are both N, then within the set time period, the value of the first weight signal input to the first multiplier 431 by the control circuit 440 is reduced from the first value to 0 after N steps, and the value of the second weight signal input to the second multiplier 432 is reduced from the second value to 1 after N steps. The signal processing circuit 430 uses... Figure 7 Taking the structure shown as an example, the structure of the IIR filter component can be found in [reference needed]. Figure 9 As shown.
[0078] In some embodiments, when the audio device switches from the first mode to the second mode, the control circuit 440 can configure the target filtering coefficient (i.e., the second filtering coefficient) to the second IIR filter 420. For example, the control circuit 440 can configure the target filtering coefficient to the second IIR filter 420 using a register. The control circuit 440 can determine the number of sampling points (or interval time) between each smoothing step based on the sampling frequency, smoothing time, and smoothing count of the input digital signal. The smoothing time and smoothing count can be pre-configured within the control circuit 430. In some embodiments, when the audio device switches from the first mode to the second mode, the control circuit 440 receives a control signal and configures the second filtering coefficient to the second IIR filter 420 according to the control signal. Exemplarily, within a set duration after receiving the control signal, the control circuit 440 performs smoothing steps on alpha and beta; specifically, the control circuit 440 controls the alpha value input to the first multiplier 431 and the beta value input to the second multiplier 432.
[0079] As an example, let's assume the step size follows a linear function. The alpha value at the (j+1)th step in N steps is... j+1 and beta j+1 The conditions shown in formulas (6) and (7) are satisfied.
[0080] alpha j+1 =alpha j- First value / N formula (6)
[0081] beta j+1 = beta j + (1 - Second value) / N formula (7)
[0082] In some embodiments, beta = 1 - alpha, then beta j+1 = 1 - alpha j+1 . As an example, when implementing a smooth step of the alpha or beta value, it can be achieved by circular shifting of floating-point numbers. For the sake of distinction, the value input to the first multiplier 431 is represented by alphak, and the value input to the second multiplier 432 is represented by betak. The number of bits of circular shifting can be represented by lambda. Taking beta = 1 - alpha as an example, then alpha = alphak / (1 >> lambda), beta = [(1 << lambda) - alphak] / (1 << lambda), and the implementation logic of this application can be seen Figure 10 As shown, 1 / (1 << lambda) can be achieved by >> lambda. Here, >> represents the right shift symbol, and << represents the left shift symbol. In some embodiments, N = 2 lambda , see Figure 11 As shown, during the smoothing process, the value of alphak decreases by 1 each time, while the value of betak increases by 1 each time. Taking the smoothing number N = 64 as an example, then lambda = 6. Before the start of smoothing, the value of alphak is 64. During the smoothing process, the value of alphak decreases by 1 each time. After 64 decreases, the value of alphak is 0. And betak starts from 0 and increases by 1 each time. After 64 increases, the value of betak is 64.
[0083] As another example, taking the size of each step satisfying a non-linear function as an example. The non-linear function is represented by f() as an example. The alpha value alpha j+1 and beta j+1 in the (j + 1)-th step among N steps satisfy the conditions shown in the following formula (8) and formula (9).
[0084] alpha j+1 = alpha j - f(ramp) formula (8)
[0085] beta j+1 = 1 - alpha j+1 formula (9)
[0086] ramp represents the step time interval and can also represent the number of sampling points passed through each step. SeeFigure 12 As shown, ramp represents the step time interval as an example.
[0087] In some embodiments, after adjusting the first weight signal and the second weight signal, the control circuit 440 updates the coefficients of the first IIR filter 410 to the target filtering coefficients. In some embodiments, after adjusting the first weight signal and the second weight signal, it can be understood that the weight of the first output signal is stepped from a first value to 0, and the weight of the second output signal is stepped from a second value to 1, so that the final filtered output signal is switched from the first output signal to the second output signal, that is, the output signal of the IIR filter component is switched to the output signal corresponding to the target filtering coefficients. The adjustment of the first weight signal and the second weight signal can also be understood as the above-mentioned set time period has elapsed. The control circuit 440 updates the coefficients of the first IIR filter 410 to the target filtering coefficients, and can further restore the state of each device in the IIR filter component to the initial state. The initial state can be understood as the first IIR filter 410 acting as a working filter, while the state of the second IIR filter 420 is updated to a blocking state. The control circuit 440 updates the state of the second IIR filter 420 to the blocking state, which can be done by configuring all the coefficients of the second IIR filter 420 to 0, setting the weight of the signal output by the second IIR filter 420 to 0, or powering off the second IIR filter 420.
[0088] As mentioned above, the control circuit 440 receives a control signal when the audio device switches from the first mode to the second mode. This control signal can be understood as a start signal for switching from the source filter coefficient used in the input signal filtering process to the target filter coefficient. Therefore, upon receiving this control signal, the control circuit 440 initiates the switching process. The control signal can be, for example, a pulse signal, or other signals; this application embodiment does not specifically limit this. Taking a noise reduction system as an example, the user can trigger noise reduction to start via a control, thereby allowing the processor in the noise reduction system to trigger a control signal to the control circuit 440. Alternatively, the processor can detect a scene switch and trigger a control signal to the control circuit 440. As an example, the signal transmission situation involved in this application embodiment can be found in [reference needed]. Figure 13 As shown. Figure 13 In this diagram, `daep_din` represents the analog signal corresponding to the input signal, and `daep_out` represents the analog signal corresponding to the filtered output signal. The pulse signal corresponding to `daep_coef_flush_pulse` represents the control signal. `daep_sbq_ramp_state` represents the smoothing state signal, indicating the operating state of the control circuit 440. Figure 13Taking the filter coefficients of the second IIR filter 420, which include a1, a2, b0, b1, and b2, as an example, daep_sbq_coefa1 represents a1, daep_sbq_coefa2 represents a2, daep_sbq_coefb0 represents b0, daep_sbq_coefb1 represents b1, and daep_sbq_coefb2 represents b2. Figure 13 During the first corresponding time period, after receiving the control signal, the control circuit 440 adjusts the alpha value input to the first multiplier 431 and the beta value input to the second multiplier 432 during the period when the smoothing state signal is high. Furthermore, after receiving the control signal, it configures the filter coefficients of the second IIR filter 420 to the target filter coefficients. (See [link to relevant documentation]). Figure 13 As shown. It should be understood that, Figure 13 This is merely an example and does not impose specific limitations on the values of the filter coefficients. From Figure 13 It can be seen that the analog signal corresponding to the filtered output signal of the IIR filter component changes gradually, rather than in one step. During the period when the smoothing state signal is at a low level, smoothing ends, the control circuit 440 updates the target filter coefficients to the first IIR filter, and switches the state of the second IIR filter 420 to the blocking state. Figure 13 Taking updating the weight value input to the second multiplier 432 to 0 as an example.
[0089] In some embodiments of this application, taking audio noise reduction as an example, if it is necessary to disable the noise reduction function, the filtering function of the IIR filter component needs to be disabled. A smooth approach can be used to prevent discontinuous jumps at the output caused by abruptly stopping the noise reduction function, thereby improving the user experience. See also Figure 13 During the second corresponding time period, the noise reduction function needs to be turned off. Figure 13 In this example, taking the first IIR filter as the working filter, when the noise reduction function needs to be turned off, the working filter needs to be turned off. The control circuit 440 receives a pulse signal and, during the period when the smoothing state signal is high, adjusts the alpha value input to the first multiplier 431, changing the alpha value from 1 to 0 in N steps. Figure 13 It can be seen that the signal output by the IIR filter component gradually becomes no longer output.
[0090] This application also provides a method for switching the coefficients of an IIR filter. For example... Figure 14The diagram shown is a schematic flowchart of an exemplary IIR filtering coefficient switching method provided in an embodiment of this application. The imaging method is applied to an IIR filtering component. The IIR filtering component is deployed in an audio device. The IIR filtering component includes a first IIR filter, a second IIR filter, a control circuit, and a signal processing circuit.
[0091] 101. The input signal is processed by the first IIR filter to obtain the first output signal. The first IIR filter uses the first filter coefficient.
[0092] 102. When the audio device switches from the first mode to the second mode, configure the second filter coefficient for the second IIR filter.
[0093] 103. The input signal is processed by the second IIR filter to obtain the second output signal.
[0094] 104. During the process of switching the audio device from the first mode to the second mode, the first weight signal corresponding to the first output signal is reduced, and the second weight signal corresponding to the second output signal is increased.
[0095] Wherein, the first filter coefficient is the current filter coefficient corresponding to the first mode, and the second filter coefficient is the target filter coefficient corresponding to the second mode;
[0096] 105. The first output signal and the second output signal are weighted and superimposed according to the first weight signal and the second weight signal to obtain the filtered output signal.
[0097] In one possible implementation, reducing the first weight signal corresponding to the first output signal and increasing the second weight signal corresponding to the second output signal includes:
[0098] Within a set time period, the value of the first weight signal is adjusted from the first value to the third value, and the value of the second weight signal is adjusted from the second value to the fourth value. The first value is greater than 0 and less than or equal to 1, the third value is less than or equal to 0 and less than the first value, the second value is greater than or equal to 0 and less than 1, and the fourth value is less than or equal to 1 and greater than the second value.
[0099] In one possible implementation, adjusting the value of the first weight signal from a first value to a third value and adjusting the value of the second weight signal from a second value to a fourth value within a set time period includes:
[0100] Within a set time period, the value of the first weight signal is stepped from the first value to the third value, and the value of the second weight signal is stepped from the second value to the fourth value.
[0101] In one possible implementation, the number of steps the first weight signal takes from a first value to a third value is the same as the number of steps the second weight signal takes from a second value to a fourth value.
[0102] In one possible implementation, the method further includes: after adjusting the first weight signal and the second weight signal, updating the filter coefficients of the first IIR filter to the second filter coefficients.
[0103] In one possible implementation, the method further includes updating the state of the second IIR filter to a blocking state after the first weight signal and the second weight signal have been adjusted.
[0104] In one possible implementation, updating the state of the second IIR filter to a blocking state includes: updating the filter coefficients of the second IIR filter to 0; or updating the weights of the second output signal to 0.
[0105] In one possible implementation, the method further includes: receiving a control signal when the audio device switches from a first mode to a second mode; and configuring a second filter coefficient to a second IIR filter according to the control signal before processing the input signal through a second IIR filter to obtain a second output signal.
[0106] This application also provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform some or all of the steps executed by the control circuit in any embodiment of this application.
[0107] This application also provides a computer program product containing instructions that, when run on a computer or processor, cause the computer or processor to perform some or all of the steps executed by the control circuit in any embodiment of this application.
[0108] In the various embodiments of this application, unless otherwise specified or in case of logical conflict, the terminology and / or descriptions of different embodiments are consistent and can be referenced by each other. The technical features of different embodiments can be combined to form new embodiments according to their inherent logical relationship.
[0109] In this application, the term "exemplary" is used to mean as an example, illustration, or description. Any embodiment or design described as "exemplary" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Alternatively, it can be understood that the use of the term "exemplary" is intended to present concepts in a specific manner and does not constitute a limitation on this application.
[0110] It is understood that the various numerical designations used in this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. The order of the process numbers described above does not imply the order of execution; the execution order of each process should be determined by its function and inherent logic. The terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, such as including a series of steps or units. A method, system, product, or apparatus is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or apparatuses.
[0111] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made therein without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely illustrative examples of the solutions defined by the appended claims and are to be considered as covering any and all modifications, variations, combinations, or equivalents within the scope of this application.
[0112] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the scope of this application. Therefore, if these modifications and variations of the embodiments of this application fall within the scope of the claims of this application and their equivalents, this application also intends to include these modifications and variations.
Claims
1. An infinite impulse response (IIR) filter component, characterized in that, The IIR filtering component is applied to an audio device, and the IIR filtering component includes a first IIR filter, a second IIR filter, a control circuit, and a signal processing circuit. The first IIR filter is used to process the input signal using the first filter coefficients to obtain the first output signal; The second IIR filter is used to process the input signal with a second filtering coefficient to obtain a second output signal when the audio device switches from the first mode to the second mode; The control circuit is used to adjust the first weight signal corresponding to the first output signal and the second weight signal corresponding to the second output signal when the audio device switches from the first mode to the second mode. The signal processing circuit is used to weight and superimpose the first output signal and the second output signal according to the first weight signal and the second weight signal to obtain a filtered output signal.
2. The IIR filter component as described in claim 1, characterized in that, The control circuit is specifically used to adjust the value of the first weight signal from a first value to a third value and the value of the second weight signal from a second value to a fourth value within a set time period. The first value is greater than 0 and less than or equal to 1, the third value is less than or equal to 0 and less than the first value, the second value is greater than or equal to 0 and less than 1, and the fourth value is less than or equal to 1 and greater than the second value.
3. The IIR filter component as described in claim 2, characterized in that, The control circuit is specifically used to, within the set time period, step the value of the first weight signal from the first value to the third value, and step the value of the second weight signal from the second value to the fourth value.
4. The IIR filter component as described in claim 3, characterized in that, The number of steps the first weight signal takes from the first value to the third value is the same as the number of steps the second weight signal takes from the second value to the fourth value.
5. The IIR filter component as described in any one of claims 1-4, characterized in that, The signal processing circuit includes a first multiplier, a second multiplier, and an adder; The input signal of the first multiplier includes the first output signal and the first weight signal; the input signal of the second multiplier includes the second output signal and the second weight signal; the input signal of the adder includes the output signal of the first multiplier and the output signal of the second multiplier; and the output signal of the adder is the filtered output signal.
6. The IIR filter component according to any one of claims 1-4, characterized in that, The control circuit is further configured to update the filter coefficients of the first IIR filter to the second filter coefficients after adjusting the first weight signal and the second weight signal.
7. The IIR filter component according to any one of claims 1-4, characterized in that, The control circuit is further configured to update the state of the second IIR filter to the blocking state after adjusting the first weight signal and the second weight signal.
8. The IIR filter component as described in claim 7, characterized in that, The control circuit, when updating the state of the second IIR filter to the blocking state, is specifically used to update the filter coefficients of the second IIR filter to 0; or to update the weight of the second output signal to 0.
9. The IIR filter component according to any one of claims 1-4 and 8, characterized in that, The control circuit is also used for: When the audio device switches from the first mode to the second mode, it receives a control signal and configures the second filter coefficient to the second IIR filter according to the control signal.
10. An audio device, characterized in that, Includes the IIR filter component as described in any one of claims 1-9.
11. The audio device as claimed in claim 10, characterized in that, The audio device is a headset or a car infotainment system.
12. A coefficient switching method for IIR filtering, characterized in that, The method is applied to an IIR filtering component, which includes a first IIR filter, a second IIR filter, a control circuit, and a signal processing circuit. The first output signal is obtained by processing the input signal through the first IIR filter, wherein the first IIR filter uses the first filtering coefficient; When the audio device switches from the first mode to the second mode, a second filtering coefficient is configured for the second IIR filter, and the input signal is processed by the second IIR filter to obtain a second output signal. The audio device is equipped with the IIR filtering component. During the process of the audio device switching from the first mode to the second mode, the first weight signal corresponding to the first output signal is reduced, and the second weight signal corresponding to the second output signal is increased. Wherein, the first filter coefficient is the current filter coefficient corresponding to the first mode, and the second filter coefficient is the target filter coefficient corresponding to the second mode; The first output signal and the second output signal are weighted and superimposed according to the first weight signal and the second weight signal to obtain the filtered output signal.
13. The method as described in claim 12, characterized in that, The steps of reducing the first weight signal corresponding to the first output signal and increasing the second weight signal corresponding to the second output signal include: Within a set time period, the value of the first weight signal is adjusted from a first value to a third value, and the value of the second weight signal is adjusted from a second value to a fourth value. The first value is greater than 0 and less than or equal to 1, the third value is less than or equal to 0 and less than the first value, the second value is greater than or equal to 0 and less than 1, and the fourth value is less than or equal to 1 and greater than the second value.
14. The method as described in claim 13, characterized in that, Adjusting the value of the first weight signal from a first value to a third value, and adjusting the value of the second weight signal from a second value to a fourth value within a set time period, includes: Within the set time period, the value of the first weight signal is stepped from a first value to a third value, and the value of the second weight signal is stepped from a second value to a fourth value.
15. The method as described in claim 14, characterized in that, The number of steps the first weight signal takes from the first value to the third value is the same as the number of steps the second weight signal takes from the second value to the fourth value.
16. The method according to any one of claims 12-15, characterized in that, The method further includes: After adjusting the first weight signal and the second weight signal, the filter coefficients of the first IIR filter are updated to the second filter coefficients.
17. The method according to any one of claims 12-15, characterized in that, The method further includes: After adjusting the first weight signal and the second weight signal, the state of the second IIR filter is updated to the blocking state.
18. The method as described in claim 17, characterized in that, Updating the state of the second IIR filter to the blocking state includes: Update the filter coefficients of the second IIR filter to 0; or update the weights of the second output signal to 0.
19. The method according to any one of claims 12-15, 18, characterized in that, The method further includes: When the audio device switches from the first mode to the second mode, a control signal is received; Before the input signal is processed by the second IIR filter to obtain the second output signal, the second filter coefficients are configured to the second IIR filter according to the control signal.