Dual-talking detection and acoustic echo cancellation co-processing method based on dual-cuda streams

By creating dual CUDA streams on the graphics processing unit and utilizing a shared video memory control package for cross-stream control, the challenges of acoustic echo cancellation and dual-talk detection in terms of real-time performance and accuracy are addressed. This method achieves efficient echo suppression and dual-talk detection, suitable for voice communication and intelligent interactive devices.

CN122157679APending Publication Date: 2026-06-05CHINA NUCLEAR IND MAINTENANCE

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA NUCLEAR IND MAINTENANCE
Filing Date
2026-03-04
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing acoustic echo cancellation and dual-talk detection technologies face challenges in maintaining real-time performance and accuracy, especially in dual-talk scenarios. Traditional methods suffer from filter mistuning, echo remnants, and competition for computing resources, leading to increased system latency. Furthermore, existing dual-talk detection methods are poorly adaptable to complex acoustic environments.

Method used

A collaborative processing method based on dual CUDA streams is adopted, which creates a first CUDA stream and a second CUDA stream on the same graphics processing unit and achieves cross-stream control through a shared memory control package. Parallel processing is performed using subband analysis and parameter generation, and echo suppression is achieved by combining α-stable-GLRT judgment and partitioned blocking frequency domain adaptive filtering.

Benefits of technology

It significantly reduces frame-level processing latency, improves computing resource utilization, accurately distinguishes between remote-dominant and dual-talk states, reduces false detections and false suppressions, and enhances real-time performance and stability. It is suitable for high-performance voice communication systems and intelligent interactive devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122157679A_ABST
    Figure CN122157679A_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of speech processing, and particularly relates to a double-talking detection and acoustic echo cancellation cooperative processing method based on double CUDA streams. The method comprises the following steps: creating a first CUDA stream and a second CUDA stream on the same graphics processing unit; establishing a shared memory control package for cross-stream control between the first CUDA stream and the second CUDA stream; organizing a microphone near-end signal and a far-end reference signal into continuous frames with a preset frame length and frame shift; in the second CUDA stream, recording a synchronization event after writing sub-band control parameters and frame-level mode markers into the shared memory control package; in the first CUDA stream, performing partition blocking frequency domain sub-band adaptive filtering to update filter coefficients and generate echo suppression output. The present application realizes a highly cooperative, low-delay, high-robust real-time processing system for double-talking detection and echo cancellation, and has operation efficiency, control accuracy and engineering realizability, and is suitable for voice communication, remote conference and intelligent voice interaction systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of speech processing technology, specifically relating to a collaborative processing method for dual-talk detection and acoustic echo cancellation based on dual CUDA streams. Background Technology

[0002] Current acoustic echo cancellation and two-way talk detection technologies are mainly applied in scenarios such as voice calls, smart conferencing terminals, in-vehicle hands-free systems, and voice assistants. Since the signals acquired by microphone arrays typically contain the echo of a distant reference signal, the speech of the near-end speaker, and environmental noise simultaneously, how to separate and suppress echoes and accurately identify two-way talk while maintaining real-time performance has always been a core problem in the field of signal processing. Traditional methods commonly employ adaptive filtering algorithms, such as frequency-domain adaptive filtering, sub-band adaptive filtering, and extended Kalman filtering algorithms. These algorithms achieve echo cancellation by modeling acoustic paths and progressively approximating the real echo channels, performing well in single-way talk scenarios. However, when near-end speech and far-end speech occur simultaneously, i.e., in the so-called two-way talk scenario, the convergence performance of the algorithms significantly decreases, often resulting in filter mistuning or excessive echo residue.

[0003] Most existing two-way talk detection technologies rely on amplitude ratio, coherence coefficient, or cross-correlation characteristics to determine the dominance of near-end and far-end speech. For example, the common cross-correlation coefficient method distinguishes the speaker by calculating the peak position of the cross-correlation between the microphone signal and the far-end reference signal; some methods also use the characteristics of coherence attenuation to determine the two-way talk interval. Although these methods are simple to implement, they are poorly adaptable to time-varying acoustic paths, dynamic noise, and non-stationary speech signals. When the room reverberation time is long or the equipment hardware latency is unstable, a single coherence index may misjudge, leading to sub-band gating failure and affecting the stability of the echo canceller. In addition, existing two-way talk detection is mostly executed serially on the central processing unit, competing for computing resources with the echo cancellation algorithm in the same thread, making it difficult to guarantee real-time performance. Under high-resolution frame processing (such as 16-millisecond frame shift), the CPU often experiences a computational bottleneck, and the system latency increases significantly. In terms of acoustic echo cancellation, the traditional partitioned blocking frequency domain adaptive filtering algorithm can effectively reduce the computational complexity of convolution, but it still relies on a fixed step size and a fixed leakage factor. Fixed step sizes can cause filter mistuning in dual-talk scenarios and insufficient convergence speed in far-end dominant scenarios. Some studies have proposed dynamic step size adjustment strategies, adaptively modifying the step size through energy ratio or error energy change rate. However, these methods typically rely on historical statistics and recursive averaging, resulting in slow response to short-term abrupt changes. Under low signal-to-noise ratio or far-end speech attenuation conditions, the filter may still over-suppress, affecting speech intelligibility. Furthermore, when the system adopts a partitioned blocking structure, inconsistent update paces between different partitions can cause frequency mismatch, leading to phase drift between echo estimation and residual signals, thereby reducing the overall suppression effect. Summary of the Invention

[0004] The main objective of this invention is to provide a collaborative processing method for dual-talk detection and acoustic echo cancellation based on dual CUDA streams. This method includes the following steps: creating a first CUDA stream and a second CUDA stream on the same graphics processing unit; establishing a shared memory control package for cross-stream control between the first and second CUDA streams; organizing the microphone near-end signal and far-end reference signal into consecutive frames with a preset frame length and frame shift; within the second CUDA stream, performing subband analysis on the microphone near-end signal and far-end reference signal of each frame to generate a set of subband control parameters including subband gating parameters, subband step size parameters, and subband leakage parameters, and a frame-level mode flag; writing the subband control parameters and frame-level mode flag into the shared memory control package and recording a synchronization event; within the first CUDA stream, after waiting for the synchronization event to complete, reading the subband control parameters and frame-level mode flag from the shared memory control package, and within the same frame, performing partitioned blocking frequency domain subband adaptive filtering based on the read subband control parameters and frame-level mode flag to update the filter coefficients and generate echo-suppressed output.

[0005] Furthermore, the subband analysis includes performing a 512-point Fast Fourier Transform on each frame to obtain the frequency domain spectrum, and dividing the frequency band from 0 to 8000 Hz into 32 subbands.

[0006] Furthermore, the steps for generating sub-band control parameters include calculating for each sub-band: calculating the 90th percentile for the microphone amplitude sequence and the reference amplitude sequence within the sub-band, and statistically analyzing the proportion of samples with amplitudes greater than their respective 90th percentiles to obtain the microphone tail proportion and the reference tail proportion; calculating the point-by-point difference between the microphone phase and the reference phase within the sub-band, and statistically analyzing the proportion of samples with an absolute difference less than or equal to 20 degrees to obtain the phase consistency rate; statistically analyzing the proportion of samples within the sub-band whose ratio of microphone amplitude to reference amplitude is in the range of 0.5 to 2 to obtain the amplitude similarity rate; and statistically analyzing the proportion of samples with a ratio greater than or equal to 1.5 to obtain the amplitude dominance rate.

[0007] Furthermore, the steps for generating subband control parameters include: using the sum of counts satisfying the three conditions of an absolute value of the tail ratio difference less than or equal to 0.1, an amplitude similarity rate greater than or equal to 0.6, and a phase consistency rate greater than or equal to 0.7 as the far-end dominance evidence score; using the sum of counts satisfying the two conditions of an amplitude dominance rate greater than or equal to 0.3 and a phase consistency rate less than 0.7 as the dual-talk evidence score; and comparing the far-end dominance evidence score with the dual-talk evidence score to form an α-stable-GLRT determination for the subband. If the far-end dominance evidence score is greater than the dual-talk evidence score, it is determined to be far-end dominance; otherwise, it is determined to be dual-talk.

[0008] Furthermore, the step of generating subband control parameters also includes: calculating the normalized cross-correlation peak value and corresponding hysteresis of the subband; when the peak value is between 0.6 and 1 and the hysteresis is within ±3 frequency points, it is recorded as high coherence; otherwise, it is recorded as low coherence; fusing α-stable-GLRT determination and coherence to generate subband gating parameters, subband step size parameters, and subband leakage parameters, which together constitute the subband control parameters; wherein, when α-stable-GLRT determination is far-end dominant and coherence is high coherence, the subband gating parameter is set to allow updates, and a high-level subband step size parameter and a low-level subband leakage parameter are set.

[0009] Furthermore, the steps of the partitioned blocking frequency domain subband adaptive filtering include: generating a partitioned block sequence by dividing the far-end reference signal frame into blocks of length 512 with 50% overlap, and performing a fast Fourier transform on each partitioned block to obtain the partitioned block frequency domain vector; performing element-wise complex multiplication of all partitioned block frequency domain vectors with their corresponding filter coefficient vectors and summing them element-wise; and performing an inverse fast Fourier transform on the summation result to obtain the echo estimate of the frame.

