Data processing method and device, electronic equipment and storage medium
By matching and identifying the serial data of the SPDIF interface with the preset frame header encoding data, the parallel data is directly obtained, which solves the problems of high conversion difficulty and low efficiency in the existing technology, and achieves efficient serial-to-parallel data conversion.
Patent Information
- Application Number
- CN202410602132.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, converting serial data transmitted through the SPDIF interface into parallel data requires professional and technical personnel to write complex programs and set up shift registers, which is difficult and inefficient.
Match the received serial data through preset frame header encoding data, determine the frame header type and perform parallel processing, avoiding setting up shift registers and professional programming, and directly identifying parallel data.
It reduces the difficulty of converting serial data into parallel data, improves conversion efficiency, simplifies the process, and does not require the participation of professional technical personnel.
Smart Images

Figure CN118535121A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art
[0002] SPDIF (Sony / Philips Digital Interface) is a digital signal transmission interface that supports IEC60958 (pcm data) and IEC61937 (non-pcm data). The encoding format uses biphase mark code (BMC), which is a phase modulation encoding method that mixes the clock signal and the data signal together for transmission.
[0003] The SDPIF signal is a single-bit serial audio signal that mixes the clock signal and the data signal together for transmission. The rate is very low, generally at the K level. In order to recover the audio data, i.e., parallel data, from the BMC-encoded data, i.e., serial data, professional technicians are required to write complex programs and set up shift registers for receiving parallel data. This not only consumes a lot of manpower to write programs, but also consumes a lot of time. How to reduce the difficulty of converting serial data into parallel data is an urgent problem to be solved. Summary of the invention
[0004] Some embodiments of the present application aim to provide a data processing method, device, electronic device and storage medium. Through the technical solution of the embodiments of the present application, serial data to be identified sent through the SPDIF interface is received, wherein the serial data to be identified is obtained by bidirectionally symbol encoding the clock signal and the audio data; the serial data to be identified is matched according to preset frame header encoding data; if the serial data to be identified contains the preset frame header encoding data, the frame header type corresponding to the preset frame header encoding data is determined; according to the frame header type, the serial data to be identified is processed in parallel to obtain parallel data. In the embodiments of the present application, the serial data to be identified sent through the SPDIF interface is identified through the preset frame header encoding data, thereby determining the parallel data starting with the preset frame header encoding data. In this way, there is no need to set a shift register and no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves the conversion efficiency.
[0005] In a first aspect, some embodiments of the present application provide a data processing method, including:
[0006] Receiving serial data to be identified sent through the SPDIF interface, wherein the serial data to be identified is obtained by performing bidirectional symbol encoding on a clock signal and audio data;
[0007] Matching the serial data to be identified according to the preset frame header encoding data;
[0008] If the preset frame header coded data exists in the serial data to be identified, determining the frame header type corresponding to the preset frame header coded data;
[0009] According to the frame header type, the serial data to be identified are processed in parallel to obtain parallel data.
[0010] Some embodiments of the present application identify the serial data to be identified sent through the SPDIF interface by using preset frame header encoding data, thereby determining the parallel data starting with the preset frame header encoding data. In this way, there is no need to set up a shift register and no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves the conversion efficiency.
[0011] Optionally, matching the serial data to be identified according to preset frame header encoding data includes:
[0012] Determine the first signal that jumps in the serial data to be identified as the starting frame header position;
[0013] Starting from the starting frame header position, the coded data within the preset byte length is matched with the preset frame header coded data.
[0014] Some embodiments of the present application determine the first signal that jumps in the serial data to be identified as the starting frame header position; starting from the starting frame header position, the encoded data within a preset byte length is matched with the preset frame header encoded data to convert the serial data to be identified.
[0015] Optionally, if the preset frame header coded data exists in the serial data to be identified, determining the frame header type corresponding to the preset frame header coded data includes:
[0016] If the signal at the start frame header position in the serial data to be identified is the same as the first signal of the preset frame header coded data, matching the coded data within the first preset byte length starting from the start frame header position with other signals in the preset frame header coded data;
[0017] If the encoded data within the first preset byte length matches other signals in the preset frame header encoded data, a frame header type corresponding to the preset frame header encoded data is determined.
[0018] Some embodiments of the present application match preset frame header coded data with serial data to be identified that is sent through an SPDIF interface, thereby determining parallel data that begins with the preset frame header coded data.
[0019] Optionally, the performing parallel processing on the serial data to be identified according to the frame header type to obtain parallel data includes:
[0020] Determine the encoded data starting from the preset frame header encoded data and within a second preset byte length as a subframe corresponding to the frame header type;
[0021] The obtained sub-frames corresponding to the different frame header types are determined as the parallel data.
[0022] Some embodiments of the present application use preset frame header coding data to identify serial data to be identified that is sent through an SPDIF interface, thereby determining parallel data that begins with the preset frame header coding data. In this way, there is no need to set up a shift register and no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves conversion efficiency.
[0023] Optionally, the audio data is obtained by sampling at an intermediate moment of the clock signal.
[0024] Some embodiments of the present application obtain audio data by sampling at the middle moment of the clock signal, thereby improving the accuracy of signal sampling.
[0025] Optionally, the method further comprises:
[0026] The subframe corresponding to the first frame header type in the parallel data is compared with the first preset subframe in the serial data to be identified, and the subframe corresponding to the second frame header type in the parallel data is compared with the second preset subframe in the serial data to be identified to obtain a comparison result, and the comparison result is used to judge the performance of the SPDIF interface.
[0027] Some embodiments of the present application compare the subframe corresponding to the first frame header type in the parallel data with the first preset subframe in the serial data to be identified, and compare the subframe corresponding to the second frame header type in the parallel data with the second preset subframe in the serial data to be identified, to obtain a comparison result, and the comparison result is used to judge the performance of the SPDIF interface. If they are the same, it means that the performance of the SPDIF interface is good.
[0028] In a second aspect, some embodiments of the present application provide a data processing device, including:
[0029] A receiving module, used for receiving serial data to be identified sent through the SPDIF interface, wherein the serial data to be identified is obtained by performing bidirectional symbol encoding on a clock signal and audio data;
[0030] A matching module, used for matching the serial data to be identified according to preset frame header encoding data;
[0031] A determination module, configured to determine a frame header type corresponding to the preset frame header coded data if the preset frame header coded data exists in the serial data to be identified;
[0032] The processing module is used to perform parallel processing on the serial data to be identified according to the frame header type to obtain parallel data.
[0033] Some embodiments of the present application identify the serial data to be identified sent through the SPDIF interface by using preset frame header encoding data, thereby determining the parallel data starting with the preset frame header encoding data. In this way, there is no need to set up a shift register and no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves the conversion efficiency.
[0034] Optionally, the matching module is used to:
[0035] Determine the first signal that jumps in the serial data to be identified as the starting frame header position;
[0036] Starting from the starting frame header position, the coded data within the preset byte length is matched with the preset frame header coded data.
[0037] Some embodiments of the present application determine the first signal that jumps in the serial data to be identified as the starting frame header position; starting from the starting frame header position, the encoded data within a preset byte length is matched with the preset frame header encoded data to convert the serial data to be identified.
[0038] Optionally, the determining module is used to:
[0039] If the signal at the start frame header position in the serial data to be identified is the same as the first signal of the preset frame header coded data, matching the coded data within the first preset byte length starting from the start frame header position with other signals in the preset frame header coded data;
[0040] If the encoded data within the first preset byte length matches other signals in the preset frame header encoded data, a frame header type corresponding to the preset frame header encoded data is determined.
[0041] Some embodiments of the present application match preset frame header coded data with serial data to be identified that is sent through an SPDIF interface, thereby determining parallel data that begins with the preset frame header coded data.
[0042] Optionally, the processing module is used to:
[0043] Determine the encoded data starting from the preset frame header encoded data and within a second preset byte length as a subframe corresponding to the frame header type;
[0044] The obtained sub-frames corresponding to the different frame header types are determined as the parallel data.
[0045] Some embodiments of the present application use preset frame header coding data to identify serial data to be identified that is sent through an SPDIF interface, thereby determining parallel data that begins with the preset frame header coding data. In this way, there is no need to set up a shift register and no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves conversion efficiency.
[0046] Optionally, the audio data is obtained by sampling at an intermediate moment of the clock signal.
[0047] Some embodiments of the present application obtain audio data by sampling at the middle moment of the clock signal, thereby improving the accuracy of signal sampling.
[0048] Optionally, the processing module is used to:
[0049] The subframe corresponding to the first frame header type in the parallel data is compared with the first preset subframe in the serial data to be identified, and the subframe corresponding to the second frame header type in the parallel data is compared with the second preset subframe in the serial data to be identified to obtain a comparison result, and the comparison result is used to judge the performance of the SPDIF interface.
[0050] Some embodiments of the present application compare the subframe corresponding to the first frame header type in the parallel data with the first preset subframe in the serial data to be identified, and compare the subframe corresponding to the second frame header type in the parallel data with the second preset subframe in the serial data to be identified, to obtain a comparison result, and the comparison result is used to judge the performance of the SPDIF interface. If they are the same, it means that the performance of the SPDIF interface is good.
[0051] In a third aspect, some embodiments of the present application provide an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can implement the data processing method as described in any embodiment of the first aspect.
[0052] In a fourth aspect, some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the data processing method as described in any embodiment of the first aspect.
[0053] In a fifth aspect, some embodiments of the present application provide a computer program product, wherein the computer program product comprises a computer program, wherein the computer program, when executed by a processor, can implement the data processing method as described in any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions of some embodiments of the present application, the drawings required for use in some embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application;
[0056] Figure 2 A schematic diagram of the SPDIF encoding format provided in an embodiment of the present application;
[0057] Figure 3 A schematic diagram of the IEC60958 data format provided in an embodiment of the present application;
[0058] Figure 4 A schematic diagram of the IEC60958 sub_frame structure provided in an embodiment of the present application;
[0059] Figure 5 A schematic diagram of the encoding timing of three sub_frame frame headers provided in an embodiment of the present application;
[0060] Figure 6 A schematic diagram of the positions of the three sub_frame frame headers in the IEC60958 data format provided in the embodiment of the present application;
[0061] Figure 7 A flowchart of another data processing method provided in an embodiment of the present application;
[0062] Figure 8 A schematic diagram of SPDIF data sampling provided in an embodiment of the present application;
[0063] Fig. 9 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;
[0064] Fig.10 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] The technical solutions in some embodiments of the present application will be described below in conjunction with the drawings in some embodiments of the present application.
[0066] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0067] SPDIF (Sony / Philips Digital Interface) is a digital signal transmission interface that supports IEC60958 (pcm data) and IEC61937 (non-pcm data). The encoding format uses biphase mark code (BMC), which is a phase modulation encoding method that mixes the clock signal and the data signal together for transmission.
[0068] The SDPIF signal is a single-bit serial audio signal that is transmitted by mixing the clock signal and the data signal. The rate is very low, generally at the K level. In order to recover audio data, i.e., parallel data, from the BMC-encoded data, i.e., serial data, professional technicians are required to write complex programs and set shift registers for receiving parallel data. This not only consumes a lot of manpower and material resources to write programs, but also consumes a lot of time. How to improve the efficiency of converting serial data into parallel data is a problem that needs to be solved urgently. In view of this, some embodiments of the present application provide a data processing method, which includes receiving serial data to be identified sent through an SPDIF interface, wherein the serial data to be identified is obtained by bidirectionally symbol encoding a clock signal and audio data; matching the serial data to be identified according to preset frame header encoding data; if there is preset frame header encoding data in the serial data to be identified, determining the frame header type corresponding to the preset frame header encoding data; according to the frame header type, parallel processing is performed on the serial data to be identified to obtain parallel data. In the embodiment of the present application, the serial data to be identified sent through the SPDIF interface is identified by preset frame header encoding data, thereby determining parallel data starting with the preset frame header encoding data. In this way, there is no need to set a shift register, and there is no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves conversion efficiency.
[0069] like Figure 1 As shown, an embodiment of the present application provides a data processing method, the method comprising:
[0070] S101, receiving serial data to be identified sent through an SPDIF interface, wherein the serial data to be identified is obtained by performing bidirectional symbol encoding on a clock signal and audio data;
[0071] Specifically, the terminal device receives the serial data to be identified sent through the SPDIF interface. The SPDIF interface can be a module on the terminal device or on other devices, such as Figure 2 As shown, the clock signal and the audio data are encoded to obtain the serial data to be identified, that is, a serial data is obtained. The specific encoding method is:
[0072] Using a clock frequency twice the transmission bit rate as a reference, the original data is split into two parts. When the data is 1, the potential is changed once (0->1 or 1->0) within the clock cycle to make the data become two different potentials, becoming 10 or 01. When the data is 0, the potential is not changed, becoming 11 or 00. At the same time, the level at the beginning of each bit must be different from the previous end level (except for the first 4 bits of the Preamble), so that the receiving end can distinguish the boundary of each bit. BMC coding can keep the transmission line at an average DC potential close to 0. In addition to reducing the power consumption required for transmission, it can also reduce physical electromagnetic interference and make data more accurate.
[0073] The standard architecture for transmitting left and right channel signals is as follows Figure 3 As shown, the top is a block consisting of 192 frames. Each Frame stores a set of sample signals (sample signals Sample) of two channels, which are divided into two channels, Channel A and Channel B. Each set of sample signals Sample consists of a sub-frame (Sub Frame), that is, there are two Sub Frames in a Frame. The length of the Sub Frame is 32 bits, which includes the frame header (Preamble), auxiliary data (Aux Data), audio data (Audio Data) and 4 bits of information and check code. A Sub Frame is 32 bits, so a Frame is 8 bytes, and a block is 192x8=1536 bytes. Each block can transmit a total of 192 dual-channel sample signals Sample.
[0074] Specifically, the audio data is converted into binary code, and then the binary code and the clock signal are encoded as above to obtain Figure 2 The data in the third line is a serial data, and the terminal device obtains the serial data.
[0075] S102, matching the serial data to be identified according to the preset frame header encoding data;
[0076] Specifically, preset frame header coding data is pre-stored on the terminal device, and the preset frame header coding data is matched with the coding data in the serial data to be identified.
[0077] The preset frame header encoding data may be one or more.
[0078] Exemplarily, the preset frame header encoding data is 11100010, which identifies the frame header of the left channel, and the preset frame header encoding data is 11100100, which identifies the frame header of the right channel. It can also be other binary encodings, which are not specifically limited in the embodiments of the present application.
[0079] The terminal device uses the preset frame header encoding data to match the binary encoding in the serial data to be identified.
[0080] S103, if there is preset frame header coded data in the serial data to be identified, determining a frame header type corresponding to the preset frame header coded data;
[0081] Specifically, the terminal device matches the preset frame header coding data, i.e., the binary code, with the binary code in the serial data to be identified. If the preset frame header coding data exists in the serial data to be identified, the corresponding frame header type is determined according to the preset frame header coding data, for example, whether it is left channel data or right channel data, or the frame header of a block.
[0082] S104 . According to the frame header type, the serial data to be identified is processed in parallel to obtain parallel data.
[0083] Specifically, after identifying the frame header, the terminal device splits the data of the preset byte length connected after the frame header, that is, converts a serial data into parallel data.
[0084] Some embodiments of the present application identify the serial data to be identified sent through the SPDIF interface by using preset frame header encoding data, thereby determining the parallel data starting with the preset frame header encoding data. In this way, there is no need to set up a shift register and no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves the conversion efficiency.
[0085] Another embodiment of the present application further supplements the data processing method provided in the above embodiment.
[0086] Optionally, matching the serial data to be identified according to the preset frame header encoding data includes:
[0087] The first signal that jumps in the serial data to be identified is determined as the starting frame header position;
[0088] Starting from the start frame header position, the coded data within the preset byte length is matched with the preset frame header coded data.
[0089] Some embodiments of the present application determine the first signal that jumps in the serial data to be identified as the starting frame header position; starting from the starting frame header position, the encoded data within a preset byte length is matched with the preset frame header encoded data to convert the serial data to be identified.
[0090] Optionally, if there is preset frame header coded data in the serial data to be identified, determining the frame header type corresponding to the preset frame header coded data includes:
[0091] If the signal at the start frame header position in the serial data to be identified is the same as the first signal of the preset frame header coded data, matching the coded data within the first preset byte length starting from the start frame header position with other signals in the preset frame header coded data;
[0092] If the coded data within the first preset byte length matches other signals in the preset frame header coded data, the frame header type corresponding to the preset frame header coded data is determined.
[0093] like Figure 4 As shown, the structure of the sub-frame (Sub Frame) and the meaning of each part are as follows:
[0094] 0-3 Preamble: used to indicate the beginning of a sub-frame. There are three types, indicating that the sub-frame is Channel A, Channel B, or the starting sub-frame of a block (Channel A).
[0095] 4-7 Auxiliary Data (Aux.Data): This block was originally designed to transmit some information added by the user. However, its more common use is that when the audio data exceeds 20 bits of sampling, these four bits are used to store the extra sampling bits. For example, when 24 bits of sampling data are to be transmitted, the last four bits of audio data are used to store them.
[0096] 8-27 Audio Data: Stores the actual sampling data, with a length of 20 bits, and is transmitted in LSB first mode. When the sampling is less than 20 bits, the unused LSB bits should be set to zero. For example, when we want to transmit 16-bit data, only the 12-27 bits will be used (LSB is at 12 bits), and 8-11 bits will be zero.
[0097] 28 Validity Bit: This bit sets whether the data in this sub-frame is correct. If it is set to 0, it means that the data in this sub-frame is correct and can be received. On the contrary, if this bit is 1, it means that the receiving end should ignore this group of sub-frames. For example, when a CD turntable reads CD data, if a certain sample signal Sample cannot be read, the valid bit in the sub-frame Sub Frame representing the group of sample signals Sample will be set to 1.
[0098] 29 User Bit: This bit is defined by the user. One bit is transmitted for each set of sample signals until 192 sets of sample signals are transmitted to form 192 bits of information. Each of the two channels has a set of 192 bits of user information.
[0099] 30 Channel Status Bit: This bit is the same as the user bit. Each sample signal Sample transmits one bit, and finally forms a 192-bit channel status information (Channel Status) for each of the two channels. This 192-bit channel status information is divided into two different structures: professional and consumer. The first bit determines it. When it is set to 1, it is the Professional mode, and when it is set to 0, it is the Consumer mode.
[0100] 31 Parity Bit: Parity check is used to determine whether there is an odd number of bits with errors. It is a simple error checking method. Here, even parity check is used.
[0101] Definition of the preamble in a subframe:
[0102] like Figure 5As shown in the figure, the frame header is used to indicate the beginning of a subframe. There are three main configurations: B, M, and W (or Z, X, and Y), each representing a different meaning. M represents that the A channel (left channel) is being transmitted at this time, W represents that the B channel (right channel) is being transmitted at this time, and B is special, representing that the A channel is being transmitted at this time, and it is the starting subframe of a Block.
[0103]
[0104] Table 1
[0105] The data values in Table 1 are the data values added to the front of the entire Sub Frame after the other data in the Sub Frame is encoded by BMC, so there are eight codes in total, representing the timing of four bits. In addition, in addition to the three configurations of X, Y, and Z, the above table also lists another set of values that are opposite to the original data. Which set of values to use depends on the level at the end of the previous group of Sub Frames. When the previous group of Sub Frames is the last level 0, use the left column of values, and when it is 1, use the right column, so that the receiving end can process it correctly.
[0106] In a block, when Preamble is configured as Z, it represents the starting point of a block, such as Figure 6 shown.
[0107] Some embodiments of the present application match preset frame header coded data with serial data to be identified that is sent through an SPDIF interface, thereby determining parallel data that begins with the preset frame header coded data.
[0108] Optionally, according to the frame header type, the serial data to be identified is processed in parallel to obtain parallel data, including:
[0109] Determine the encoded data starting from the preset frame header encoded data and within the second preset byte length as a subframe corresponding to the frame header type;
[0110] The obtained sub-frames corresponding to the different frame header types are determined as parallel data.
[0111] like Figure 7As shown, in the digital chip including the SPDIF interface, the SPDIF sending module (SPDIF_TX) encodes the input left and right channel parallel 32-bit SPDIF data streams (spdif_left_data[31:0] and spdif_right_data[31:0] correspond to a sub_frame of the left and right channels respectively) into a single-bit SPDIF data stream according to the above protocol and sends it out from the SPDIF interface (spdif_out), that is, encodes the parallel data to obtain a serial data, i.e., the serial data to be identified. Then, during the chip design phase, it is necessary to verify whether the serial data sent by the SPDIF interface has completely and correctly implemented data encoding according to the protocol. It is necessary to develop a monitor (spdif_monitor) to reversely restore the single-bit SPDIF serial data into left and right channel parallel data according to the protocol, that is, the parallel data includes spdif_left_data_out[31:0] corresponding to the left channel sub_frame, spdif_right_data_out[31:0] corresponding to the right channel sub_frame, and then compare it frame by frame with the expected data, that is, the input signal on the left side of the digital chip containing the SPDIF interface, spdif_left_data[31:0] and spdif_right_data[31:0], and determine whether they are consistent.
[0112] Some embodiments of the present application use preset frame header coding data to identify serial data to be identified that is sent through an SPDIF interface, thereby determining parallel data that begins with the preset frame header coding data. In this way, there is no need to set up a shift register and no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves conversion efficiency.
[0113] Optionally, the audio data is sampled at an intermediate moment of the clock signal.
[0114] like Figure 8 As shown in the figure, because the SPDIF data transmission rate is known by the register configuration in the chip, the clock frequency and clock period are determined. Figure 8 By sampling the SPDIF serial data at the middle dotted line, the complete encoded data can be obtained, and then the encoded data is decoded according to the SPDIF protocol to obtain the final left and right channel SPDIF frame data.
[0115] Some embodiments of the present application obtain audio data by sampling at the middle moment of the clock signal, thereby improving the accuracy of signal sampling.
[0116] Optionally, the method further comprises:
[0117] The subframe corresponding to the first frame header type in the parallel data is compared with the first preset subframe in the serial data to be identified, and the subframe corresponding to the second frame header type in the parallel data is compared with the second preset subframe in the serial data to be identified to obtain a comparison result, which is used to judge the performance of the SPDIF interface.
[0118] like Figure 7 As shown in the figure, at the input end of the SPDIF_TX module, the SPDIF data (including the clock signal and the left and right channel SPDIF frame data) is neatly arranged in sub_frame and input to the SPDIF_TX module. Therefore, the first signal jump output from the SPDIF_TX output interface spdif_out should be the starting frame header position of the first sub_frame. The following 8 codes are the frame header code, corresponding to the 4-bit frame header (Preamble) data of the sub_frame. The following 28*2 codes are the other 28-bit data codes of the sub_frame except the frame header, as shown in the figure. Figure 4 As shown above, a sub-frame sub_frame can be obtained.
[0119] The next 32*2 codes correspond to the next sub-frame sub_frame frame, and so on, you can get each sub-frame sub_frame, frame frame and block block data, such as Figure 3 shown.
[0120] Finally, the left and right channel data parsed by spdif_monior can be compared frame by frame with the left and right channel data of the SPDIF_TX input end to determine whether the SPDIF_TX module function is correct.
[0121] The basic syntax is as follows:
[0122] / / Key data definition
[0123] bit[7:0]act_pre=0; / / sub_frame frame header encoding;
[0124] int clk_dly=N; / / clk_dly represents Figure 8 When the clock duty cycle is 50%, clk_dly is equal to the delay of the rising edge or falling edge.
[0125] bit[1:0]tx_out=0; / / 2-bit SPDIF encoding corresponding to 1-bit data, such as Figure 2 As shown;
[0126] int act_spdif_out[2]; / / decoded left and right channel sub_frame
[0127] / / Core code
[0128] while(1)begin
[0129] @(spdif_out); / / Wait for the first transition of spdif_out signal
[0130] / / Get the 4-bit frame header data of sub_frame
[0131] for(int y=0;y<8;y++)begin
[0132] #(clk_dly / 2); / / This moment corresponds to Figure 8 The first red line position
[0133] act_pre[y] = spdif_out; / / assign the first coded data to act_pre[y]
[0134] if(y<7)#(clk_dly / 2); / / Approximately at the rising or falling edge of the clock
[0135] end
[0136] At this time, act_pre[7:0] is the complete frame header code, and then according to Figure 5 The frame header encoding rules are translated into 4-bit X / Y / Z data codes and placed in the lower 4 bits of the corresponding act_spdif_out array.
[0137] tx_out[1] = spdif_out; / / 2nd bit of data 2-bit encoding
[0138] / / Get the remaining 28 bits of data of sub_frame except the frame header
[0139] repeat(28)begin
[0140] @(spdif_out); / / spdif_out signal 0->1 or 1->0 jump
[0141] #(clk_dly / 2);
[0142] tx_out[0] = spdif_out; / / 1st bit of 2-bit data encoding
[0143] if (tx_out[0]!=tx_out[1]) error occurs, does not comply with SPDIF encoding rules, and each data is flipped once
[0144] #(clk_dly);
[0145] tx_out[1] = spdif_out; / / 2nd bit of data 2-bit encoding
[0146] act_spdif_out[0 / 1][corresponding bit]=(tx_out[1]!=tx_out[0])? 1:0;
[0147] end / / repeat
[0148] At this point, a left or right channel sub_frame is obtained completely and compared with the left and right channel sub_frames corresponding to the sequence at the SPDIF_TX input terminal;
[0149] end / / while
[0150] In the embodiment of the present application, an SPDIF monitor is provided, which is mounted on the SPDIF serial output signal, and can decode the complete SPDIF data in real time and automatically compare. If the frame header is not aligned to the output, it is only necessary to add a frame header search logic in front according to the principle described in the scheme.
[0151] The SPDIF monitor implementation method is concise, intuitive and efficient, and has been successfully applied to the actual verification of multiple SPDIF module chips. It has strong versatility and reusability, greatly improving the verification quality and efficiency and shortening the verification cycle.
[0152] The SPDIF monitor implementation method provided in the embodiment of the present application is directly based on the SPDIF protocol and is written in the System Verilog language commonly used in digital chip verification. It is concise, intuitive and efficient, has strong readability, versatility and reusability, can greatly improve the verification quality and efficiency, and shorten the verification cycle.
[0153] Some embodiments of the present application compare the subframe corresponding to the first frame header type in the parallel data with the first preset subframe in the serial data to be identified, and compare the subframe corresponding to the second frame header type in the parallel data with the second preset subframe in the serial data to be identified, to obtain a comparison result, and the comparison result is used to judge the performance of the SPDIF interface. If they are the same, it means that the performance of the SPDIF interface is good.
[0154] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any combination without conflict, and this application is not limited thereto.
[0155] Another embodiment of the present application provides a data processing device for executing the data processing method provided in the above embodiment.
[0156] like Fig. 9 , which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. The data processing device includes a receiving module 901, a matching module 902, a determining module 903 and a processing module 904, wherein:
[0157] The receiving module 901 is used to receive the serial data to be identified sent through the SPDIF interface, wherein the serial data to be identified is obtained by performing bidirectional symbol encoding on the clock signal and the audio data;
[0158] The matching module 902 is used to match the serial data to be identified according to the preset frame header encoding data;
[0159] The determination module 903 is used to determine the frame header type corresponding to the preset frame header encoding data if the preset frame header encoding data exists in the serial data to be identified;
[0160] The processing module 904 is used to perform parallel processing on the serial data to be identified according to the frame header type to obtain parallel data.
[0161] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0162] Some embodiments of the present application identify the serial data to be identified sent through the SPDIF interface by using preset frame header encoding data, thereby determining the parallel data starting with the preset frame header encoding data. In this way, there is no need to set up a shift register and no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves the conversion efficiency.
[0163] Another embodiment of the present application further supplements the data processing device provided in the above embodiment.
[0164] Optionally, the matching module is used to:
[0165] The first signal that jumps in the serial data to be identified is determined as the starting frame header position;
[0166] Starting from the start frame header position, the coded data within the preset byte length is matched with the preset frame header coded data.
[0167] Some embodiments of the present application determine the first signal that jumps in the serial data to be identified as the starting frame header position; starting from the starting frame header position, the encoded data within a preset byte length is matched with the preset frame header encoded data to convert the serial data to be identified.
[0168] Optionally, a module is determined to:
[0169] If the signal at the start frame header position in the serial data to be identified is the same as the first signal of the preset frame header coded data, matching the coded data within the first preset byte length starting from the start frame header position with other signals in the preset frame header coded data;
[0170] If the coded data within the first preset byte length matches other signals in the preset frame header coded data, the frame header type corresponding to the preset frame header coded data is determined.
[0171] Some embodiments of the present application match preset frame header coded data with serial data to be identified that is sent through an SPDIF interface, thereby determining parallel data that begins with the preset frame header coded data.
[0172] Optionally, the processing module is used to:
[0173] Determine the encoded data starting from the preset frame header encoded data and within the second preset byte length as a subframe corresponding to the frame header type;
[0174] The obtained sub-frames corresponding to the different frame header types are determined as parallel data.
[0175] Some embodiments of the present application use preset frame header coding data to identify serial data to be identified that is sent through an SPDIF interface, thereby determining parallel data that begins with the preset frame header coding data. In this way, there is no need to set up a shift register and no need for professional technicians to perform programming, which reduces the difficulty of converting serial data into parallel data and improves conversion efficiency.
[0176] Optionally, the audio data is sampled at an intermediate moment of the clock signal.
[0177] Some embodiments of the present application obtain audio data by sampling at the middle moment of the clock signal, thereby improving the accuracy of signal sampling.
[0178] Optionally, the processing module is used to:
[0179] The subframe corresponding to the first frame header type in the parallel data is compared with the first preset subframe in the serial data to be identified, and the subframe corresponding to the second frame header type in the parallel data is compared with the second preset subframe in the serial data to be identified to obtain a comparison result, which is used to judge the performance of the SPDIF interface.
[0180] Some embodiments of the present application compare the subframe corresponding to the first frame header type in the parallel data with the first preset subframe in the serial data to be identified, and compare the subframe corresponding to the second frame header type in the parallel data with the second preset subframe in the serial data to be identified, to obtain a comparison result, and the comparison result is used to judge the performance of the SPDIF interface. If they are the same, it means that the performance of the SPDIF interface is good.
[0181] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0182] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any combination without conflict, and this application is not limited thereto.
[0183] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the operation of the method corresponding to any embodiment of the data processing method provided in the above embodiments can be implemented.
[0184] An embodiment of the present application further provides a computer program product, wherein the computer program product includes a computer program, wherein when the computer program is executed by a processor, it can implement the operations of the method corresponding to any embodiment of the data processing method provided in the above embodiments.
[0185] like Fig.10 As shown, some embodiments of the present application provide an electronic device 1000, which includes: a memory 1010, a processor 1020, and a computer program stored in the memory 1010 and executable on the processor 1020, wherein the processor 1020 can implement a method of any embodiment included in the above-mentioned data processing method when reading the program from the memory 1010 through a bus 1030 and executing the program.
[0186] Processor 1020 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 1020 can be a microprocessor.
[0187] The memory 1010 may be used to store instructions executed by the processor 1020 or data related to the execution of instructions. These instructions and / or data may include codes for implementing some or all functions of one or more modules described in the embodiments of the present application. The processor 1020 of the disclosed embodiment may be used to execute instructions in the memory 1010 to implement the method shown above. The memory 1010 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory, or other memory known to those skilled in the art.
[0188] The above are only embodiments of the present application and are not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0189] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0190] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A data processing method, characterized in that: The method comprises: Receiving serial data to be identified sent through the SPDIF interface, wherein the serial data to be identified is obtained by performing bidirectional symbol encoding on a clock signal and audio data; Matching the serial data to be identified according to the preset frame header encoding data; If the preset frame header coded data exists in the serial data to be identified, determining the frame header type corresponding to the preset frame header coded data; According to the frame header type, the serial data to be identified are processed in parallel to obtain parallel data.
2. The data processing method according to claim 1, characterized in that: The matching of the serial data to be identified according to the preset frame header encoding data includes: Determine the first signal that jumps in the serial data to be identified as the starting frame header position; Starting from the starting frame header position, the coded data within the preset byte length is matched with the preset frame header coded data.
3. The data processing method according to claim 2, characterized in that: If the preset frame header coded data exists in the serial data to be identified, determining the frame header type corresponding to the preset frame header coded data includes: If the signal at the start frame header position in the serial data to be identified is the same as the first signal of the preset frame header coded data, matching the coded data within the first preset byte length starting from the start frame header position with other signals in the preset frame header coded data; If the encoded data within the first preset byte length matches other signals in the preset frame header encoded data, a frame header type corresponding to the preset frame header encoded data is determined.
4. The data processing method according to claim 3, characterized in that: The step of performing parallel processing on the serial data to be identified according to the frame header type to obtain parallel data includes: Determine the encoded data starting from the preset frame header encoded data and within a second preset byte length as a subframe corresponding to the frame header type; The obtained sub-frames corresponding to the different frame header types are determined as the parallel data.
5. The data processing method according to claim 1, characterized in that: The audio data is obtained by sampling at the middle moment of the clock signal.
6. The data processing method according to claim 1, characterized in that: The method further comprises: The subframe corresponding to the first frame header type in the parallel data is compared with the first preset subframe in the serial data to be identified, and the subframe corresponding to the second frame header type in the parallel data is compared with the second preset subframe in the serial data to be identified to obtain a comparison result, and the comparison result is used to judge the performance of the SPDIF interface.
7. A data processing device, characterized in that: The device comprises: A receiving module, used for receiving serial data to be identified sent through the SPDIF interface, wherein the serial data to be identified is obtained by performing bidirectional symbol encoding on a clock signal and audio data; A matching module, used for matching the serial data to be identified according to preset frame header encoding data; A determination module, configured to determine a frame header type corresponding to the preset frame header coded data if the preset frame header coded data exists in the serial data to be identified; The processing module is used to perform parallel processing on the serial data to be identified according to the frame header type to obtain parallel data.
8. The data processing device according to claim 7, characterized in that: The matching module is used for: Determine the first signal that jumps in the serial data to be identified as the starting frame header position; Starting from the starting frame header position, the coded data within the preset byte length is matched with the preset frame header coded data.
9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor can implement the data processing method described in any one of claims 1 to 6 when executing the program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the program, when executed by a processor, can implement the data processing method described in any one of claims 1 to 6.