[0010] Furthermore, the method also includes, within the first CUDA stream: for each subband, calculating the average energy of the residual signal obtained by subtracting the echo estimate from the microphone near-end signal on that subband, and the average energy of the echo estimate on that subband; calculating the energy ratio of the average energy of the residual signal to the average energy of the echo estimate; and determining an error covariance level based on the energy ratio; wherein an energy ratio greater than or equal to 2 is marked as a high level, an energy ratio in the range of 1 to 2 is marked as a medium level, and an energy ratio less than 1 is marked as a low level.

[0011] Furthermore, the steps for updating the filter coefficients include: for each subband, determining a final subband step size parameter and a final subband leakage parameter by combining the subband gating parameters read from the shared memory control package and the locally calculated error covariance level; when the subband gating parameter is update-allowed, calculating a correction vector based on the final subband step size parameter and adding it element-wise to the filter coefficient vector; performing a scaling operation on the filter coefficient vector based on the final subband leakage parameter; when the subband gating parameter is update-disallowed, only a scaling operation is performed.

[0012] Furthermore, the step of generating a frame-level mode tag within the second CUDA stream includes: counting the number of subbands whose subband gating parameters indicate that updates are prohibited; comparing the number with a preset threshold of 16; and setting the frame-level mode tag to a normal mode or a low-confidence mode based on the comparison result; wherein, when the number is greater than or equal to 16, it is set to a low-confidence mode, otherwise it is set to a normal mode.

[0013] Furthermore, within the first CUDA stream, the step of updating the filter coefficients is performed according to the frame-level mode marking: when the frame-level mode is marked as normal mode, the correction vector summation and proportional shrinkage operation are performed on all partitions of the partitioned blocking frequency domain adaptive filter; when the frame-level mode is marked as low confidence mode, the correction vector summation and proportional shrinkage operation are performed only on a predetermined subset of all partitions, namely the partitions with indices 0 to 7, and the proportional shrinkage operation is performed only on the remaining partitions.

[0014] The dual-CUDA stream-based collaborative processing method for dual-talk detection and acoustic echo cancellation of this invention has the following advantages: By creating a first CUDA stream and a second CUDA stream on the same graphics processing unit and utilizing a shared memory control package to achieve cross-stream event-driven synchronization and data interaction, dual-talk detection and adaptive filtering can be performed in parallel rather than sequentially. The direct result is a significant reduction in frame-level processing latency, improved computational resource utilization, and the ability of the system to maintain stable response in scenarios with extremely high real-time requirements, such as voice interaction. The second CUDA stream completes subband analysis and parameter generation within each frame. Based on a composite determination method of amplitude statistics, phase consistency, and normalized cross-correlation, it can more accurately distinguish between far-end dominance and dual-talk states in complex acoustic environments, thereby avoiding the false detection and false suppression problems caused by traditional single-feature determination. Simultaneously, the subband control parameters are described using discrete-level gating, step size, and leakage, which facilitates rapid decision-making by parallel threads and eliminates update fluctuations caused by floating-point instability in traditional continuous adjustment models. After reading the synchronization event, the first CUDA stream performs partitioned blocking frequency domain subband adaptive filtering based on the subband control parameters and frame-level mode flags within the shared memory control packet. This ensures that the update behavior of each subband directly corresponds to the judgment of the previous stream, thereby achieving data closure within the same frame. The introduction of frame-level mode flags allows the system to automatically adjust the partition range according to the subband gating state, updating only the partition block closest to the current frame when the confidence level is low, effectively reducing erroneous updates and computational burden. Overall, this invention achieves cross-stream collaboration between dual-talk detection and echo cancellation through an asynchronous concurrent mechanism, enabling subband gating, step size, and leakage parameters to form an event-triggered transmission chain within the GPU, significantly improving real-time performance, stability, and adaptability. This architecture achieves fine-grained subband-level control and frame-level dynamic balancing without relying on complex prediction models, possessing high computational efficiency, low transmission latency, and excellent parallel scalability, making it suitable for high-performance voice communication systems and intelligent interactive devices. Attached Figure Description

[0015] Figure 1 This is a schematic diagram of the dual CUDA stream collaborative processing architecture provided in an embodiment of the present invention; Figure 2This is a schematic diagram of the sub-band amplitude percentile and far-end dominance determination curve provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the phase consistency rate and dual-talk detection characteristic curves provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the mapping curve between energy ratio and error covariance level provided in an embodiment of the present invention. Detailed Implementation

[0016] The method of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0017] A dual-CUDA stream-based method for co-processing dual-talk detection and acoustic echo cancellation includes the following steps: creating a first CUDA stream and a second CUDA stream on the same graphics processing unit; establishing a shared memory control package for cross-stream control between the first and second CUDA streams; organizing the microphone near-end signal and far-end reference signal into consecutive frames with a preset frame length and frame shift; within the second CUDA stream, performing subband analysis on the microphone near-end signal and far-end reference signal of each frame to generate a set of subband control parameters including subband gating parameters, subband step size parameters, and subband leakage parameters, and a frame-level mode flag, and writing the subband control parameters and frame-level mode flag into the shared memory control package and recording a synchronization event; within the first CUDA stream, after waiting for the synchronization event to complete, reading the subband control parameters and frame-level mode flag from the shared memory control package, and within the same frame, performing partitioned blocking frequency domain subband adaptive filtering based on the read subband control parameters and frame-level mode flag to update the filter coefficients and generate echo-suppressed output.

[0018] refer to Figure 1 ,like Figure 1 As shown, this dual CUDA stream collaborative processing system architecture is implemented on the same graphics processing unit (GPU). The GPU creates two collaborative CUDA streams, a second CUDA stream and a first CUDA stream, which communicate and synchronize with each other via a shared memory control packet.

[0019] The second CUDA stream is set to high priority and located in the upper part of the graphics processing unit. It is primarily responsible for subband analysis and control parameter generation of the input signals. The second CUDA stream receives two signals at its input: one is the microphone near-end signal, organized with a preset frame length of 512 points; the other is the far-end reference signal, synchronized with the microphone near-end signal by a frame shift of 256 points. After framing, these two input signals enter the subband analysis module.

[0020] The subband analysis module performs a 512-point Fast Fourier Transform (FFT) on the microphone near-end signal and far-end reference signal for each frame, converting the time-domain signal to the frequency domain and dividing the 0-8000 Hz frequency band into 32 equal-width subbands, each with a bandwidth of 250 Hz. Within each subband, the subband analysis module calculates amplitude statistics, phase statistics, cross-correlation characteristics, and α-stable-GLRT determination results in parallel, generating a set of subband control parameters containing the 32 subbands and a frame-level mode label based on these statistics.

[0021] The shared memory control packet is located in the central right area of ​​the graphics processing unit (GPU), serving as the medium for cross-stream data exchange and synchronization control between the second and first CUDA streams. The shared memory control packet uses a fixed-length data structure, comprising a header area, a record area, and a synchronization event record.

[0022] The packet header area occupies 64 bytes, using 64-byte alignment, and is used to store metadata for the control packet, including key fields such as the write index, read index, and most recent frame sequence number. The write index and read index are updated atomically, working in conjunction with the record capacity to achieve circular buffer management.

[0023] The recording area stores the subband control parameters and frame-level mode flags for each frame. The recording area uses a circular buffer organization, capable of accommodating multiple frames of data. Each record contains 32 subband control parameters, each including three discrete-level quantities: a gating parameter indicating whether the subband is allowed to be updated (value: allow update or disable update); a step size parameter indicating the convergence speed level of the subband (value: very low, low, medium, or high); and a leakage parameter indicating the coefficient shrinkage intensity of the subband (value: low, medium, or high). In addition, the recording area also stores the frame-level mode flag, which is either normal mode or low-confidence mode.

[0024] The synchronization event recording section is used to establish a time anchor point between the second CUDA stream and the first CUDA stream. After the second CUDA stream completes the writing of the subband control parameters and frame-level mode flags for one frame, it immediately records a synchronization event. This synchronization event serves as a cross-stream time reference for the first CUDA stream to wait for and synchronize.

[0025] The first CUDA stream is set to medium priority and located in the lower half of the graphics processing unit. Its main responsibilities include partitioned blocking frequency domain subband adaptive filtering, filter coefficient updates, and generation of echo suppression outputs. The processing flow of the first CUDA stream begins by waiting for a synchronization event. When the synchronization event recorded by the second CUDA stream reaches the ready state, the first CUDA stream immediately reads the subband control parameters and frame-level mode flags corresponding to the current frame from the shared memory control packet.

[0026] After reading, the first CUDA stream enters the partitioned blocking frequency domain subband adaptive filtering module. This module performs adaptive filtering on the far-end reference signal and the microphone near-end signal within the same frame based on the read subband control parameters and frame-level mode flags. Specifically, this module determines whether to perform incremental updates of the filter coefficients for each subband based on the gating parameters; determines the magnitude of the coefficient update based on the step size parameter; and performs proportional coefficient shrinkage based on the leakage parameter. The frame-level mode flag is used to schedule the partition range: when the frame-level mode flag is in normal mode, updates are performed on all partition blocks; when the frame-level mode flag is in low-confidence mode, updates are performed only on the most recent partition blocks with indices 0 to 7.

[0027] After updating the filter coefficients, the partitioned blocking frequency domain sub-band adaptive filtering module generates the echo estimate for the current frame using the updated coefficients. The echo estimate is then subtracted from the microphone near-end signal to obtain the echo-suppressed signal output. This echo-suppressed signal output is then overlaid and summed to form a continuous time-domain output sequence for use in subsequent audio processing or transmission.

[0028] Figure 1 The arrows indicate the data flow and processing order. The microphone near-end signal and far-end reference signal are input from the top of the graphics processing unit (GPU). After processing by the subband analysis module of the second CUDA stream, the generated subband control parameters and frame-level mode markers enter the shared memory control packet via the "write parameters" path. The shared memory control packet then transmits data to the first CUDA stream via the "read parameters" path. After waiting for the synchronization event to complete, the first CUDA stream reads the parameters and performs adaptive filtering, ultimately outputting an echo suppression signal at the bottom of the GPU.

[0029] The system architecture reflects the collaborative division of labor between two CUDA streams: the second CUDA stream focuses on rapidly completing subband analysis and parameter deployment, leveraging its high priority to ensure parameters enter shared memory as early as possible; the first CUDA stream focuses on computationally intensive adaptive filtering tasks, utilizing same-frame parameters read from shared memory to achieve a synergistic effect where frame-by-frame statistics are applied to frame-by-frame updates in real time. Cross-stream control uses events as a medium and fixed-length control packets as carriers to ensure strict time alignment and data consistency between the two CUDA streams at the frame level, thereby achieving efficient dual-talk detection and acoustic echo cancellation collaborative processing.

[0030] In one specific implementation, when creating the first and second CUDA streams on the same graphics processing unit (GPU), a runtime object-oriented construction process is adopted. The host side first confirms that the GPU's computing power level is 7 or higher, and that the driver version and CUDA toolchain version are within the compatibility matrix (e.g., driver version 535 series, CUDA toolchain version 12 series). After establishing the frame timing for acquisition and playback, the host side starts the runtime context, putting the GPU into a receptive task state. Subsequently, independent stream objects are prepared for the two subsequent computation paths. The second CUDA stream handles frame-level subband analysis and parameter publishing, while the first CUDA stream handles partitioned blocking frequency domain subband adaptive filtering and echo suppression output. To ensure that parameters enter video memory earlier and trigger cross-stream control, the second CUDA stream uses a higher priority, and the first CUDA stream uses a medium priority. The difference in priority has two direct effects: after a frame arrives, the second CUDA stream takes up a computation cycle earlier to generate a set of subband control parameters and a frame-level mode flag; the first CUDA stream waits for the synchronization event to reach the ready state before it starts filtering updates for the same frame. The cross-stream dependency order is clear and has a stable temporal relationship.

[0031] The creation of the two CUDA streams utilizes the runtime stream creation interface, setting the work queue depth of the stream objects to 64, the task submission strategy to non-blocking, and the callback notification strategy to event-driven. After creation, two valid stream identifiers are obtained. Each stream identifier is registered in the host-side control structure, which stores the stream identifier, priority, work queue depth, and the timestamp of the most recent submission. After registration, the host writes an initialization command sequence to the device, including memory zeroing, event pool warm-up, and time base calibration. The goal of event pool warm-up is to obtain a reusable set of synchronous event objects with minimal startup cost. Time base calibration obtains a reference scale through a single device timing query; subsequent time fields in the shared memory control packet are written according to this scale, facilitating the determination of frame age and sequence between the two CUDA streams under the same reference.

[0032] When establishing a shared memory control packet for cross-stream control between the first and second CUDA streams, the resident area of ​​the device-side global memory is preferentially used. This control packet is laid out with a fixed-length data structure, designed for stable reuse across consecutive frames, avoiding fluctuations caused by dynamic scaling. The control packet is divided into a header area and a record area. The header area is 64 bytes long, aligned to 64 bytes, ensuring the header resides in the L2 cache as a single line and completes the reading of key fields within a single load cycle. The header area contains the following fields and their order: version number (4 bytes, set to 1); record capacity (4 bytes, set to 64); write index (4 bytes, initial value 0); read index (4 bytes, initial value 0); most recent frame sequence number (8 bytes, initial value 0); most recent commit timestamp (8 bytes); most recent consumption timestamp (8 bytes); and reserved alignment (24 bytes). The write and read indices advance atomically, forming a circular management system with the record capacity to ensure sequential advancement and bounded occupancy of records under high concurrency access.

[0033] The recording area carries the subband control parameters and frame-level mode markers for each frame. The recording area is a contiguous region equal to the recording capacity multiplied by the length of a single record. A single record is 256 bytes long and aligned to 64 bytes. Each record contains three parts: a record header, a subband parameter segment, and a checksum segment. The record header occupies 32 bytes, with the following fields in order: frame sequence number (8 bytes), subband count (4 bytes), frame-level mode marker (4 bytes), record status (4 bytes), and record timestamp (8 bytes). The subband parameter segment carries a fixed number of subband control parameters. There are 32 subbands, and each subband parameter occupies 6 bytes. The following fields are arranged as follows: subband index (2 bytes), subband gating parameter (1 byte), subband step size parameter (1 byte), subband leakage parameter (1 byte), and reserved (1 byte). The 32 subbands occupy a total of 192 bytes. The checksum segment occupies 32 bytes, with the following fields: record sequence number mirror (8 bytes), cumulative checksum (8 bytes), and reserved alignment (16 bytes). The record status field uses low-order flags to represent the lifecycle: 0 indicates idle, 1 indicates written and awaiting consumption, and 2 indicates consumed and awaiting reuse. Accumulated checksums are generated byte-by-byte, ensuring the first CUDA stream confirms record integrity within a very short time.

[0034] The write path for the shared memory control packet occurs in the second CUDA stream. After completing subband analysis of one frame, the second CUDA stream enters the record write sequence. The sequence consists of three steps. First, it reads the write index from the packet header, calculates the address of the record slot to be written, and writes the frame number, subband count, frame-level mode flag, and record timestamp from the record header. Second, it writes the subband gating parameters, subband step size parameters, and subband leakage parameters of the 32 subbands sequentially into the subband parameter segment in ascending order of the subband index, while simultaneously calculating the accumulated checksum and writing it into the checksum segment. Third, it sets the record status to "written, awaiting consumption," then records a synchronization event, and finally atomically increments the write index in the packet header. This sequence provides a clear visibility guarantee: the record body falls into memory first, the record status is set before and after the synchronization event, and the first CUDA stream obtains the read time by waiting for the synchronization event; at the read time, the record body has reached a consistent storage state. By combining event-first recording with index-after-the-flying, the reader can directly locate the record slot with a written state when it observes a new index value, reducing one extra polling.

[0035] The shared memory control packet read path occurs in the first CUDA stream. Before processing the filter update of the same frame, the first CUDA stream waits for the synchronization event recorded by the second CUDA stream to reach the ready state. After reaching the ready state, the first CUDA stream reads the read index and write index of the packet header area. When the difference between the two is in a positive range, the record slot pointed to by the read index is in a consumeable state. The first CUDA stream loads the read record header, subband parameter segment, and check segment in sequence. It accumulates the check segment byte by byte and compares it with the accumulated check in the record. When the two match, it enters the consumption process. The consumption process reads the frame-level mode flag and the subband gating parameters, subband step size parameters, and subband leakage parameters of 32 subbands in sequence. This set of parameters is directly used for partition blocking frequency domain subband adaptive filtering within the same frame. After consumption, the first CUDA stream writes the record status as consumed and ready for reuse, and advances the read index of the packet header area atomically. At the same time, it records a completed device event, providing a time anchor for the statistical update of the second CUDA stream.

[0036] The size and alignment strategy of the shared memory control packet create a cache-oriented access advantage. The packet header and each record are aligned to a 64-byte boundary. When the graphics processing unit's L2 cache uses 64-byte granularity for a single transaction, the critical fields in the packet header can be loaded within a single transaction. The sub-band parameter segment of the record area is 192 bytes, corresponding exactly to three 64-byte cache lines. The first CUDA stream can complete the entire segment's movement in consecutive accesses during sub-band reading, improving memory merging. Setting the record capacity of the ring management to 64 provides an equivalent buffer depth. When there are fluctuations in inter-frame processing time, a ring capacity of 64 can accommodate transient congestion within the range of approximately 20 to 40 milliseconds, ensuring that the two CUDA streams continue to advance in an event-aligned manner.

[0037] The shared memory control package establishes a unidirectional trigger chain for cross-stream control using explicitly visible recording status and synchronization events. The second CUDA stream publishes a record and records a synchronization event immediately after completing analysis of the same frame. The first CUDA stream then begins its filtering task for the same frame, starting with this synchronization event. This design is based on the stringent time requirements of the parameter update chain. Subband gating parameters, subband step size parameters, and subband leakage parameters must enter memory as early as possible and become input to the first CUDA stream. This allows the partitioned blocking frequency domain subband adaptive filtering of the same frame to perform more aggressive or conservative updates based on the gating and level of the frame. Priority differences provide a more stable temporal order; the second CUDA stream usually completes and publishes its record first, and the first CUDA stream always reads the latest parameters for the current frame. Recording status and accumulated check fields further provide determinable consistency conditions. The reader immediately enters the filtering path after a single comparison, reducing unnecessary polling and waiting, thus freeing up more computational resources for adaptive filtering itself. When creating the first and second CUDA streams, the runtime interface supports setting multiple attributes such as stream priority, kernel launch order, and callback triggering method. The priority value can be set from 0 to 2, with the second CUDA stream set to 2 and the first CUDA stream set to 1. The kernel launch order is set to enqueue according to the submission order, and the callback triggering method is set to device event triggering. A work queue depth of 64 allows several kernel functions within a single frame to be queued continuously without frequent host-side intervention. In most graphics processing units, the average latency for event logging and event waiting is less than 5 microseconds; therefore, cross-stream control using events as a medium can occupy a minimal time budget within a single frame.

[0038] The shared memory control packet employs a two-layer guarantee for read / write consistency. The first layer guarantees write order: the second CUDA stream proceeds by writing the record body first, then the record status, and finally the synchronization event. This ensures that when the reader observes a synchronization event, the record body has already fallen into memory and is ready for direct reading. The second layer guarantees index advancement: the second CUDA stream advances the write index after recording the synchronization event. As the reader observes the write index advancing, it can gradually catch up using the read index, ensuring that slots with a write-ready, ready-to-consume status are always ahead of the slot pointed to by the read index. This combination of guarantees results in a clear monotonic availability sequence, enabling the first CUDA stream to locate a consumable record with constant complexity at any given time. The shared memory control packet's field values ​​are expressed using discrete levels, making gating and level decisions for subsequent processing intuitive and transparent. Subband gating parameters offer two options: allow updates and disable updates. Subband step size parameters have four levels: very low, low, medium, and high. Subband leakage parameters have three levels: low, medium, and high. Frame-level mode flags offer two options: normal mode and low-confidence mode. The reason for using discrete levels is that in time-varying acoustic environments, the rapid switching of gating and levels has clear boundaries and traceability. The sub-band parameter segment of the recording area expresses the three quantities of each sub-band in a single-byte field. The memory access volume of single-frame writing and reading is stable, which is convenient for maintaining a fixed throughput under high concurrency.

[0039] In terms of the timing organization of cross-stream control, the second CUDA stream publishes a record at the frame level. The publication time is close to the completion time of the short-time frequency domain transformation of the frame, and the parameter generation path and the frequency domain transformation path are merged, saving an additional memory relocation. After consuming a record, the first CUDA stream immediately performs partitioned blocking frequency domain subband adaptive filtering for the same frame. The parameters come from the subband control parameters and frame-level mode flags of the same frame, and the output is closed in the same frame, so that the two CUDA streams form a frame-to-frame parallel pipeline. Event recording and waiting are performed on the device side, and the clock source comes from the internal counter of the graphics processing unit. The latency is consistent and the jitter is small, which is beneficial to maintaining a steady state under real-time audio interaction conditions. Several optional implementation methods are also provided to address the differences in actual deployment. Optional implementation method one: the shared memory control packet switches from the device-side global video memory to a unified virtual addressing memory region. Unified virtual addressing allows the host and device to share the same address space. The host side can directly observe the key fields of the packet header area and the record area and perform state sampling, thereby generating frame-level visual trajectories in diagnostic or debugging scenarios. Unified virtual addressing has a slightly higher frame-level write latency than device-side global memory, making it suitable for stages where functionality verification and stability observation are prioritized. Option 2 increases the recording capacity from 64 to 128, with the total length of the recording area increasing linearly with the capacity. This capacity increase ensures the computing link remains stable even when multiple concurrent applications compete for graphics processing units, significantly increasing the margin for circular propagation. Option 3 uses a dual-packet alternation method for the recording area, where the same frame forms two copies (primary and secondary) in two recording slots. The first CUDA stream reads the primary copy first, and immediately reads the secondary copy if a checksum mismatch is encountered. This dual-packet alternation trades space for consistency, ensuring consistent cross-stream control under minimal abnormal interference. Option 4 expands the recording status field to four values, adding two intermediate states: "Writing" and "Consuming." The second CUDA stream sets the recording status to "Writing" before writing the sub-band parameter segment and to "Written and Awaiting Consumption" after writing; the first CUDA stream sets the recording status to "Consuming" after reading the recording header and to "Consumed and Awaiting Reuse" after consumption. The four-state representation provides a richer observable window when multiple cores access the recording area simultaneously, facilitating link shaping under high load. At the system-level benefit level, the use of two CUDA streams with clearly defined priorities and a shared memory control packet brings three improvements. First, the second CUDA stream completes subband analysis first and publishes subband gating parameters, subband step size parameters, and subband leakage parameters, enabling the first CUDA stream to perform more adaptive operations on the same frame that better fit the acoustic structure of that frame. Second, the two-layer consistency design of event triggering and index advancement compresses cross-stream communication latency to the microsecond level, and under common configurations, the synchronization cost is less than five percent of the frame processing budget.Third, the control packet records the control quantities of 32 subbands in 256-byte alignment, the single-frame memory access is fixed and continuous, the L2 cache hit rate is stable in a high range, and the bandwidth utilization of the graphics processing unit is more balanced.

[0040] When organizing the microphone near-end signal and far-end reference signal into continuous frames with a preset frame length and frame shift, a single-channel pulse coding scheme with a sampling rate of 16000 Hz is preferentially adopted, with a frame length of 512 sampling points and a frame shift of 256 sampling points. The direct effect of this setting is that the time-domain duration of a single frame is approximately 32 milliseconds, and the inter-frame overlap is 50%. This ensures that the frequency domain resolution is stably maintained at a granularity of approximately 31.25 Hz at each frequency point, while generating a new frame of data every 16 milliseconds. This facilitates the second CUDA stream to complete subband analysis and parameter publishing within the same frame time range. During framing, a Hanning-type smoothing window is applied to each 512-point time-domain sequence to reduce the impact of spectral leakage. The reason for choosing a smoothing window is that this type of window forms a predictable trade-off between main lobe width and side lobe suppression, avoiding the misleading of subsequent percentile statistics by a few high-amplitude spikes in the common case of speech energy distribution spanning multiple frequency points. The framed data is written to a circular buffer that can be directly accessed on the device side. The frame sequence number in the buffer is incremented in the order of arrival, which facilitates the second CUDA stream to read the data at the frame level.

[0041] Within the second CUDA stream, a 512-point Fast Fourier Transform is performed on the microphone near-end signal and far-end reference signal for each frame to obtain the frequency domain spectrum. To align with the generation of subsequent subband control parameters and frame-level mode labeling decisions, the 0-8000 Hz frequency band is divided into 32 equal-width subbands, each 250 Hz wide. The motivation for dividing into 32 subbands is that they can achieve sufficient parallelism at the thread block scale of common graphics processing units, and each subband covers a frequency domain range sufficient to cover the energy concentration areas of the fundamental frequency and harmonics of speech, without compressing a single subband too wide and diluting coherence. Subband boundaries are arranged in ascending order of frequency, and subband indices are expressed using consecutive integers from 0 to 31, with all subsequent reads and writes maintaining consistency based on this index.

[0042] For each subband, the second CUDA stream extracts amplitude and phase sequences in parallel. The amplitude sequence is derived from the complex spectral amplitudes of all frequencies within the subband, collected in frequency order to form a sample set of the same length. The phase sequence is derived from the angular information of the same set of complex spectra, and the phase difference sequence is obtained by subtracting the near-end signal from the far-end reference signal at each point. The phase difference is expressed in degrees and limited to the range of 0 to 180 degrees. The reason for choosing degrees is to facilitate direct comparison with the subsequent 20-degree threshold and avoid the unit conversion differences caused by radians.

[0043] To generate subband control parameters, the second CUDA stream calculates the 90th percentile amplitude for both the microphone near-end signal and the far-end reference signal within each subband. The calculation method is as follows: amplitude samples within the subband are sorted in ascending order, and the value at which the sample count is multiplied by 0.9 is taken as the 90th percentile amplitude. Using this threshold as a boundary, the proportion of samples greater than this threshold is calculated out of the total number of samples in the subband, yielding the microphone tail proportion and the reference tail proportion. The choice of the 90th percentile makes the statistics more sensitive to the upper sparse region of the amplitude distribution, which is most prone to abrupt increases during voice two-way communication and far-end dominance switching; the tail proportion transforms this abrupt increase into a metric between 0 and 1, facilitating cross-subband comparisons.

[0044] like Figure 2As shown, this figure illustrates the characteristic curves of subband amplitude percentiles and far-end dominance determination. The horizontal axis represents the subband index, ranging from 0 to 32, corresponding to the 32 equal-width subbands dividing the 0-8000 Hz frequency band; the vertical axis represents the normalized amplitude in decibels (dB), ranging from -50 dB to 50 dB. Two curves are plotted in the figure. The first, solid line, represents the variation of the 90th percentile amplitude (P90 amplitude) of the microphone's near-end signal with the subband index. This curve exhibits fluctuations in the initial stage, with amplitude values ​​varying between -30 dB and -5 dB. Within the subband index range of 10 to 20, the curve shows a significant increase, with the amplitude value increasing by approximately 15 dB. This range corresponds to the dual-talk detection region, i.e., the period when near-end speech and far-end reference signals coexist, at which time the energy of the microphone's near-end signal is significantly enhanced. The second, dashed line, represents the variation of the 90th percentile amplitude of the far-end reference signal with the subband index. The curve is relatively stable, with amplitude values ​​varying between -35dB and -15dB, generally lower than the amplitude curve of the microphone near-end signal. Within the dual-talk detection region (sub-band indices 10 to 20), the amplitude of the far-end reference signal remains relatively stable, without any significant sudden increases. The dual-talk detection region is marked with a gray shading in the figure, and is bordered by a solid black line. Within this region, the P90 amplitude of the microphone near-end signal is significantly higher than that of the far-end reference signal, and the absolute value of the difference in their tail proportions exceeds the preset threshold of 0.1, indicating a clear near-end speech dominance. Outside the dual-talk detection region, within sub-band indices 0 to 10 and 20 to 32, the amplitude difference between the two curves is small, and the absolute value of the tail proportion difference is less than or equal to 0.1, meeting the criteria for far-end dominance. By comparing and analyzing the two curves, the operating mode of each sub-band can be determined in real time. When the tail ratio difference between the near-end signal and the far-end reference signal within a sub-band is small, it is determined to be a far-end dominant mode, and the filter coefficients for that sub-band can be updated. When the tail ratio difference is large, it is determined to be a dual-talk mode, and the filter coefficients for that sub-band are prohibited from being updated to avoid filter divergence caused by near-end speech interference. This determination mechanism is based on the 90th percentile statistic and has good robustness to outliers.

[0045] Next, the phase consistency rate is calculated. The phase difference sequence is checked point by point, and samples with an absolute value less than or equal to 20 degrees are counted as consistent samples. The proportion of consistent samples to the total number of samples in that sub-band is calculated to obtain the phase consistency rate. The direct advantage of choosing 20 degrees is that it unifies near-in-phase or slightly offset cases as consistent, which is most common in situations with a stable echo path and far-end dominance. When near-end speech is significantly involved, the phase difference distribution is more dispersed, and the phase consistency rate decreases significantly. Next, the amplitude similarity rate is calculated. The ratio of the microphone amplitude to the reference amplitude is taken point by point within the sub-band, and samples with a ratio between 0.5 and 2 are included in the similarity set. The proportion of the similarity set to the total number of samples in that sub-band is calculated to obtain the amplitude similarity rate. This range covers common cases where the far-end reference falls to the same order of magnitude after acoustic attenuation or amplification, allowing for the representation of the convergence of magnitudes between the two signals without relying on absolute amplitude. Finally, the amplitude dominance rate is calculated. For the same ratio sequence, the proportion of samples with a ratio greater than or equal to 1.5 is used as the amplitude dominance rate to capture signs that the near-end signal of the microphone is significantly stronger than the far-end reference at certain frequency points, which is commonly seen at the transition moment when the near-end sound is just beginning.

[0046] Based on the above statistics, the second CUDA stream generates two types of evidence scores within each subband. The far-dominant evidence score is equal to the sum of the counts for the following three conditions: the absolute value of the tail proportion difference is less than or equal to 0.1, the amplitude similarity rate is greater than or equal to 0.6, and the phase consistency rate is greater than or equal to 0.7. This design scores three complementary clues—tail distribution proximity, amplitude magnitude proximity, and phase alignment—in parallel; the more conditions met, the higher the credibility of far-dominance. The dual-talk evidence score is equal to the sum of the counts for the following two conditions: amplitude dominance rate is greater than or equal to 0.3, and the phase consistency rate is less than 0.7. This design combines near-end energy dominance and phase divergence into another independent evidence path, facilitating rapid score improvement when both paths exist simultaneously. After comparing the two types of scores, if the far-dominant evidence score is greater than the dual-talk evidence score, it is recorded as far-dominant according to α-stable-GLRT criteria; otherwise, it is recorded as dual-talk according to α-stable-GLRT criteria. The core benefit of this comparison strategy is that it can drive clear binary decisions with a small number of thresholds without introducing complex probability models, and it is easy to implement in parallel branches on the graphics processing unit.

[0047] like Figure 3As shown in the figure, this graph illustrates the characteristic curves of phase consistency rate and dual-talk detection. The horizontal axis represents the sub-band index, ranging from 0 to 32; the vertical axis represents the proportional value, dimensionless, ranging from 0 to 1.0. A horizontal dashed line is plotted at 0.7 on the vertical axis, representing the threshold for determining phase consistency rate. When the phase consistency rate of a sub-band is greater than or equal to 0.7, the sub-band is considered to be in a high phase consistency state, indicating a stable phase relationship between the near-end signal and the far-end reference signal, a typical characteristic of far-end dominance mode. When the phase consistency rate is less than 0.7, the sub-band is considered to be in a low phase consistency state, indicating a divergence in the phase relationship between the two signals, which typically occurs in near-end speech involvement or dual-talk scenarios. The graph contains three curves. The first curve, a solid line, represents the change in phase consistency rate with the sub-band index. Within the subband indices 0 to 10 and 20 to 32, the phase coherence rate remains between 0.75 and 0.85, significantly higher than the threshold of 0.7. This indicates that within these regions, the phase difference between the near-end microphone signal and the far-end reference signal is mainly concentrated within the range of 0 to 20 degrees, and the two signals are highly synchronized, consistent with the characteristics of far-end dominance. In the dual-talk region with subband indices 10 to 20, the phase coherence rate drops sharply to between 0.35 and 0.5, significantly lower than the threshold of 0.7. This indicates that the phase difference distribution is dispersed, with a large number of samples showing a phase difference exceeding 20 degrees, which is due to the disruption of phase relationships caused by near-end speech involvement.

[0048] The second line, a type of dashed line (short-spaced dashed lines), represents the variation of amplitude similarity rate with sub-band index. This curve remains between 0.62 and 0.78 in the far-end dominance region, indicating that the amplitude ratio of the microphone near-end signal to the far-end reference signal is within a similar range of 0.5 to 2.0, and the energy levels of the two signals are converging. In the dual-talk region, the amplitude similarity rate rises to between 0.5 and 0.65, showing some fluctuation, but still remains at a high level overall. This indicates that even in dual-talk mode, the amplitudes of the two signals may still maintain a certain degree of similarity; therefore, the amplitude similarity rate as a single criterion has limited distinguishing power. The third line, a type of dashed line (long-spaced dotted lines), represents the variation of amplitude dominance rate with sub-band index. This curve remains at a low level between 0.15 and 0.25 in the far-end dominance region, indicating that the proportion of samples where the amplitude of the microphone near-end signal is significantly stronger than that of the far-end reference signal is low, and the energy distribution of the two signals is relatively balanced. In the two-talk region, the amplitude dominance rate rises sharply to between 0.55 and 0.7, indicating that the ratio of microphone amplitude to reference amplitude in a large number of samples is greater than or equal to 1.5, and the energy of near-end speech dominates, which is significant evidence of two-talk. The figure labels three working regions. The region with sub-band indices 0 to 10 is labeled "far-end dominant," indicating high phase coherence and low amplitude dominance, meeting the criteria for far-end dominance. The region with sub-band indices 10 to 20 is labeled "two-talk," indicating low phase coherence and high amplitude dominance, also meeting the criteria for two-talk. The region with sub-band indices 20 to 32 is again labeled "far-end dominant," indicating that the system returns to a far-end dominant state after two-talk ends. Through comprehensive analysis of these three curves, accurate detection of the two-talk state can be achieved. Phase coherence provides the basis for phase domain determination, and amplitude dominance provides the basis for energy domain determination; the two complement each other and together form the basis for calculating the two-talk evidence score. When the phase coherence rate is below 0.7 and the amplitude dominance rate is above 0.3, the dual-talk evidence scores are accumulated, thereby triggering the sub-band gating parameters to be set to prohibit updates, protecting the filter coefficients from near-end speech interference.

[0049] Within the same subband, the second CUDA stream further calculates the normalized cross-correlation peak and corresponding hysteresis. Specifically, on the subband's frequency set, the near-end microphone signal spectrum and the far-end reference signal spectrum are multiplied by their conjugates and averaged along the frequency points to form the correlation. Then, the energy of each spectrum is averaged along the frequency points and normalized to obtain a normalized correlation value between 0 and 1. The peak value of this correlation value is searched within a discrete range of hysteresis from -3 to +3, and the corresponding hysteresis is recorded. If the peak value is between 0.6 and 1 and the hysteresis is within ±3 frequency points, it is marked as high coherence; otherwise, it is marked as low coherence. The α-stable-GLRT determination and coherence are fused to generate subband gating parameters, subband step size parameters, and subband leakage parameters, which together constitute the subband control parameters. The fusion uses an explicit lookup table method, with entries fixed during initialization, allowing each subband to obtain discrete levels in constant time. Typical parameters include: when α-stable-GLRT determines far-end dominance and high coherence, setting the subband gating parameter to allow updates, and setting a high-level subband step size parameter and a low-level subband leakage parameter; when α-stable-GLRT determines far-end dominance and low coherence, setting the subband gating parameter to allow updates, and setting a medium-level subband step size parameter and a medium-level subband leakage parameter to reduce over-response to unstable coherence; when α-stable-GLRT determines dual-talk and high coherence, setting the subband gating parameter to disable updates, and setting a very low-level subband step size parameter and a high-level subband leakage parameter to suppress rapid filter changes in dual-talk mode; when α-stable-GLRT determines dual-talk and low coherence, keeping the subband gating parameter to disable updates, and setting a very low-level subband step size parameter and a high-level subband leakage parameter. The advantage of using table lookup fusion is that the output of all condition combinations is predefined, threads do not need to share complex states, and it is easy to ensure consistency across frames.

[0050] After obtaining the subband control parameters for 32 subbands, the second CUDA stream generates a frame-level mode flag. The calculation method involves counting the number of subbands whose updates are prohibited by the subband gating parameters and comparing this number with a threshold of 16. If the number is greater than or equal to 16, it is set to low-confidence mode; otherwise, it is set to normal mode. This frame-level mode flag is used to indicate to the first CUDA stream to adopt different partition processing ranges within the same frame: low-confidence mode indicates a more conservative update strategy, while normal mode indicates an update strategy covering all partitions. The design principle of this frame-level flag is to schedule the entire frame update range as a whole based on the majority gating state at the subband level, avoiding high-cost operations on all partitions when updates to large quantum bands are prohibited.

[0051] The second CUDA stream writes the subband control parameters and frame-level mode flags of the same frame into the shared memory control packet. The writing order follows the rule of load first, then state, to ensure that the first CUDA stream can read complete and consistent data when it observes the ready signal. The specific order is as follows: First, read the write index of the shared memory control packet and calculate the record slot address; then write the frame sequence number, subband count, and frame-level mode flag in the record header; then, in the order of subband index from 0 to 31, write the subband gating parameters, subband step size parameters, and subband leakage parameters of each subband into the subband parameter segment; next, calculate and write the checksum generated by byte accumulation; finally, set the record status to written and ready for consumption, and record a synchronization event. The significance of recording the synchronization event is to provide a clear time anchor point for the first CUDA stream; after waiting for the synchronization event, the first CUDA stream will definitely read the subband control parameters and frame-level mode flags that have fallen into the memory and are fully checked. Synchronization events, in conjunction with the advancement of the write index, enable the read path to complete positioning with constant complexity, avoiding the polling overhead within the same frame time slot.

[0052] The design of the above process follows two core considerations. First, in the generation of subband control parameters, statistical measures such as percentiles, proportions, and interval criteria are used instead of complex probability models. The reason is that these statistical measures are inherently robust to anomalous samples, and each criterion can be directly mapped to a hard threshold, enabling thread-level implementation to have a deterministic control path. Second, in cross-stream delivery, a combination of fixed length, ordered writing, and event triggering is used. The reason is that this combination makes timing visible, data consistent, and is friendly to caches and buses, making it easy to control synchronization costs to the microsecond level within the frame time limit.

[0053] Option 1: The frame length remains 512 sampling points, and the frame shift remains 256 sampling points. However, the smoothing window is switched from a Hanning-type smoothing window to a flat-top smoothing window, suitable for test scenarios with higher amplitude accuracy requirements. This switch widens the main lobe, resulting in a flatter passband gain. The calculation of sub-band control parameters and thresholds remain unchanged. Option 2: The 90th percentile and proportion calculations in sub-band statistics are approximated using a histogram. 64 equidistant amplitude buckets are constructed within each sub-band and accumulated in parallel. The upper bound of the bucket containing the 90th percentile is found using the accumulated count as the threshold, and then the tail proportion and correlation proportion are calculated. This method reduces inter-thread synchronization during sorting while maintaining sufficient closeness to the results of precise sorting at a resolution of 64 buckets. Option 3: The peak search for normalized cross-correlation remains limited to a hysteresis range of -3 to +3, but when peak values ​​are equal, a priority selection strategy closer to zero hysteresis is adopted to more closely approximate the most common alignment relationship between the far-end reference and the microphone near-end signal in the same path. In optional implementation four, the record length of the shared memory control packet remains fixed, but an 8-byte processing marker bitmap is added to the record header to indicate the range of subbands that have been completed in the second CUDA stream. In extreme congestion scenarios, the first CUDA stream can choose to first read the control parameters of the subbands marked as completed and start local updates, then complete the remaining subbands within the same frame, and finally use the synchronization event as the signal for the start of the entire frame. In optional implementation five, the checksum is switched from byte-by-byte accumulation to double-word accumulation, further improving checksum performance. When the first CUDA stream reads a checksum inconsistency, it can directly read the immediately following copy record to continue. The copy record and the main record are completed simultaneously in the second CUDA stream using a dual-write strategy.

[0054] Through the above specific implementation process, the second CUDA stream constructs a frequency domain spectrum using a 512-point Fast Fourier Transform, dividing the 0 to 8000 Hz frequency range into 32 sub-bands. Within each sub-band, sub-band gating parameters, sub-band step size parameters, and sub-band leakage parameters are generated, along with a frame-level mode marker. Subsequently, the sub-band control parameters and frame-level mode markers are written to the shared memory control packet in a fixed order, and a synchronization event is recorded. This process ensures that the first CUDA stream can perform partitioned blocking frequency domain sub-band adaptive filtering and echo suppression output within the same frame based on consistent sub-band control parameters and frame-level mode markers, forming stable parallel cooperation at the frame level.

[0055] When entering the processing path of the current frame within the first CUDA stream, it first waits for the synchronization event recorded by the second CUDA stream to reach the ready state. After the synchronization event is ready, the first CUDA stream reads the read index and write index in the header area according to the predetermined order of the shared memory control packet, locating the record slot corresponding to the current frame; then it sequentially reads the frame sequence number, subband count, and frame-level mode flag in the record header, and performs a local accumulation check on the byte-by-byte accumulated value at the end of the record. If the check results are consistent, the first CUDA stream reads 32 sets of subband control parameters in the subband parameter segment in a continuous access manner. Each set includes subband gating parameters, subband step size parameters, and subband leakage parameters. The reason for adopting the strategy of sequential reading after the event is ready is to establish a definite causal relationship on the graphics processing unit side, so that the read subband control parameters and frame-level mode flag are consistent with the statistics of the same frame, avoiding cross-frame confusion, thereby allowing the partitioned blocking frequency domain subband adaptive filtering of the current frame to respond to the acoustic relationship of the current frame.

[0056] After reading is complete, the first CUDA stream initiates partitioned blocking frequency domain subband adaptive filtering within the same frame. The input consists of a far-end reference signal frame and a microphone near-end signal frame, both organized with a frame length of 512 sampling points and a frame shift of 256 sampling points, at a sampling rate of 16000 Hz. The far-end reference signal frame is first divided into a sequence of 512-bit blocks with a 50% overlap, forming several blocks. Each block undergoes a 512-bit Fast Fourier Transform to obtain its frequency domain vector. The direct benefit of this partitioning method is that the frequency domain vector of the block can be element-wise multiplied and summed with the filter coefficient vector in the frequency domain, thus obtaining echo estimation with low latency. When the overlap ratio is 50%, adjacent results after the inverse transform are naturally spliced ​​together through overlapping and addition, resulting in smooth temporal boundaries and avoiding block effects from entering the echo suppression output.

[0057] For the current frame, the first CUDA stream multiplies and adds the frequency domain vectors of the partitioned blocks and the filter coefficient vectors partition by partition to obtain the synthesized echo estimate in the frequency domain for the entire frame. Then, a 512-point inverse fast Fourier transform is performed to output the echo estimate time-domain sequence for that frame. The echo estimate is subtracted from the microphone near-end signal frame to obtain the residual signal frame. The residual signal frame is divided into 32 equal-width subbands in the frequency domain from 0 to 8000 Hz, completely consistent with the subband division of the second CUDA stream. Within the same frame, the first CUDA stream calculates two quantities for each subband: the average energy of the residual signal in that subband and the average energy of the echo estimate in that subband. The average energy of the residual signal and the average energy of the echo estimate are used to form an energy ratio, which is then mapped to an error covariance level according to a discrete threshold: an energy ratio greater than or equal to 2 is mapped to a high level, an energy ratio between 1 and 2 is mapped to a medium level, and an energy ratio less than 1 is mapped to a low level. The reason for using energy ratios instead of absolute values ​​is that the energy ratio within a subband directly reflects whether the echo estimation on that subband adequately suppresses the near-end remnants. A high level means that the near-end remnant energy is significantly higher than the estimated energy, requiring more conservative convergence for stable updates. A low level means that the estimated energy is dominant, allowing for more aggressive convergence on that subband to accelerate the approach to the target response.

[0058] The first CUDA stream then synthesizes the read subband control parameters with the locally obtained error covariance level to generate the final subband step size parameter and the final subband leakage parameter. The synthesis strategy uses a discrete lookup table, with entries fixed during the initialization phase: when the error covariance level is high, the final subband step size parameter decreases by one level relative to the original subband step size parameter, and the final subband leakage parameter increases by one level relative to the original subband leakage parameter. The purpose is to strengthen coefficient contraction, reduce the single-frame change amplitude, and improve stability under conditions of high uncertainty; when the error covariance level is low, the final subband step size parameter increases by one level relative to the original subband step size parameter, and the final subband leakage parameter decreases by one level relative to the original subband leakage parameter. The purpose is to increase the single-frame change amount and shorten the time to reach steady state under conditions of low residual; when the error covariance level is medium, the final subband step size parameter and the final subband leakage parameter remain the same as the original values ​​to maintain balanced progression. The reason for using discrete increments instead of continuous interpolation is that the graphics processing unit thread bundle can form a single branch path when reading the lookup results, making memory access and control flow more regular and reducing efficiency loss caused by scattered branches.

[0059] like Figure 4As shown in the figure, this graph illustrates the mapping relationship between the energy ratio and the error covariance level. The horizontal axis represents the ratio of residual energy to echo estimation energy, i.e., the dimensionless ratio obtained by dividing the average energy of the residual signal in a certain subband by the average energy of the echo estimation in the same subband. This axis uses a logarithmic scale, ranging from 0.1 to 5.0, with key scale points including 0.1, 0.5, 1.0, 1.5, 2.0, 3.0, and 5.0. The vertical axis represents the error covariance level, a discrete quantity divided into three levels: low, medium, and high, from bottom to top. A thick black solid line is drawn in the graph, representing the step mapping function from energy ratio to error covariance level. This mapping function exhibits a three-segment structure, reflecting the different error covariance characteristics corresponding to different energy ratio intervals. In the first interval, when the energy ratio is less than 1.0, the mapping function outputs a low level. At this point, the energy of the residual signal is lower than that of the echo estimate, indicating that the filter effectively suppresses echoes, the echo estimate dominates, and the error covariance is small. At this level, the system determines that the convergence state is good, and a more aggressive update strategy can be adopted: increase the subband step size parameter by one level relative to the original value, increasing the change per frame to accelerate the filter coefficients' approach to the optimal value; simultaneously, decrease the subband leakage parameter by one level relative to the original value to reduce the degree of coefficient contraction, allowing for greater adjustments to the coefficients based on the current level. In the second interval, when the energy ratio is between 1.0 and 2.0, the mapping function output is at a medium level. At this point, the energy of the residual signal and the energy of the echo estimate are at a comparable level, indicating that the filter's convergence state is in an intermediate transition phase, and the error covariance is moderate. At this level, the system determines that the convergence state is stable, and a balanced update strategy is adopted: keep the subband step size parameter and the subband leakage parameter the same as the original values, do not adjust the level, maintain the current update rhythm, neither too aggressive nor too conservative, to smoothly advance the optimization process of the filter coefficients. In the third interval, when the energy ratio is greater than or equal to 2.0, the mapping function outputs a high level. At this point, the energy of the residual signal is significantly higher than the energy of the echo estimation, indicating that the echo estimation failed to adequately suppress near-end remnants, resulting in poor filter convergence and a large error covariance. At this level, the system's decision-making exhibits high uncertainty, necessitating a conservative update strategy: decreasing the subband step size parameter by one level relative to the original value to reduce the magnitude of single-frame changes and prevent excessively large update step sizes from causing filter coefficients to deviate from the optimal direction; simultaneously, increasing the subband leakage parameter by one level relative to the original value to enhance coefficient contraction and improve system stability and robustness. Vertical dashed lines are drawn at two key threshold positions in the figure. The first dashed line, located at an energy ratio of 1.0 and labeled "Threshold 1.0," demarcates the boundary between low and medium levels. The second dashed line, located at an energy ratio of 2.0 and labeled "Threshold 2.0," demarcates the boundary between medium and high levels. The selection of these two thresholds is based on experimental verification and effectively distinguishes different convergence states of the filter.The diagram also includes textual annotations indicating the parameter adjustment strategies corresponding to the three levels. The low-level region is labeled "Low Level → Step Size ↑ Leakage ↓ (Fast Convergence)," indicating that this strategy aims to accelerate convergence. The medium-level region is labeled "Medium Level → Step Size = Leakage = (Balanced Progression)," indicating that this strategy aims to maintain a stable update rhythm. The high-level region is labeled "High Level → Step Size ↓ Leakage ↑ (Conservative Stability)," indicating that this strategy aims to improve update stability.

[0060] This mapping mechanism enables the first CUDA stream to perceive and adaptively respond to error covariance in real time. After completing the echo estimation of the current frame, the first CUDA stream immediately calculates the residual energy and echo estimation energy of each sub-band, forms the energy ratio, and then... Figure 4 The mapping relationship shown determines the error covariance level. This level is then synthesized with the subband step size and subband leakage parameters provided by the second CUDA stream to generate the final subband step size and leakage parameters, which are used to update the filter coefficients for the current frame. This two-level constraint mechanism ensures that the subband-level update responds to both the statistical evidence provided by the second CUDA stream and takes into account the current frame estimation quality measured by the first CUDA stream, achieving an organic combination of cross-stream collaboration and adaptive adjustment.

[0061] The use of discrete levels instead of continuous interpolation allows the mapping function to be output in a step-like manner, facilitating fast table lookups within the graphics processing unit's thread bundle and reducing efficiency losses caused by scattered branches. Furthermore, the granularity of the three discrete levels is appropriate, effectively distinguishing the main error covariance states without increasing implementation complexity and storage overhead due to an excessive number of levels.

[0062] After generating the final subband step size parameter and the final subband leakage parameter, the first CUDA stream enters the filter coefficient update stage. The update stage strictly adheres to the subband gating parameter. For each subband, the following selection is made: When the subband gating parameter allows updates, the first CUDA stream calculates the correction vector based on the final subband step size parameter and adds it element-wise to the filter coefficient vector, completing one incremental correction for that subband; then, it performs a proportional shrinkage operation on the filter coefficient vector according to the final subband leakage parameter, ensuring that the coefficients maintain a controlled amplitude after each frame processing, thereby improving robustness. When the subband gating parameter prohibits updates, the first CUDA stream only performs a proportional shrinkage operation for that subband without incremental correction. This selection reflects cross-stream event-driven collaboration: the subband gating parameter generated by the second CUDA stream within the same frame using α-stability generalized likelihood ratio determination and coherence fusion directly determines whether the update channel of the first CUDA stream is open within the same frame, enabling the two CUDA streams to form a synchronization relationship centered on gating.

[0063] The frame-level mode marker further schedules the partition range. After reading the frame-level mode marker, the first CUDA stream selects the partition block range: when the frame-level mode marker is set to normal mode, the correction vector summation and proportional shrinkage are performed on all partition blocks of the partition blocking frequency domain subband adaptive filter in this frame; when the frame-level mode marker is set to low-confidence mode, the correction vector summation and proportional shrinkage are performed only on partition blocks with indices 0 to 7 in this frame, and proportional shrinkage is performed on the remaining partition blocks. The reason for limiting the low-confidence mode to partition blocks with indices 0 to 7 is that partition blocks starting from index 0 cover the nearest set of partitions closest to the current frame, and the temporal contribution of this set has the greatest impact on the echo estimation of the current frame; under double-talk or statistically unstable frame conditions, focusing the computation budget on the nearest set of partitions can suppress significant echo components more quickly, while keeping the variation of far-end partitions within a predictable range, balancing stability and real-time performance.

[0064] After the coefficients are updated, the first CUDA stream, following the partitioned blocking frequency domain process, performs partition-by-partition multiplication, addition, and inverse transformation on the partitioned frequency domain vector and the updated filter coefficient vector to obtain a new echo estimation result for the same frame. This result is then subtracted from the microphone near-end signal frame to generate an echo-suppressed output. This echo-suppressed output is concatenated with adjacent frames in the time domain through overlapping addition and output to a circular buffer in shared video memory, carrying the current frame number. By adopting the order of updating first and then generating the echo-suppressed output within the same frame, the improvements brought by the update are immediately reflected in the result of this frame, shortening the delay between changes in gating and level and improvements in auditory perception.

[0065] In terms of memory and scheduling, at the end of each frame, the first CUDA stream writes the record status of the corresponding record slot in the shared memory control packet as consumed and ready for reuse, and advances the read index atomically; at the same time, it records a processing completion event, which is used by the second CUDA stream for statistical self-checking and performance verification in the next frame. The advancement of record status and event recording form a clear lifecycle boundary, enabling the two CUDA streams to maintain a stable read and write order during long-term operation. The record length of the shared memory control packet is 256 bytes, and each record contains subband control parameters for 32 subbands, using 64-byte alignment; the first CUDA stream can read the complete subband parameter segment with one to three cache line accesses, resulting in a low average memory access cost, suitable for repeated execution at a real-time rhythm of generating one frame of data every 16 milliseconds. From the implementation details, the linkage between the subband gating parameters, the final subband step size parameters, and the final subband leakage parameters forms a two-level constraint. The first stage, using the second CUDA stream within the same frame, provides subband gating parameters and initial levels based on statistics such as amplitude percentile, phase consistency rate, amplitude similarity rate, and amplitude dominance rate, as well as normalized cross-correlation peak and hysteresis. The second stage, using the error covariance level formed by the first CUDA stream based on the energy ratio, performs a single-frame directional correction on the step size and leakage. The superposition of these two levels of constraints ensures that subband-level updates respond to statistical evidence while also considering the estimation quality of the current frame. For example, in a certain subband, if the subband gating parameter is allowed to be updated, the initial subband step size parameter is at a high level, the initial subband leakage parameter is at a low level, and the energy ratio is at a high level, then the final subband step size parameter is lowered by one level, and the final subband leakage parameter is raised by one level. This combination allows for more cautious fine-tuning of updates within the same frame, preventing transient anomalies from pushing filter coefficients to excessive changes. On another subband, the subband gating parameter is set to allow updates, the initial subband step size parameter is set to a medium level, the initial subband leakage parameter is set to a medium level, and the energy ratio is at a low level. Then, the final subband step size parameter is increased by one level, and the final subband leakage parameter is decreased by one level. This combination accelerates the convergence speed of the subband, allowing the dominant subband at the far end to approach the target response more quickly.

[0066] To ensure efficient thread coordination on the graphics processing unit (GPU), the first CUDA stream maps 32 subbands to an equal number of thread groups, with each thread group responsible for reading and writing fixed subband indices. The thread group first reads the corresponding subband control parameters, then performs energy calculations, level synthesis, and coefficient updates. This fixed mapping ensures a stable address range accessed by the same thread group in adjacent frames, resulting in a high cache hit rate. At the block level, thread groups prioritize computation of the nearest blocks with indices 0 to 7 to align with the frame-level mode flag's range selection in low-confidence mode. In normal mode, the block order progresses sequentially from index 0 to the maximum, ensuring a balanced load distribution throughout the processing cycle. After the echo-suppressed output is written to the shared memory ring buffer, the first CUDA stream fills the output record with the current frame number and timestamp. When the upper-layer audio output path observes consecutive frame numbers, it retrieves the echo-suppressed output from the ring buffer in a first-in, first-out manner and sends it for subsequent rendering or transmission. Since each frame is processed once every 16 milliseconds, the average overhead of event waiting and control packet reading is in the microsecond range. Partition blocking frequency domain sub-band adaptive filtering and coefficient updates occupy the main computational budget. On common graphics processing units, a 512-point fast Fourier transform and inverse transform are used, along with 32 sub-bands and several partition blocks, which can maintain stable real-time processing in audio interaction scenarios.

[0067] Option 1: In the energy ratio calculation, the geometric mean of the sub-band energy within the frame is used instead of the arithmetic mean to reduce the impact of single-point spikes. The mapping threshold still uses two boundaries, 1 and 2, and the three-level definition of the error covariance level remains unchanged. Option 2: When the frame-level mode is marked as low-confidence mode, the partition block range is expanded from index 0 to 7 to index 0 to 11. This is suitable for environments with long echo paths, covering more near-end related partitions, while placing far-end partitions in the proportionally shrunk conservative path. Option 3: The coefficient update precedence order of sub-bands adopts a sorting strategy based on energy ratio from high to low. Within the same frame, sub-bands with energy ratios at high and medium levels are processed first, improving the response speed to problematic sub-bands. Sorting is performed locally within each frame, and parameter reading and writing back still follow a fixed structure, thereby maintaining the consistency of the control packet interface. Option 4: The proportional scaling table can be loaded as a calibration file during the deployment phase. On-site, the low, medium, and high scaling values ​​can be fine-tuned based on the output amplitude of the equipment and the characteristics of the speakers to maintain a consistent listening experience for sub-band leakage parameters across different hardware platforms. Option 5: The capacity of the output ring buffer is expanded from 64 frames to 128 frames to absorb transient congestion in the upper-layer audio processing pipeline; the recording fields remain frame number and timestamp, and the reading strategy remains first-in-first-out to ensure sequence integrity.

[0068] Through the aforementioned processing path, the first CUDA stream immediately reads the subband control parameters and frame-level mode flags from the shared memory control packet after the synchronization event is ready. Within the same frame, it completes the partitioned blocking frequency domain subband adaptive filtering, selective updating of filter coefficients, and generation of echo suppression output. The gating decision is provided by the second CUDA stream within the same frame. The final step size and leakage level are synthesized by the first CUDA stream in conjunction with the error covariance level. The frame-level mode flag determines the partition range. Together, these three constitute cross-stream collaboration mediated by events, enabling the current frame statistics to instantly affect the current frame update and output, forming a stable, transparent, and directly implementable real-time processing link.

[0069] While specific embodiments of the present invention have been described above, those skilled in the art should understand that these specific embodiments are merely illustrative. Those skilled in the art can omit, substitute, and modify the details of the above methods and systems in various ways without departing from the principles and essence of the present invention. For example, combining the above method steps to perform substantially the same function and achieve substantially the same result according to substantially the same method falls within the scope of the present invention. Therefore, the scope of the present invention is defined only by the appended claims.

Claims

1. A method for collaborative processing of dual-talk detection and acoustic echo cancellation based on dual CUDA streams, characterized in that, The method includes the following steps: creating a first CUDA stream and a second CUDA stream on the same graphics processing unit; establishing a shared memory control packet for cross-stream control between the first CUDA stream and the second CUDA stream; organizing the microphone near-end signal and far-end reference signal into continuous frames with a preset frame length and frame shift; within the second CUDA stream, performing subband analysis on the microphone near-end signal and far-end reference signal of each frame to generate a set of subband control parameters including subband gating parameters, subband step size parameters, and subband leakage parameters, and a frame-level mode flag, and writing the subband control parameters and frame-level mode flag into the shared memory control packet and recording a synchronization event; within the first CUDA stream, after waiting for the synchronization event to complete, reading the subband control parameters and frame-level mode flag from the shared memory control packet, and within the same frame, performing partitioned blocking frequency domain subband adaptive filtering based on the read subband control parameters and frame-level mode flag to update the filter coefficients and generate echo-suppressed output.

2. The method according to claim 1, characterized in that, Subband analysis includes performing a 512-point Fast Fourier Transform on each frame to obtain the frequency domain spectrum, and dividing the 0 to 8000 Hz frequency band into 32 subbands.

3. The method according to claim 2, characterized in that, The steps for generating sub-band control parameters include calculating the following for each sub-band: For the microphone amplitude sequence and reference amplitude sequence within the sub-band, calculate the 90th percentile for each, and statistically analyze the proportion of samples with amplitudes greater than their respective 90th percentiles to obtain the microphone tail proportion and reference tail proportion; calculate the point-by-point difference between the microphone phase and the reference phase within the sub-band, and statistically analyze the proportion of samples with an absolute difference less than or equal to 20 degrees to obtain the phase consistency rate; statistically analyze the proportion of samples within the sub-band whose microphone amplitude to reference amplitude ratio is between 0.5 and 2 to obtain the amplitude similarity rate; and statistically analyze the proportion of samples with a ratio greater than or equal to 1.5 to obtain the amplitude dominance rate.

4. The method according to claim 3, characterized in that, The steps for generating subband control parameters also include: taking the sum of counts that meet the following three conditions as the far-end dominance evidence score: the absolute value of the tail ratio difference is less than or equal to 0.1, the amplitude similarity rate is greater than or equal to 0.6, and the phase consistency rate is greater than or equal to 0.7; taking the sum of counts that meet the following two conditions as the amplitude dominance rate is greater than or equal to 0.3 and the phase consistency rate is less than 0.7; and forming an α-stable-GLRT determination for the subband by comparing the far-end dominance evidence score with the two-talk evidence score. If the far-end dominance evidence score is greater than the two-talk evidence score, it is determined to be far-end dominance; otherwise, it is determined to be two-talk.

5. The method according to claim 4, characterized in that, The steps for generating subband control parameters also include: calculating the normalized cross-correlation peak value and corresponding hysteresis of the subband; when the peak value is between 0.6 and 1 and the hysteresis is within ±3 frequency points, it is recorded as high coherence; otherwise, it is recorded as low coherence; fusing α-stable-GLRT determination and coherence to generate subband gating parameters, subband step size parameters, and subband leakage parameters, which together constitute the subband control parameters; wherein, when α-stable-GLRT determination is far-end dominant and coherence is high coherence, the subband gating parameter is set to allow updates, and a high-level subband step size parameter and a low-level subband leakage parameter are set.

6. The method according to claim 1, characterized in that, The steps of partitioned blocking frequency domain subband adaptive filtering include: generating a partitioned block sequence by dividing the far-end reference signal frame into blocks of length 512 with 50% overlap, and performing a fast Fourier transform on each partitioned block to obtain the partitioned block frequency domain vector; performing element-wise complex multiplication of all partitioned block frequency domain vectors with their corresponding filter coefficient vectors and summing them element-wise; and performing an inverse fast Fourier transform on the summation result to obtain the echo estimate of the frame.

7. The method according to claim 6, characterized in that, The method also includes, within the first CUDA stream: for each subband, calculating the average energy of the residual signal obtained by subtracting the echo estimate from the microphone near-end signal on that subband, and the average energy of the echo estimate on that subband; Calculate the energy ratio of the average energy of the residual signal to the average energy of the echo estimate; Based on the energy ratio, an error covariance level is determined; where an energy ratio greater than or equal to 2 is marked as high level, an energy ratio in the range of 1 to 2 is marked as medium level, and an energy ratio less than 1 is marked as low level.

8. The method according to claim 7, characterized in that, The steps for updating the filter coefficients include: for each subband, determining a final subband step size parameter and a final subband leakage parameter by combining the subband gating parameters read from the shared memory control package and the locally calculated error covariance level; when the subband gating parameter is update-allowed, calculating a correction vector based on the final subband step size parameter and adding it element-wise to the filter coefficient vector; performing a scaling operation on the filter coefficient vector based on the final subband leakage parameter; when the subband gating parameter is update-disallowed, only a scaling operation is performed.

9. The method according to claim 5, characterized in that, The steps for generating frame-level mode tags within the second CUDA stream include: counting the number of subbands whose subband gating parameters indicate that updates are prohibited; comparing the number with a preset threshold of 16; and setting the frame-level mode tag to either normal mode or low-confidence mode based on the comparison result; wherein, when the number is greater than or equal to 16, it is set to low-confidence mode, otherwise it is set to normal mode.

10. The method according to claim 9, characterized in that, Within the first CUDA stream, the step of updating the filter coefficients is performed according to the frame-level mode marking: when the frame-level mode is marked as normal mode, the correction vector summation and proportional shrinkage operation is performed on all partitions of the partitioned blocking frequency domain adaptive filter; when the frame-level mode is marked as low confidence mode, the correction vector summation and proportional shrinkage operation is performed only on a predetermined subset of all partitions, namely the partitions with indices 0 to 7, and only the proportional shrinkage operation is performed on the remaining partitions.