Data processing method and device
By updating the initialization vector to remove the pseudo-start code during the video stream encryption process, the problems of low security and waste of system resources in the prior art are solved, and higher security and resource savings are achieved.
Patent Information
- Application Number
- CN202411550816.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, the initialization vector used when encrypting video code streams remains unchanged, resulting in low security in code stream encryption, and frequent addition and removal of anti-counterfeiting codes lead to wasting system resources, affecting performance.
By obtaining a code stream that does not contain anti-counterfeiting code, the encrypted basic unit in the code stream is processed, the initialization vector is updated to remove the pseudo-start code, until the basic unit does not contain the pseudo-start code after encryption, and then the encrypted code stream is sent.
It improves the security of the code stream, reduces the consumption of system resources, and ensures the privacy, accuracy and real-timeness of the code stream processing on the code side.
Smart Images

Figure CN119603482A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of multimedia, and in particular to a data processing method and device. Background Art
[0002] With the promotion of digital video applications (such as broadcast digital television, video transmission on the Internet, video real-time conversation applications, video content storage, video content acquisition and editing systems, and other applications involving digital video), video encoding through encoders and video decoding through decoders are widely used. Among them, video encoding refers to the encoder compressing the video based on the compression algorithm, and the encoded bit stream is more convenient for storage and transmission. Video decoding refers to the decoder decoding the bit stream to obtain the reconstructed video.
[0003] In the related art, a security parameter is used to encrypt and protect the code stream. The initialization vector used for encryption in the security parameter remains unchanged, resulting in low code stream encryption security. The security of the code stream and the accuracy of encoding and decoding are guaranteed by adding an anti-counterfeiting code (such as 0x03), to prevent the occurrence of pseudo start codes in the code stream and cause decoding errors. Among them, since there are multiple processes of adding and removing anti-counterfeiting codes, each process of adding and removing anti-counterfeiting codes involves the search and movement of anti-counterfeiting codes, resulting in a waste of system resources and affecting the overall performance. Summary of the invention
[0004] The present application provides a data processing method and device, thereby saving system resources and improving the security of code streams.
[0005] In a first aspect, a data processing method is provided, the method comprising: obtaining a code stream that does not contain an anti-counterfeiting code, processing an encrypted basic unit in the code stream to obtain a first encrypted basic unit; when the first encrypted basic unit contains a pseudo start code, updating a first initialization vector (IV) in a security parameter used to process the encrypted basic unit, using an updated second initialization vector and a key contained in the security parameter to process the encrypted basic unit again, and when the second encrypted basic unit does not contain the pseudo start code, sending an encrypted code stream, the encrypted code stream containing the second encrypted basic unit.
[0006] The data processing method provided by the present application, when the encrypted basic unit contains a pseudo start code, reprocesses the encrypted basic unit according to the updated initialization vector by updating the initialization vector in the security parameter, the updated encrypted basic unit does not contain the pseudo start code, and sends the updated encrypted basic unit. Since the initialization vector is updated, different encryption basic units may correspond to different initialization vectors, that is, different encryption basic units in the code stream may be processed using a variety of different initialization vectors, thereby improving the security of the code stream. In addition, there is no need to insert and remove anti-counterfeiting codes multiple times, which reduces the system resource consumption of operations such as searching, inserting, deleting anti-counterfeiting codes and byte offsets, effectively saving system resources and ensuring the privacy, accuracy and real-time performance of the code stream processed by the encoding end.
[0007] In a possible implementation, the method further includes: when the second encrypted basic unit includes a pseudo start code, updating the first initialization vector to obtain a third initialization vector, processing the encrypted basic unit of the code stream according to the third initialization vector and the key included in the third security parameter to obtain the third encrypted basic unit; when the third encrypted basic unit does not include the pseudo start code, sending the encrypted code stream, the encrypted code stream includes the third encrypted basic unit, and when the third encrypted basic unit includes the pseudo start code, updating the first initialization vector to obtain a fourth initialization vector.
[0008] In another possible implementation, the method further includes: when the n-1th encrypted basic unit includes a pseudo start code, updating the first initialization vector to obtain the nth initialization vector, processing the encrypted basic unit of the code stream according to the nth initialization vector and the key included in the nth security parameter to obtain the nth encrypted basic unit; when the nth encrypted basic unit does not include the pseudo start code, sending the encrypted code stream, and the encrypted code stream includes the nth encrypted basic unit.
[0009] In another possible implementation, the method further includes: when the nth encrypted basic unit includes a pseudo start code, updating the first initialization vector to obtain the n+1th initialization vector; processing the encrypted basic unit of the code stream according to the n+1th initialization vector and the key included in the n+1th security parameter to obtain the n+1th encrypted basic unit; when the n+1th encrypted basic unit does not include the pseudo start code, sending an encrypted code stream, the encrypted code stream including the n+1th encrypted basic unit.
[0010] Wherein, n is a positive integer greater than or equal to 3.
[0011] Thus, the initialization vector is further updated multiple times, so that the updated encrypted basic unit does not contain the pseudo start code, and the updated encrypted basic unit is sent. There is no need to insert and remove the anti-counterfeiting code multiple times, which reduces the system resource consumption of operations such as searching, inserting, deleting anti-counterfeiting codes and byte offsets, and effectively saves system resources.
[0012] In another possible implementation manner, the method further includes: sending an encrypted code stream when the first encrypted basic unit does not include the pseudo start code, the encrypted code stream including the first encrypted basic unit.
[0013] Therefore, when the basic unit does not contain a pseudo start code after the first encryption, there is no need to update the initialization vector, which effectively saves system resources.
[0014] In another possible implementation, the code stream includes multiple encryption basic units, and the encryption code stream includes an encrypted basic unit obtained by processing the encryption basic unit using a first initialization vector, and an encrypted basic unit obtained by processing the encryption basic unit using an updated initialization vector.
[0015] In another possible implementation manner, the leading data of the n-1th encrypted basic unit includes the n-1th initialization vector.
[0016] In another possible implementation, the encrypted code stream includes extended enhancement information, and the extended enhancement information includes the n-1th initialization vector, and the starting position and length of the n-1th encrypted basic unit.
[0017] In another possible implementation, the encrypted code stream includes extended enhancement information, and the extended enhancement information includes the n-1th initialization vector and the n-1th encrypted basic unit.
[0018] The updated initialization vector is directly bound to the encryption basic unit, so as to quickly obtain the initialization vector used by the encryption basic unit, which is more efficient.
[0019] In another possible implementation manner, the leading data of the n-1th encrypted basic unit includes a variation factor for generating the n-1th initialization vector.
[0020] In another possible implementation, the encrypted code stream includes extended enhancement information, and the extended enhancement information includes a change factor for generating the (n-1)th initialization vector.
[0021] Wherein, when the leading data includes a variation factor for generating the n-1th initialization vector, the variation factor is used to generate the n-1th initialization vector. For example, the variation factor includes a random seed or a starting position and length of the n-1th encrypted basic unit.
[0022] When the extended enhancement information includes a change factor for generating the n-1th initialization vector, the change factor is used to locate the n-1th encrypted basic unit and generate the n-1th initialization vector. For example, the change factor includes the starting position and length of the n-1th encrypted basic unit. For another example, the change factor includes a random seed for generating the n-1th initialization vector and the starting position and length of the n-1th encrypted basic unit, and the starting position and length of the n-1th encrypted basic unit are used to locate the n-1th encrypted basic unit.
[0023] The change factor of the updated initialization vector is directly bound to the encryption basic unit, which reduces the amount of transmitted data and reduces bandwidth consumption. In addition, it is convenient to quickly obtain the initialization vector used by the encryption basic unit, which is more efficient.
[0024] If there is no need to update the initialization vector of the initial configuration, there is no need to set the updated initialization vector or change factor in the leading data or extended enhancement information, that is, the leading data or extended enhancement information does not include the initialization vector or change factor, which means that the first initialization vector of the initial configuration is used to encrypt the encryption basic unit, thereby reducing system resource consumption.
[0025] In another possible implementation, updating the first initialization vector to obtain the n-1th initialization vector includes: incrementally generating the n-1th initialization vector according to the first initialization vector.
[0026] In another possible implementation, updating the first initialization vector to obtain the n-1th initialization vector includes: generating the n-1th initialization vector according to an identifier of the encryption basic unit, where the identifier of the encryption basic unit includes a starting position and a length of the encryption basic unit.
[0027] In another possible implementation, the encryption basic unit is any one of a network abstraction layer (NAL), a layer unit (LU) or an access unit (AU).
[0028] Encryption basic units of different sizes are set to improve the usability of the data processing method provided in this application.
[0029] In a second aspect, a data processing method is provided, including: receiving an encrypted code stream, the encrypted code stream including encrypted basic units and security parameters, the security parameters including an initialization vector or a changing factor for generating the initialization vector; decrypting the encrypted basic unit according to the security parameters to obtain a decrypted encrypted basic unit, and decoding the decrypted encrypted basic unit to obtain decoded data.
[0030] Therefore, different encryption basic units correspond to different initialization vectors, that is, different initialization vectors may be used to decrypt different encryption basic units, thereby improving the security of the code stream. In addition, there is no need to insert and remove anti-counterfeiting codes multiple times, which reduces the system resource consumption of operations such as searching, inserting, deleting anti-counterfeiting codes and byte offsets at the decoding end, effectively saving system resources and ensuring the privacy, accuracy and real-time performance of the code stream processed by the encoding end.
[0031] In a possible implementation manner, the leading data of the encrypted basic unit includes an initialization vector or a variation factor.
[0032] In another possible implementation, the encrypted code stream includes extended enhancement information, and the extended enhancement information includes a variation factor or an initialization vector and a starting position and a length of the encrypted basic unit.
[0033] In another possible implementation manner, the method further includes: generating an initialization vector according to the variation factor.
[0034] In another possible implementation, the security parameter further includes an identifier of a key, and the key is used to decrypt the encrypted basic unit.
[0035] In a third aspect, a data processing device is provided, wherein the data processing device comprises modules for executing the method of the first aspect or any possible design of the first aspect. For example, the data processing device comprises a communication module and an encryption module.
[0036] A communication module is used to obtain a code stream, which does not contain an anti-counterfeiting code; an encryption module is used to process the encryption basic unit of the code stream according to a first security parameter to obtain a first encrypted basic unit, the first security parameter includes a first initialization vector and a key; when the first encrypted basic unit includes a pseudo start code, the first initialization vector is updated to obtain a second initialization vector; the encryption basic unit is processed according to a second security parameter to obtain a second encrypted basic unit, the second security parameter includes a second initialization vector and a key; the communication module is used to send an encrypted code stream when the second encrypted basic unit does not contain a pseudo start code, and the encrypted code stream includes the second encrypted basic unit.
[0037] Optionally, the data processing device further includes an encoding module, configured to encode the video acquired through the communication module to obtain a code stream.
[0038] In a possible implementation, the method further includes: when the n-1th encrypted basic unit includes a pseudo start code, updating the first initialization vector to obtain the nth initialization vector, processing the encrypted basic unit of the code stream according to the nth initialization vector and the key included in the nth security parameter to obtain the nth encrypted basic unit; when the nth encrypted basic unit does not include the pseudo start code, sending the encrypted code stream, and the encrypted code stream includes the nth encrypted basic unit.
[0039] In another possible implementation, the method further includes: when the nth encrypted basic unit includes a pseudo start code, updating the first initialization vector to obtain the n+1th initialization vector; processing the encrypted basic unit of the code stream according to the n+1th initialization vector and the key included in the n+1th security parameter to obtain the n+1th encrypted basic unit; when the n+1th encrypted basic unit does not include the pseudo start code, sending an encrypted code stream, the encrypted code stream including the n+1th encrypted basic unit.
[0040] Wherein, n is a positive integer greater than or equal to 3.
[0041] In another possible implementation manner, the method further includes: sending an encrypted code stream when the first encrypted basic unit does not include the pseudo start code, the encrypted code stream including the first encrypted basic unit.
[0042] In another possible implementation, the code stream includes multiple encryption basic units, and the encryption code stream includes an encrypted basic unit obtained by processing the encryption basic unit using a first initialization vector, and an encrypted basic unit obtained by processing the encryption basic unit using an updated initialization vector.
[0043] In another possible implementation manner, the leading data of the n-1th encrypted basic unit includes the n-1th initialization vector.
[0044] In another possible implementation, the encrypted code stream includes extended enhancement information, and the extended enhancement information includes the n-1th initialization vector, and the starting position and length of the n-1th encrypted basic unit.
[0045] In another possible implementation, the encrypted code stream includes extended enhancement information, and the extended enhancement information includes the n-1th initialization vector and the n-1th encrypted basic unit.
[0046] In another possible implementation manner, the leading data of the n-1th encrypted basic unit includes a variation factor for generating the n-1th initialization vector.
[0047] In another possible implementation, the encrypted code stream includes extended enhancement information, and the extended enhancement information includes a change factor for generating the (n-1)th initialization vector.
[0048] In another possible implementation, the variation factor for generating the (n-1)th initialization vector includes the starting position and length of the (n-1)th encrypted basic unit.
[0049] The extended enhancement information includes a change factor for generating the n-1th initialization vector, and the change factor is used to locate the n-1th encrypted basic unit and generate the n-1th initialization vector. Alternatively, the change factor includes a random seed for generating the n-1th initialization vector and a starting position and length of the n-1th encrypted basic unit. The starting position and length of the n-1th encrypted basic unit are used to locate the n-1th encrypted basic unit.
[0050] In another possible implementation, updating the first initialization vector to obtain the n-1th initialization vector includes: incrementally generating the n-1th initialization vector according to the first initialization vector.
[0051] In another possible implementation, updating the first initialization vector to obtain the n-1th initialization vector includes: generating the n-1th initialization vector according to an identifier of the encryption basic unit, where the identifier of the encryption basic unit includes a starting position and a length of the encryption basic unit.
[0052] In another possible implementation, the encryption basic unit is any one of NAL, LU or AU.
[0053] In a fourth aspect, a data processing device is provided, wherein the data processing device comprises modules for executing the method of the second aspect or any possible design of the second aspect. For example, the data processing device comprises a communication module and a decryption module.
[0054] The communication module is used to receive an encrypted code stream, the encrypted code stream includes an encrypted basic unit and a security parameter, the security parameter includes an initialization vector or a change factor for generating an initialization vector; the decryption module is used to decrypt the encrypted basic unit according to the security parameter to obtain a decrypted encrypted basic unit. Optionally, the data processing device also includes a decoding module, which is used to decode the decrypted encrypted basic unit to obtain decoded data.
[0055] In a possible implementation manner, the leading data of the encrypted basic unit includes an initialization vector or a variation factor.
[0056] In another possible implementation, the encrypted code stream includes extended enhancement information, and the extended enhancement information includes a variation factor or an initialization vector and a starting position and a length of the encrypted basic unit.
[0057] In another possible implementation manner, the method further includes: generating an initialization vector according to the variation factor.
[0058] In another possible implementation, the security parameter further includes an identifier of a key, and the key is used to decrypt the encrypted basic unit.
[0059] In a fifth aspect, an encoder is provided, comprising at least one processor and a memory, wherein the memory is used to store a computer program so that when the computer program is executed by at least one processor, the method described in the first aspect or any possible design of the first aspect is implemented.
[0060] In a possible implementation, the encoder further includes an encryption module, and the encryption module is used to encrypt the code stream.
[0061] In a sixth aspect, a decoder is provided, comprising at least one processor and a memory, wherein the memory is used to store a computer program so that when the computer program is executed by at least one processor, the method described in the second aspect or any possible design of the second aspect is implemented.
[0062] In a possible implementation, the decoder further includes a decryption module, and the decryption module is used to decrypt the encrypted code stream.
[0063] In a seventh aspect, a coding and decoding system is provided, which comprises the encoder as described in the fifth aspect and the decoder as described in the sixth aspect.
[0064] In an eighth aspect, a chip is provided, comprising: a processor and a power supply circuit; wherein the power supply circuit is used to supply power to the processor; the processor is used to execute the operation steps of the method in the first aspect or any possible implementation of the first aspect, and execute the operation steps of the method in the second aspect or any possible implementation of the second aspect.
[0065] In a ninth aspect, a computer program product is provided, which includes a computer program or instructions. When the computer program product runs on a processor, the processor executes the operating steps of the method in the first aspect or any possible implementation of the first aspect, or executes the operating steps of the method in the second aspect or any possible implementation of the second aspect.
[0066] In a tenth aspect, a computer-readable storage medium is provided, comprising: computer software instructions; when the computer software instructions are executed in a computing device, the computing device executes the operating steps of the method in the first aspect or any possible implementation of the first aspect, or executes the operating steps of the method described in the second aspect or any possible implementation of the second aspect.
[0067] The computer-readable storage medium includes an encrypted code stream obtained by implementing the method described in the first aspect or any possible design of the first aspect when executed.
[0068] In an eleventh aspect, a code stream is provided, wherein the code stream is an encrypted code stream obtained by the first aspect or any possible implementation method of the first aspect.
[0069] In a twelfth aspect, a code stream is provided, wherein the code stream includes an updated initialization vector.
[0070] In a thirteenth aspect, a method for storing a code stream is provided, the method comprising: receiving a code stream generated according to the first aspect or any possible implementation method of the first aspect or a code stream as in the twelfth aspect; and storing the code stream in a storage medium.
[0071] In a fourteenth aspect, a device for storing a code stream is provided, the device being used to store a code stream generated according to the first aspect or any possible implementation of the first aspect or to store a code stream as described in the twelfth aspect. Exemplarily, the device may be a computer-readable storage medium.
[0072] In a fifteenth aspect, a method for transmitting a code stream is provided, the method comprising: obtaining a code stream, the code stream being generated by the first aspect or any possible implementation method of the first aspect, or the code stream being the code stream described in the twelfth aspect; and sending the code stream.
[0073] In a sixteenth aspect, a device for transmitting a code stream is provided, wherein the device is used to obtain and send a code stream generated by the above-mentioned first aspect or any possible implementation method of the first aspect, or to obtain and send the code stream described in the above-mentioned twelfth aspect.
[0074] Among them, the technical effects brought about by any implementation method from the third aspect to the sixteenth aspect can refer to the technical effects brought about by the corresponding implementation method of the first aspect or the second aspect, and will not be repeated here.
[0075] Among them, various possible implementation methods of any one of the above aspects can be combined under the premise that the solutions are not contradictory. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] Figure 1 A schematic diagram of a code stream encryption and decryption process provided by the prior art;
[0077] Figure 2 A schematic diagram of a code stream encryption process provided by the prior art;
[0078] Figure 3 A schematic diagram of the structure of a coding and decoding system provided by this application;
[0079] Figure 4 A schematic diagram of a code stream encryption and decryption process provided by this application;
[0080] Figure 5 A flowchart of a data processing method provided in this application;
[0081] Figure 6 A schematic diagram of a basic encryption unit processing provided by the present application;
[0082] Figure 7 A schematic diagram of the association between an encryption basic unit and an initialization vector provided in this application;
[0083] Figure 8 A schematic diagram of a storage method of an initialization vector provided in this application;
[0084] Fig. 9 A schematic diagram of a storage method of a variation factor provided in the present application;
[0085] Fig.10 A schematic diagram of another code stream encryption and decryption process provided by this application;
[0086] Fig.11 A schematic diagram of a code stream encryption and decryption scenario provided by this application;
[0087] Fig.12 A schematic diagram of the structure of a data processing device provided in this application;
[0088] Fig.13 A schematic diagram of the structure of an encoder provided in this application;
[0089] Fig.14 A schematic diagram of the structure of a decoder provided in this application. DETAILED DESCRIPTION
[0090] The following is a brief introduction to some concepts that may be involved in this application.
[0091] Video contains multiple continuous images. When the continuous images change at more than 24 frames per second, according to the principle of visual persistence, the human eye cannot distinguish a single static image, and the multiple images that appear smooth and continuous are called video.
[0092] Video coding refers to the processing of a sequence of pictures to form a video or video sequence. In the field of video coding, the terms "picture", "frame" or "image" can be used as synonyms. Video coding means video encoding or video decoding. Video coding is performed on the source side, and generally includes processing (e.g., compressing) the original video picture to reduce the amount of data required to represent the video picture under the condition of meeting a certain image quality, so as to store and / or transmit it more efficiently. Video decoding is performed on the destination side, and generally includes inverse processing relative to the encoder to reconstruct the video picture. The "encoding" of the video pictures involved in the embodiment can be understood as "encoding" or "decoding" involving a video sequence. The combination of the encoding part and the decoding part is also called codec (encoding and decoding). Video coding can also be called image coding (image coding) also known as image compression (image compression). Image decoding (image decoding) refers to the inverse process of image encoding.
[0093] Data Rate refers to the binary stream generated after encoding an image or video. Data Rate is also called bit stream or bit rate, which is the number of bits transmitted per unit time. It is an important part of picture quality control in image coding. For images of the same resolution, the larger the bit stream of the image, the smaller the compression ratio and the better the picture quality.
[0094] IP camera (IPC) is a new generation of audio and video acquisition equipment that combines traditional cameras with network technology. IP cameras encode the collected analog video signals into digital signals and transmit them to the remote end through the network. The remote viewer can watch the video using a web browser (such as Microsoft IE or Netscape).
[0095] Network cameras are widely used in various fields, such as home, enterprise, public place and other regional security. In enterprise security, network cameras are used for security management in factories, warehouses, offices and other places. In public place security, network cameras are used for security management in schools, hospitals, shopping malls and other places.
[0096] In some embodiments, the network camera uses video coding standards such as H.264, H.265, future video coding standards (such as H.266 standard) or Advanced Video Coding (AVC) to encode the collected analog video signal to obtain a code stream. Usually, the network abstraction layer unit (NALU) is the smallest coding unit, or NALU refers to the basic transmission unit in the H.264 / AVC and H.265 / HEVC video coding standards, which is used to encapsulate the encoded video data and other related information. That is, the code stream includes multiple NALUs, or the code stream is divided into multiple NALUs, and the code stream is transmitted or stored over the network. NALU includes a raw bytesequence payload (RBSP) and a NAL header. RBSP is a payload containing encoded data. Optionally, NALU also includes information such as timestamp, frame rate, and whether the picture is flipped.
[0097] Each NALU is separated by a start code (startcode). For example, the start code is 0x00000001.
[0098] However, if a pseudo start code exists in the data contained in a NALU, it may divide a NALU into two or more NALUs, resulting in decoding errors. Therefore, an anti-counterfeiting code is inserted into the NALU to prevent the pseudo start code from appearing in the code stream and causing decoding errors at the decoding end.
[0099] For example, in the GB35514 standard, the last byte of NALU cannot be equal to 0x00, and pseudo start codes 0x000000, 0x000001, and 0x000002 are not allowed to appear in any byte-aligned position in NALU. The anti-counterfeiting code 0x03 is inserted so that the decoder can identify the pseudo start code contained in NALU. Otherwise, the pseudo start code 0x000000, 0x000001, or 0x000002 in NALU appears in any byte-aligned position, and decoding to these positions divides one NALU into two or more NALUs, resulting in decoding errors.
[0100] In a NALU, except for the sequences 0x00000300, 0x00000301, 0x00000302, and 0x00000303, any four-byte sequence starting with 0x000003 cannot appear in any byte-aligned position.
[0101] The audio and video collected by the network camera are transmitted in plain text on the network, which is easy to cause data leakage. Usually, the method of bitstream encryption and adding anti-counterfeiting code is used to ensure the security and encoding and decoding accuracy of the bitstream obtained by encoding the audio and video collected by the network camera.
[0102] For example, Figure 1 As shown, it is a schematic diagram of a code stream encryption and decryption process provided by the prior art.
[0103] The front end (such as a network camera) encodes the collected audio and video to obtain a bitstream. Check whether the bitstream contains a pseudo start code. If the bitstream contains a pseudo start code, insert an anti-counterfeiting code into the pseudo start code and perform a byte offset. Before encrypting the bitstream with the inserted anti-counterfeiting code, remove the anti-counterfeiting code from the bitstream and perform a byte offset. For example, Figure 1 The code stream shown in contains two 03s. Delete the two 03s and perform byte offset. If the code stream does not contain a pseudo start code, there is no need to insert an anti-counterfeiting code. Encrypt the code stream that does not contain an anti-counterfeiting code and check whether the encrypted code stream contains a pseudo start code. If the encrypted code stream contains a pseudo start code, insert an anti-counterfeiting code into the pseudo start code and perform byte offset. The front end transmits the encrypted code stream with the anti-counterfeiting code inserted. If the encrypted code stream does not contain a pseudo start code, there is no need to insert an anti-counterfeiting code and transmit the encrypted code stream.
[0104] After receiving the encrypted code stream, the backend (such as the server) checks whether the encrypted code stream contains an anti-counterfeiting code. If the encrypted code stream contains an anti-counterfeiting code, remove the anti-counterfeiting code from the encrypted code stream and perform a byte offset. Decrypt the encrypted code stream with the anti-counterfeiting code removed. If the encrypted code stream does not contain an anti-counterfeiting code, decrypt the encrypted code stream. Check whether the decrypted code stream contains a pseudo start code. If the decrypted code stream contains a pseudo start code, insert the anti-counterfeiting code and perform a byte offset to decode the decrypted code stream. If the decrypted code stream does not contain a pseudo start code, there is no need to insert an anti-counterfeiting code.
[0105] It can be seen that there are multiple processes of inserting and removing anti-counterfeiting codes in the front-end and back-end. Each process of inserting and removing anti-counterfeiting codes involves searching for anti-counterfeiting codes in the sequence and moving bytes, which leads to waste of system resources (such as computing resources and storage resources) and affects the overall performance. In the code stream encryption and decryption scenario, the main performance loss is in the search and move processing, encryption and decryption, and network transmission process, among which the search and move processing loss is estimated to be 30%.
[0106] In addition, in the GB35114 standard, the security parameter set provides parameters for the encryption and authentication of the current random access segment (RAS) or knowledge image. The security parameter set contains some encryption and decryption parameters, such as initialization vector (IV), key identifier (keyId), algorithm type, etc. One or more other types of NALUs include these encryption and decryption parameters. Figure 2 As shown, all NALUs corresponding to the security parameter set share an initialization vector.
[0107] If a RAS is relatively large, there are more NALUs that need to be encrypted or the amount of data is large. The encryption and decryption of these NALUs always use the initialization vector in the security parameter set in the RAS, resulting in limited security of code stream encryption.
[0108] In order to solve the problem of waste of system resources and low security of code stream encryption, the present application provides a data processing method, which includes: the front end processes each encryption basic unit in the code stream that does not contain an anti-counterfeiting code to obtain an encrypted basic unit; when the encrypted basic unit contains a pseudo start code, the initialization vector used by the encrypted basic unit is updated, and the encrypted basic unit is processed again using the updated initialization vector and the key contained in the security parameter until the updated encrypted basic unit does not contain the pseudo start code, and then an encrypted code stream is sent, and the encrypted code stream contains the updated encrypted basic unit. After the back end receives the encrypted code stream, the encrypted code stream contains the encrypted basic unit and the security parameter, the encrypted basic unit is decrypted according to the initialization vector contained in the security parameter or the change factor of the generated initialization vector to obtain the decrypted encrypted basic unit, and the decrypted encrypted basic unit is decoded to obtain the decoded data.
[0109] Compared with the process of encrypting and decrypting each encryption basic unit in the code stream using one security parameter, inserting and removing anti-counterfeiting codes multiple times leads to waste of system resources (such as computing resources and storage resources), affects the overall performance, and the code stream encryption security is low. The data processing method provided by the present application, when the encrypted basic unit contains a pseudo start code, changes the initialization vector in the security parameter, and re-encrypts the encryption basic unit according to the updated initialization vector until the updated encrypted basic unit does not contain the pseudo start code. Since the initialization vectors corresponding to different encryption basic units are updated, different initialization vectors may be used to encrypt and decrypt different encryption basic units, thereby improving the security of the code stream; in addition, there is no need to insert and remove anti-counterfeiting codes multiple times, which reduces the system resource consumption of operations such as searching, inserting, deleting anti-counterfeiting codes and byte offsets, effectively saves system resources, and ensures the privacy, accuracy, and real-time performance of the code stream processed by the encoding end.
[0110] The implementation of the data processing method provided by the present application is described in detail below with reference to the accompanying drawings.
[0111] Figure 3 A schematic diagram of the structure of a coding system provided by the present application. The coding system 300 includes a source device 310 and a destination device 320. The source device 310 is used to compress and encode a video or an image to obtain a code stream, encrypt the code stream to obtain an encrypted code stream, and transmit the encrypted code stream to the destination device 320. The destination device 320 decrypts the encrypted code stream and decodes the decrypted code stream to obtain decoded data. Optionally, the decoded data is used to reconstruct the video or image, and the reconstructed video or reconstructed image is displayed.
[0112] In the embodiment of the present application, the source device refers to the front end, which is also called the encoding end or the transmitting end. The source device is also called the front end device. For example, the front end device is a network camera. The destination device refers to the back end, which is also called the decoding end or the receiving end. The destination device is also called the back end device. For example, the back end device is a server.
[0113] Specifically, the source device 310 includes an image collector 311 , a preprocessor 312 , an encoder 313 , and a communication interface 314 .
[0114] The image collector 311 is used to obtain the original image. The image collector 311 includes or is any type of image capture device, for example, for capturing real-world images, and / or any type of image or comment (for screen content encoding, some text on the screen is also considered to be an image or part of an image to be encoded) generation device, for example, a computer graphics processor for generating computer animation images, or any type of device for acquiring and / or providing real-world images, computer animation images (for example, screen content, virtual reality (VR) images), and / or any combination thereof (for example, augmented reality (AR) images). The image collector 311 can be a camera for capturing images or a memory for storing images, and the image collector 311 can also include any type of (internal or external) interface for storing previously captured or generated images and / or acquiring or receiving images. When the image collector 311 is a camera, the image collector 311 can be, for example, a local or integrated camera integrated in a source device; when the image collector 311 is a memory, the image collector 311 is a local or integrated memory integrated in a source device, for example. When the image collector 311 includes an interface, the interface is, for example, an external interface for receiving images from an external video source, the external video source is, for example, an external image capture device, such as a camera, an external memory, or an external image generating device, the external image generating device is, for example, an external computer graphics processor, a computer, or a server. The interface is any type of interface according to any proprietary or standardized interface protocol, such as a wired or wireless interface, an optical interface.
[0115] An image is considered as a two-dimensional array or matrix of pixels (picture elements). The pixels in the array are also called sampling points. The number of sampling points in the array or image in the horizontal and vertical directions (or axes) defines the size and / or resolution of the image. In order to represent color, three color components are usually used, that is, the image can be represented as or include three sampling arrays. For example, in the RBG format or color space, the image includes corresponding red, green and blue sampling arrays. However, in video coding, each pixel is usually represented in a brightness / chrominance format or color space, such as for an image in the YUV format, including a brightness component indicated by Y (sometimes also indicated by L) and two chrominance components indicated by U and V. The brightness (luma) component Y represents the brightness or grayscale level intensity (for example, the two are the same in a grayscale image), while the two chroma (chroma) components U and V represent the chroma or color information components. Accordingly, an image in the YUV format includes a brightness sampling array of brightness sampling values (Y) and two chroma sampling arrays of chrominance values (U and V). The image conversion or transformation of RGB format is into YUV format, and vice versa, which process is also referred to as color conversion or conversion. If the image is black and white, the image includes a brightness sampling array. In the present application, the image transmitted to the encoder 313 by the image acquisition device 311 is also referred to as raw image data.
[0116] The preprocessor 312 is used to receive the video collected by the image collector 311 and preprocess the video to obtain a preprocessed image. For example, the preprocessing performed by the preprocessor 312 includes refurbishment, color format conversion (for example, from RGB format to YUV format), color adjustment or noise removal, etc.
[0117] The encoder 313 is used to receive the preprocessed data generated by the preprocessor 312, compress and encode the preprocessed data to obtain a code stream, and encrypt the code stream to obtain an encrypted code stream. For example, the encoder 313 may include an encoding unit 3131 and an encryption unit 3132. The encoding unit 3131 is used to compress and encode the preprocessed image to obtain a code stream, so that the encryption unit 3132 encrypts the code stream to obtain an encrypted code stream. For example, the encryption unit 3132 encrypts each encryption basic unit in the code stream separately, and when the encrypted basic unit contains a pseudo start code, updates the initialization vector used by the encryption basic unit, and uses the updated initialization vector and the key contained in the security parameter to process the encryption basic unit again until the updated encrypted basic unit does not contain the pseudo start code.
[0118] The communication interface 314 is used to receive the encrypted code stream generated by the encoder 313, and send the encrypted code stream to the destination device 320 through the communication channel 330, so that the destination device 320 can decrypt the encrypted code stream and decode the decrypted code stream to obtain decoded data.
[0119] The destination device 320 includes a display 321 , a post-processor 322 , a decoder 323 , and a communication interface 324 .
[0120] The communication interface 324 is used to receive the encrypted code stream sent by the communication interface 314, and transmit the encrypted code stream to the decoder 323. In order for the decoder 323 to decrypt the encrypted code stream, and decode the decrypted code stream to obtain decoded data.
[0121] The communication interface 314 and the communication interface 324 may be used to send or receive video related data via a direct communication link between the source device 310 and the destination device 320, such as a direct wired or wireless connection, or via any type of network, such as a wired network, a wireless network or any combination thereof, any type of private network and public network or any combination thereof.
[0122] Both the communication interface 314 and the communication interface 324 can be configured as follows: Figure 3 A unidirectional communication interface, or a bidirectional communication interface, indicated by an arrow pointing from the source device 310 to the corresponding communication channel 330 of the destination device 320, and can be used to send and receive messages, etc. to establish a connection, confirm and exchange any other information related to the communication link and / or data transmission such as encoded bit stream transmission, etc.
[0123] The decoder 323 is used to decrypt the encrypted code stream and decode the decrypted code stream to obtain decoded data. For example, the decoder 323 includes a decryption unit 3231 and a decoding unit 3232. For example, the decryption unit 3231 is used to decrypt each encrypted basic unit in the encrypted code stream to obtain a decrypted encrypted basic unit, and the decoding unit 3232 decodes the decrypted encrypted basic unit to obtain decoded data. The decoded data is used to reconstruct the video or image to obtain the reconstructed video or image, and the reconstructed video or reconstructed image is displayed.
[0124] The post-processor 322 is used to receive the reconstructed video or image generated by the decoder 323, and perform post-processing on the reconstructed video or image. For example, the post-processing performed by the post-processor 322 includes color format conversion (e.g., from YUV format to RGB format), color matching, repair or resampling, or any other processing.
[0125] The display 321 is used to display the reconstructed video or image. The display 321 can be or include any type of display device for presenting the reconstructed image, such as an integrated or external display or monitor. For example, the display can include a liquid crystal display (LCD), an organic light emitting diode (OLED) display, a plasma display, a projector, a micro LED display, a liquid crystal on silicon (LCoS), a digital light processor (DLP), or any other type of display.
[0126] Among them, the encoder 313 and the decoder 323 can be implemented as any of a variety of suitable circuits, for example, one or more microprocessors, digital signal processors (digital signal processor, DSP), application-specific integrated circuits (application-specific integrated circuit, ASIC), field-programmable gate arrays (field-programmable gate array, FPGA), discrete logic, hardware or any combination thereof. If the technology is partially implemented in software, the device may store the instructions of the software in a suitable non-temporary computer-readable storage medium, and one or more processors may be used to execute the instructions in hardware to perform the technology of the present disclosure. Any of the foregoing contents (including hardware, software, a combination of hardware and software, etc.) can be regarded as one or more processors.
[0127] The image collector 311 and the encoder 313 may be integrated into one physical device or may be arranged on different physical devices, without limitation. Figure 3The source device 310 shown includes an image collector 311 and an encoder 313, which means that the image collector 311 and the encoder 313 are integrated in one physical device, and the source device 310 can also be called an acquisition device. The source device 310 is, for example, a mobile phone, a tablet computer, a computer, a laptop computer, a camera, a camera, a wearable device, a vehicle-mounted device, a terminal device, a virtual reality (VR) device, an augmented reality (AR) device, a mixed reality (MR) device or an extended reality (XR) device or other image acquisition device. If the source device 310 does not include the image collector 311, it means that the image collector 311 and the encoder 313 are two different physical devices, and the source device 310 can obtain the original image from other devices (such as: an image acquisition device or an image storage device).
[0128] In the present application, the encryption unit 3132 and the encoder 313 may be integrated into one physical device or may be arranged on different physical devices, without limitation. If the encoder 313 does not include the encryption unit 3132, it means that the encryption unit 3132 and the encoder 313 are two different physical devices.
[0129] In addition, the display 321 and the decoder 323 may be integrated into one physical device, or may be arranged on different physical devices, without limitation. Figure 3 The destination device 320 shown includes a display 321 and a decoder 323, indicating that the display 321 and the decoder 323 are integrated on one physical device, and the destination device 320 can also be called a playback device, and the destination device 320 has the functions of decrypting, decoding and displaying the reconstructed video or image. The destination device 320 is, for example, a display, a television, a digital media player, a video game console, a vehicle-mounted computer or other device that displays images. If the destination device 320 does not include a display 321, it means that the display 321 and the decoder 323 are two different physical devices, and after the destination device 320 decrypts and decodes the encrypted code stream to reconstruct the video or image, the reconstructed video or image is transmitted to other display devices (such as: television, digital media player), and the reconstructed video or image is displayed by other display devices.
[0130] also, Figure 3 It is shown that the source device 310 and the destination device 320 can be integrated into one physical device or set on different physical devices, which is not limited. The present application also does not limit the number of devices included in the codec system. The codec system includes multiple source devices and multiple destination devices.
[0131] For example, Figure 4As shown, the front end (e.g., source device 310) is a network camera, and the back end (e.g., destination device 320) is a display in various possible forms. Multiple front ends are deployed in different locations for capturing videos of different scenes, and each front end compresses and encodes the captured video to obtain a code stream, and encrypts the code stream to obtain an encrypted code stream. The encrypted code stream is transmitted over the network. Multiple back ends are also deployed in different locations. Any back end obtains any front end to obtain an encrypted code stream, decrypts the encrypted code stream, and decodes the decrypted code stream to obtain decoded data, and reconstructs the video or image based on the decoded data, and displays the reconstructed video or image. Optionally, the back end displays the reconstructed video or image. Alternatively, the back end does not need to reconstruct the video or image based on the decoded data, and displays the decoded data, and other devices reconstruct the video or image based on the decoded data and display the decoded data.
[0132] In these embodiments, the source device 310 or its corresponding functions and the destination device 320 or its corresponding functions may be implemented using the same hardware and / or software or by separate hardware and / or software or any combination thereof. Figure 3 The existence and division of different units or functions in the source device 310 and / or the destination device 320 shown may vary according to actual devices and applications, which is obvious to those skilled in the art.
[0133] The structure of the above-mentioned codec system is only a schematic illustration. In some possible implementations, the codec system also includes other devices, for example, the codec system may also include a terminal device or a cloud device. After the source device 310 acquires the original image, it preprocesses the original image to obtain a preprocessed image; and transmits the preprocessed image to the terminal device or the cloud device, which implements the function of encoding and decoding the preprocessed image.
[0134] Next, the data processing process is described with reference to the accompanying drawings. Figure 5 A flow chart of a data processing method provided in this application. Figure 3 The data processing process performed by the source device 310 and the destination device 320 is described as an example. The source device 310 includes an encryption unit to encrypt the encoded code stream. The destination device 320 includes a decryption unit to decrypt the encrypted code stream. Figure 5 As shown in (a), the encoding and encryption process includes the following steps.
[0135] Step 510: Obtain code stream.
[0136] The source device 310 encodes the video in a memory in the source device 310, other memories or in real time to obtain a bit stream. This embodiment does not limit the method for obtaining the bit stream.
[0137] As described in the above embodiment, if the source device 310 carries the image collector 311, the source device 310 collects video through the image collector 311. Optionally, the source device 310 also receives videos collected by other devices; or obtains videos from a memory or other memory in the source device 310. The video includes at least one of a real-world video collected in real time, a video stored in the device, and a video synthesized from multiple videos. This embodiment does not limit the video acquisition method and the video type.
[0138] The encoder predicts the multiple frames of images contained in the video respectively to obtain the prediction results of each frame of image; and performs residual coding on the prediction results of each frame of image to obtain a bit stream.
[0139] For example, the prediction includes inter-frame prediction and / or intra-frame prediction. The encoder performs inter-frame prediction on multiple frames of images contained in the video to obtain a prediction result for each frame of image. For another example, the encoder performs intra-frame prediction on multiple frames of images contained in the video to obtain a prediction result for each frame of image. For another example, the encoder performs inter-frame prediction on some images and intra-frame prediction on some images to obtain a prediction result for each frame of image. The encoder performs intra-frame prediction and inter-frame prediction on a frame of image to obtain a prediction result of the image.
[0140] Prediction methods include motion vector, predicted motion vector, motion vector residual or residual prediction, etc.
[0141] The encoding of the video to be encoded according to the prediction result mentioned in the present application refers to performing residual encoding on the video to be encoded according to the prediction result.
[0142] Residual coding includes quantization and entropy coding. In some embodiments, the source device 310 divides the current frame into multiple coding units and encodes the multiple coding units. The encoder quantizes the residuals of the coding units included in the prediction result, and entropy codes the quantized residuals to obtain a bitstream. The quantization operation can be performed in a variety of ways, such as using scalar quantization or vector quantization.
[0143] The current frame refers to a frame of image that is being coded and decoded at the current moment. The previous frame refers to a frame of image that has been coded and decoded at a moment before the current moment. The previous frame is a frame at a moment before or at a plurality of moments before the current moment.
[0144] Here, the code stream refers to the code stream to be encrypted. The code stream does not contain the anti-counterfeiting code.
[0145] In some embodiments, after the video is encoded to obtain a bitstream, it is checked whether the encoded bitstream contains an anti-counterfeiting code. If the encoded bitstream contains an anti-counterfeiting code, the anti-counterfeiting code in the bitstream is first removed, and the byte offset is performed, and then the bitstream is encrypted. If the bitstream does not contain the anti-counterfeiting code, there is no need to perform the operation of removing the anti-counterfeiting code, and the bitstream is directly encrypted.
[0146] In some embodiments, before encrypting the code stream, the code stream is divided into a plurality of encryption basic units, and the plurality of encryption basic units are encrypted respectively according to the security parameters, wherein the encryption basic unit refers to a basic data block processed during the data encryption process.
[0147] For example, the basic encryption unit is any one of NAL, LU or AU. AU refers to a frame of image. LU refers to an area in a frame of image. NAL refers to a piece of data of an area in a frame of image, and NAL refers to a basic coding unit. One LU contains multiple NALs. One AU contains multiple LUs.
[0148] The security parameter set includes security parameters for signing and security parameters for encryption. The security parameters for encryption include an initialization vector and a key. Before the codec system encodes or decodes a video or image, the security parameter set is pre-configured.
[0149] Here, the first security parameter refers to the security parameter initially configured for encryption, and the first security parameter is used to process the encryption basic unit as an example to illustrate the code stream encryption process. The encryption process of each encryption basic unit in the code stream is described with reference to the following steps 520 to 540.
[0150] Step 520: Process the encrypted basic unit of the code stream according to the first security parameter to obtain a first encrypted basic unit.
[0151] The encryption basic unit processing of the code stream refers to the encryption basic unit processing of the code stream using the security parameters used for encryption in the security parameter set.
[0152] In some embodiments, the encryption basic unit is encrypted according to the first initialization vector and the key included in the first security parameter to obtain a first encrypted basic unit. The first encrypted basic unit refers to the result obtained by encrypting the encryption basic unit for the first time.
[0153] Optionally, all or part of the payload data of the encryption basic unit is encrypted according to the first initialization vector and the key included in the first security parameter.
[0154] After encrypting the encryption basic unit to obtain the first encrypted basic unit, check whether the first encrypted basic unit contains a pseudo start code.
[0155] If the first encrypted basic unit does not contain the pseudo start code, the processing of the encrypted basic unit is terminated, the first encrypted basic unit is used as the encryption result of the encrypted basic unit, and the first initialization vector is used as the security parameter of the encrypted basic unit. The first encrypted basic unit is sent, as shown in step 550. Then, the next encrypted basic unit is encrypted according to the first security parameter.
[0156] If the first encrypted basic unit contains a pseudo start code, the first initialization vector is updated, and the encrypted basic unit is processed again using the updated initialization vector and the key, as shown in steps 530 to 540.
[0157] Step 530: When the first encrypted basic unit includes a pseudo start code, update the first initialization vector to obtain a second initialization vector.
[0158] In a first possible implementation, the second initialization vector is incrementally generated according to the first initialization vector. For example, the first initialization vector is calculated according to an incremental factor to obtain the second initialization vector.
[0159] In a second possible implementation manner, the second initialization vector is generated according to an identifier of the encryption basic unit, where the identifier of the encryption basic unit includes a starting position and a length of the encryption basic unit.
[0160] Step 540: Process the encrypted basic unit according to the second security parameter to obtain a second encrypted basic unit, where the second security parameter includes a second initialization vector and a key.
[0161] The encryption basic unit is encrypted according to the second initialization vector and the key included in the second security parameter to obtain a second encrypted basic unit. The key is the key included in the first security parameter. The second encrypted basic unit refers to the result obtained by encrypting the encryption basic unit again.
[0162] After encrypting the encryption basic unit to obtain the second encrypted basic unit, check whether the second encrypted basic unit contains a pseudo start code.
[0163] If the second encrypted basic unit does not contain the pseudo start code, the processing of the encryption basic unit is terminated, the second encrypted basic unit is used as the encryption result of the encryption basic unit, and the second initialization vector is used as the security parameter of the encryption basic unit.
[0164] If the second encrypted basic unit contains a pseudo start code, the first initialization vector is updated to obtain a third initialization vector. The encryption basic unit is encrypted according to the third initialization vector and the key contained in the third security parameter.
[0165] In the present application, after encrypting the encryption basic unit according to the updated initialization vector, the encrypted basic unit is obtained, until the encrypted basic unit does not contain the pseudo start code, and the updating of the initialization vector corresponding to the encryption basic unit is stopped. The number of updates of the initialization vector is not limited in the present application, for example, the number of updates of the initialization vector is at least once. If the encrypted basic unit does not contain the pseudo start code after encrypting the encryption basic unit according to the initial configuration initialization vector, there is no need to update the initial configuration initialization vector, that is, the number of updates of the initialization vector is 0.
[0166] For example, Figure 6 As shown, it is a schematic diagram of the encryption basic unit processing provided by the present application.
[0167] The encryption basic unit of the code stream is processed according to the first initialization vector and the key included in the first security parameter to obtain a first encrypted basic unit. When the first encrypted basic unit does not include the pseudo start code, the encrypted code stream is sent, and the encrypted code stream includes the first encrypted basic unit. When the first encrypted basic unit includes the pseudo start code, the first initialization vector is updated to obtain a second initialization vector. That is, the initialization vector is updated for the first time.
[0168] The encryption basic unit of the code stream is processed according to the second initialization vector and the key included in the second security parameter to obtain a second encrypted basic unit. When the second encrypted basic unit does not contain the pseudo start code, the encrypted code stream is sent, and the encrypted code stream contains the second encrypted basic unit. When the second encrypted basic unit contains the pseudo start code, the first initialization vector is updated to obtain a third initialization vector. That is, the initialization vector is updated for the second time.
[0169] The encryption basic unit of the code stream is processed according to the third initialization vector and the key included in the third security parameter to obtain a third encrypted basic unit. When the third encrypted basic unit does not include the pseudo start code, the encrypted code stream is sent, and the encrypted code stream includes the third encrypted basic unit. When the third encrypted basic unit includes the pseudo start code, the first initialization vector is updated to obtain a fourth initialization vector. That is, the initialization vector is updated for the third time.
[0170] In this way, each time the initialization vector is updated, the encryption basic unit is encrypted according to the new initialization vector, and then it is determined whether the new encrypted basic unit contains a pseudo start code. For example, the description of the initialization vector updated for the n-1th time, the initialization vector updated for the nth time, and the initialization vector updated for the n+1th time is as follows.
[0171] According to the n-1th initialization vector and the key included in the n-1th security parameter, the encryption basic unit of the code stream is processed to obtain the n-1th encrypted basic unit. In the case that the n-1th encrypted basic unit does not contain the pseudo start code, the encrypted code stream is sent, and the encrypted code stream contains the n-1th encrypted basic unit. In the case that the n-1th encrypted basic unit contains the pseudo start code, the first initialization vector is updated to obtain the nth initialization vector, where n is a positive integer greater than or equal to 3. That is, the initialization vector is updated for the n-1th time.
[0172] The encryption basic unit of the code stream is processed according to the nth initialization vector and the key included in the nth security parameter to obtain the nth encrypted basic unit. When the nth encrypted basic unit does not contain the pseudo start code, the encrypted code stream is sent, and the encrypted code stream contains the nth encrypted basic unit. When the nth encrypted basic unit contains the pseudo start code, the first initialization vector is updated to obtain the n+1th initialization vector. That is, the initialization vector is updated for the nth time.
[0173] According to the n+1th initialization vector and the key included in the n+1th security parameter, the encryption basic unit of the code stream is processed to obtain the n+1th encrypted basic unit. In the case that the n+1th encrypted basic unit does not contain the pseudo start code, the encrypted code stream is sent, and the encrypted code stream contains the n+1th encrypted basic unit. In the case that the n+1th encrypted basic unit contains the pseudo start code, the first initialization vector is updated to obtain the n+2th initialization vector. That is, the initialization vector is updated for the n+1th time.
[0174] Thus, the encrypted basic unit of the code stream is processed according to the initialization vector and key included in the security parameters used for encryption to obtain the encrypted basic unit. In the case where the encrypted basic unit contains a pseudo start code, the initialization vector is updated to obtain a new initialization vector. The encrypted basic unit of the code stream is processed according to the new initialization vector and key to obtain a new encrypted basic unit, until the new encrypted basic unit does not contain the pseudo start code, the processing of the encrypted basic unit is terminated, the new encrypted basic unit is used as the encryption result of the encryption basic unit, the new initialization vector is used as the security parameter of the encryption basic unit, and the new encrypted basic unit is sent.
[0175] The data processing method provided by the present application, when the encrypted basic unit contains a pseudo start code, updates the initialization vector in the security parameter, and re-encrypts the encrypted basic unit according to the updated initialization vector until the updated encrypted basic unit does not contain the pseudo start code. Therefore, there is no need to insert and remove anti-counterfeiting codes, which reduces the system resource consumption of operations such as searching, inserting, deleting anti-counterfeiting codes and byte offsets at the encoding and decoding ends, and effectively saves system resources.
[0176] It is understandable that the code stream contains multiple encryption basic units. After processing each encryption basic unit in the code stream, check whether the encrypted basic unit contains a pseudo start code. If the encrypted basic unit contains a pseudo start code, update the initialization vector, and use the updated initialization vector and key to encrypt the encryption basic unit again until the encrypted basic unit does not contain the pseudo start code. If the encrypted basic unit does not contain the pseudo start code, encrypt the next encryption basic unit according to the first security parameter. Different encryption basic units use different initialization vectors, thereby improving the security of the code stream.
[0177] In the above embodiment, each time the initialization vector is updated, the first initialization vector is updated. Optionally, the n-1th initialization vector is updated to obtain the nth initialization vector. For example, when the initialization vector is updated for the first time, the first initialization vector is updated to obtain the second initialization vector. When the initialization vector is updated for the second time, the second initialization vector is updated to obtain the third initialization vector.
[0178] Step 550: The source device sends an encrypted code stream of the video. Correspondingly, the destination device receives the encrypted code stream. The encrypted code stream includes encrypted basic units and security parameters.
[0179] After the source device encrypts the code stream, it sends the encrypted code stream. After the destination device receives the encrypted code stream, it decrypts the encrypted code stream.
[0180] In some embodiments, the encryption code stream is sent according to the size of the encryption basic unit. For example, the encryption basic unit is AU, and after the encryption of the encryption basic unit is completed, the encryption code stream is sent. For another example, the encryption basic unit is LU, and after the encryption of multiple LUs contained in an AU is completed, the encryption code stream is sent. For another example, the encryption basic unit is NAL, and after the encryption of multiple NALs contained in an AU is completed, the encryption code stream is sent.
[0181] Different encryption basic units may use different initialization vectors. In order to obtain the initialization vector and key corresponding to the encryption basic unit to decrypt the encrypted code stream, the source device informs the destination device of the initialization vector and key used.
[0182] In some embodiments, each encryption basic unit is associated with an initialization vector used by the encryption basic unit, and the encryption code stream includes the relationship between the encryption basic unit and the initialization vector, so that the destination device can decrypt the encryption code stream according to the security parameters and improve the accuracy of the decrypted code stream.
[0183] There are two ways to associate encryption basic units with initialization vectors.
[0184] 1) The encrypted basic unit is associated with the initialization vector. If the first initialization vector of the initial configuration used by the encrypted basic unit is updated, the updated initialization vector is directly bound to the encrypted basic unit so that the destination device can obtain the initialization vector used by the encrypted basic unit more quickly, which is more efficient. For example, Figure 7 As shown in (a) of FIG. 1 , the encrypted basic unit 1 is encrypted using the initialization vector 1 to obtain the encrypted basic unit 1 , and the encrypted basic unit 1 does not contain a pseudo start code. The initialization vector 1 is associated with the encrypted basic unit 1 .
[0185] 2) The identifier of the encrypted basic unit is associated with the initialization vector. The updated initialization vector is directly bound to the identifier of the encrypted basic unit. The identifier of the encrypted basic unit includes the starting position and length of the encrypted basic unit. For example, Figure 7 As shown in (b) in FIG. 1 , the initialization vector 1 is associated with the starting position and length of the encrypted basic unit 1 .
[0186] In some embodiments, the encrypted code stream includes security parameters of the encryption basic unit. The security parameters include an initialization vector or a variation factor for generating the initialization vector.
[0187] There are two ways to store initialization vectors.
[0188] 1) The initialization vector is located in the leading data of the encrypted basic unit. The initialization vector associated with the encryption basic unit, that is, the initialization vector used by the encryption basic unit, is located in the leading data of the encrypted basic unit.
[0189] For example, Figure 8 As shown in (a), the encrypted code stream includes encrypted basic unit 1, encrypted basic unit i, and encrypted basic unit n. The leading data of encrypted basic unit 1 includes the updated initialization vector 1. The leading data of encrypted basic unit n includes the updated initialization vector n. The leading data of encrypted basic unit i does not include the initialization vector, indicating that encrypted basic unit i corresponds to the first initialization vector.
[0190] 2) The initialization vector is located in the extended enhancement information. The encrypted code stream contains the extended enhancement information, and the extended enhancement information contains the initialization vector used by the encryption basic unit.
[0191] For example, Figure 8 As shown in (b) in FIG. 1 , a NALU is added to the encrypted code stream as extended enhancement information, which is used to include the initialization vector used by at least one encrypted basic unit. The extended enhancement information includes initialization vector 1 and the starting position 1 and length 1 of the encrypted basic unit 1. The starting position 1 and length 1 of the encrypted basic unit 1 are used to locate the encrypted basic unit 1. Initialization vector 1 is used to decrypt the encrypted basic unit 1.
[0192] Optionally, the extended enhancement information includes an initialization vector and an encrypted basic unit.
[0193] In other embodiments, the security parameter includes a variation factor for generating an initialization vector used by the cryptographic primitive.
[0194] like Fig. 9 As shown in (a) in FIG. 1 , the leading data includes a variation factor for generating an updated initialization vector. The variation factor includes the starting position and length of the encrypted basic unit. For example, the leading data of the encrypted basic unit 1 includes a variation factor 1, and the variation factor 1 includes the starting position 1 and the length 1 of the encrypted basic unit 1. The starting position 1 and the length 1 of the encrypted basic unit 1 are used to generate the initialization vector for decrypting the encrypted basic unit 1.
[0195] Optionally, the variation factor includes an enhancement factor, such as a random seed.
[0196] like Fig. 9 As shown in (b) of FIG. 1 , the encrypted code stream includes extended enhancement information, and the extended enhancement information includes a change factor for generating an updated initialization vector. For example, the change factor includes the starting position and length of the encrypted basic unit. The starting position and length of the encrypted basic unit are used to locate the encrypted basic unit and generate the initialization vector.
[0197] For another example, the initialization vector is a random number, and the variation factor is a random seed. The variation factor is used to generate the initialization vector. The extended enhancement information also includes the starting position and length of the encrypted basic unit. The starting position and length of the encrypted basic unit are used to locate the encrypted basic unit.
[0198] Optionally, if there is no need to update the initialization vector of the initial configuration, there is no need to set the updated initialization vector or change factor in the leading data or extended enhancement information, that is, the leading data or extended enhancement information does not include the initialization vector or the change factor, indicating that the first initialization vector of the initial configuration is used to encrypt the encryption basic unit, thereby reducing system resource consumption.
[0199] The leading data and the extended enhancement information also include a key identifier, so that the destination device can decrypt the encrypted code stream according to the initialization vector and the key identifier corresponding to the key, thereby improving the accuracy of the decrypted code stream.
[0200] Before the codec system encodes or decodes the video or image, the key is pre-configured. The key identification is transmitted to reduce the amount of transmitted data and reduce bandwidth consumption.
[0201] like Figure 5 As shown in (b), the decryption decoding process includes the following steps.
[0202] Step 560: decrypt the encrypted basic unit according to the security parameter to obtain the decrypted encrypted basic unit.
[0203] In a first possible implementation, the security parameter includes an initialization vector and a key identifier used for decrypting the encrypted basic unit, and the key is obtained according to the key identifier.
[0204] In some embodiments, the leading data of the encrypted basic unit includes an initialization vector and a key identifier. The encrypted basic unit is decrypted according to the key corresponding to the initialization vector and the key identifier included in the leading data to obtain the decrypted encrypted basic unit.
[0205] In some other embodiments, the extended enhancement information includes an initialization vector, a starting position and a length of the encrypted basic unit, and an identifier of a key. The encrypted basic unit is determined according to the starting position and the length of the encrypted basic unit, and the encrypted basic unit is decrypted according to the key corresponding to the initialization vector and the identifier of the key included in the extended enhancement information to obtain the decrypted encrypted basic unit.
[0206] In a second possible implementation manner, the security parameter includes a variation factor for generating an initialization vector and an identifier of a key.
[0207] In some embodiments, the leading data of the encrypted basic unit includes a change factor. An initialization vector is generated according to the change factor included in the leading data. The encrypted basic unit is decrypted according to the initialization vector and the key corresponding to the key identifier to obtain the decrypted encrypted basic unit.
[0208] In other embodiments, the extended enhancement information includes a change factor and a starting position and length of the encrypted basic unit. An initialization vector is generated according to the change factor included in the extended enhancement information. The encrypted basic unit is located and obtained according to the starting position and length of the encrypted basic unit. The encrypted basic unit is decrypted according to the key corresponding to the initialization vector and the key identifier to obtain the decrypted encrypted basic unit. Optionally, the change factor includes the identifier of the encrypted basic unit, and the encrypted basic unit is determined according to the identifier of the encrypted basic unit. The identifier of the encrypted basic unit includes the starting position and length of the encrypted basic unit.
[0209] For example, the variation factor includes the calculation parameter or the starting position and length of the encrypted basic unit. It should be understood that the source device and the destination device update the initialization vector in the same way, and the destination device obtains the variation factor and can generate an updated initialization vector according to the variation factor.
[0210] Optionally, if the leading data of the encrypted basic unit does not contain an initialization vector or a change factor, or the extended enhancement information does not contain an initialization vector or a change factor, indicating that the initialization vector has not been updated, the encrypted basic unit is decrypted using the first initialization vector of the initial configuration to obtain the decrypted encrypted basic unit.
[0211] Step 570: Decode the decrypted encryption basic unit to obtain decoded data.
[0212] The decoder performs residual decoding on the decrypted code stream to obtain decoded data.
[0213] Among them, residual decoding is the inverse process of residual encoding, and reconstruction is the inverse process of prediction. Residual decoding includes entropy decoding and inverse quantization. For example, the decoder performs entropy decoding on the bitstream to obtain the quantized residual of the image, inversely quantizes the quantized residual to obtain the residual, and reconstructs the residual to obtain the reconstructed image.
[0214] The data processing method provided by the present application, when the encrypted basic unit contains a pseudo start code, by changing the initialization vector in the security parameter, the encrypted basic unit is re-encrypted according to the updated initialization vector until the updated encrypted basic unit does not contain the pseudo start code, then different encryption basic units correspond to different initialization vectors, that is, different initialization vectors may be used to encrypt and decrypt different encryption basic units, thereby improving the security of the code stream; in addition, there is no need to insert and remove anti-counterfeiting codes multiple times, which reduces the system resource consumption of operations such as searching, inserting, deleting anti-counterfeiting codes and byte offsets at the encoding and decoding ends, effectively saving system resources, and ensuring the privacy, accuracy and real-time performance of the code stream processed by the encoding end.
[0215] This solution is not only applicable to the protection of audio and video code stream data in GB35114 standard scenarios, but also applicable to the end-to-end privacy protection of code streams in scenarios such as media digital rights management (DMR).
[0216] For example, Fig.10 As shown, it is a schematic diagram of a coding and decoding process provided by this application.
[0217] The front end (such as a network camera) encodes the collected audio and video to obtain a bit stream. Check whether the bit stream contains an anti-counterfeiting code. If the bit stream contains an anti-counterfeiting code, first remove the anti-counterfeiting code from the bit stream and perform a byte offset. For example, Fig.10The code stream shown in contains two 03s. Delete the two 03s and perform byte offset. If the code stream does not contain an anti-counterfeiting code, encrypt the code stream. For example, encrypt the encryption basic unit of the code stream according to the first initialization vector and key contained in the first security parameter, and check whether the encrypted basic unit contains a pseudo start code. If the encrypted basic unit contains a pseudo start code, update the first initialization vector without inserting an anti-counterfeiting code, and re-encrypt the encryption basic unit according to the updated initialization vector until the updated encrypted basic unit does not contain a pseudo start code. The front end transmits an encrypted code stream that does not contain a pseudo start code.
[0218] After the backend (such as the server) receives the encrypted code stream, if the code stream contains an initialization vector, the encrypted basic unit is decrypted according to the initialization vector contained in the code stream to obtain the decrypted encrypted basic unit. If the code stream does not contain an initialization vector, the encrypted basic unit is decrypted according to the first initialization vector of the initial configuration to obtain the decrypted encrypted basic unit. The decrypted code stream is obtained so as to decode the decrypted code stream.
[0219] The above embodiments describe the data processing method provided by the present application in detail. The following describes the overall process of end-to-end encryption and decryption of audio and video code streams. Fig.11 A flowchart of another data processing method provided by this application. Fig.11 As shown, the following steps are included.
[0220] Step 1101: The front-end device and the video sharing platform perform two-way authentication. The video sharing platform encrypts the Video Key Encryption Key (VKEK) with the front-end device SM2 (signature algorithm) public key and returns the VKEK to the front-end device.
[0221] Step 1102: After receiving the VKEK, the front-end device uses the front-end device SM2 private key to decrypt and store the VKEK.
[0222] Step 1103: The client sends a video request to the video sharing platform to obtain the audio and video code streams of the front-end device, such as real-time video and recorded video.
[0223] Step 1104: The video sharing platform forwards the video request to the front-end device.
[0224] Step 1105: The front-end device returns a video request response.
[0225] Step 1106: The video sharing platform returns a video request response to the client, carrying the VKEK encrypted with the client's SM2 public key.
[0226] Step 1107: The client imports the encrypted VKEK into the client security component and decrypts the VKEK using the client SM2 private key.
[0227] Step 1108, the front-end device generates a video encryption key (VEK), obtains an initialization vector from the security parameter set, encrypts the audio and video stream, and encrypts the VEK with the VKEK.
[0228] Step 1109, the front-end device checks the encryption result of the bit stream. If a pseudo start code appears in the encryption result of the bit stream, a random number is used to regenerate an updated initialization vector, the audio and video bit streams are re-encrypted, and the encryption result of the bit stream is checked again for pseudo start codes, until no pseudo start code appears in the encryption result, and VEK is encrypting with VKEK.
[0229] Step 1111: The front-end device sends an encrypted code stream to the video sharing platform.
[0230] Step 1112: The video sharing platform forwards the encrypted code stream to the client.
[0231] Step 1113: The client uses the VKEK in the security component to decrypt the VEK, uses the VEK to decrypt the code stream, and plays the video.
[0232] Step 1114: When the front-end device re-performs two-way authentication with the video sharing platform according to the refresh registration cycle, the video sharing platform will return an updated VKEK to the front-end device.
[0233] Step 1115: The front-end device uses the updated VKEK to encrypt the VEK.
[0234] Step 1116: The video sharing platform sends an updated VKEK notification to the client. The secure client imports the updated VKEK into the client security component. Then, the encrypted video is decrypted and played using the updated VKEK.
[0235] In order to implement the functions in the above embodiments, the encoder and decoder include hardware structures and / or software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that the present application can be implemented in the form of hardware or a combination of hardware and computer software in combination with the units and method steps of each example described in the embodiments disclosed in the present application. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0236] Combined with the above Figures 1 to 11 The encoding and encryption method and the decryption and decoding method provided by this embodiment are described in detail. Fig.12, describing the data processing device provided according to this embodiment.
[0237] Fig.12 The following is a schematic diagram of the structure of a possible data processing device provided in this embodiment. These data processing devices can be used to implement the encoding and encryption functions in the above method embodiments, and thus can also achieve the beneficial effects possessed by the above method embodiments. In this embodiment, the data processing device can be as follows: Figure 3 The encoder shown may also be a module (such as a chip) applied to the front end.
[0238] like Fig.12 As shown in (a) in FIG. 1 , the data processing device 1200 includes a communication module 1210 , a coding module 1220 , an encryption module 1230 and a storage module 1240 .
[0239] The communication module 1210 is used to obtain the video to be encoded. Alternatively, the communication module 1210 is used to obtain the code stream. For example, the encoding module 1220 is used to perform Figure 5 Step 510.
[0240] The encoding module 1220 is used to encode the video to obtain a code stream, which does not contain an anti-counterfeiting code.
[0241] The encryption module 1230 is used to encrypt each encryption basic unit in the code stream that does not contain the anti-counterfeiting code to obtain an encrypted basic unit; when the encrypted basic unit contains a pseudo start code, the initialization vector used for processing the encryption basic unit is updated, and the encryption basic unit is processed again using the updated initialization vector and the key contained in the security parameter until the updated encrypted basic unit does not contain the pseudo start code. For example, the encryption module 1230 is used to perform Figure 5 Step 520 to step 540.
[0242] The communication module 1210 is used to send an encrypted code stream, which includes an updated encrypted basic unit. For example, the communication module 1210 is used to execute Figure 5 Step 550.
[0243] The storage module 1240 is used to store initialization vectors, keys, etc.
[0244] The data processing device can be used to implement the decryption and decoding functions in the above method embodiment, so as to achieve the beneficial effects of the above method embodiment. In this embodiment, the data processing device can be as follows Figure 3 The decoder shown may also be a module (such as a chip) applied to the back end.
[0245] like Fig.12As shown in (b) in FIG. 1 , the data processing device 1200 includes a communication module 1210 , a decryption module 1250 , a decoding module 1260 and a storage module 1240 .
[0246] The communication module 1210 is also used to obtain an encrypted code stream, which includes an encrypted basic unit and a security parameter.
[0247] The decryption module 1250 is used to decrypt the encrypted basic unit according to the security parameter to obtain the decrypted encrypted basic unit. Figure 5 Step 560.
[0248] The decoding module 1260 is used to decode the decrypted encryption basic unit to obtain the decoded data. For example, the decoding module 1260 is used to perform Figure 5 Step 570.
[0249] The data processing device 1200 of the embodiment of the present application can be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), wherein the PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. It can also be implemented by software. Figure 5 When the data processing method is shown, the data processing device 1200 and its various modules may also be software modules.
[0250] For a more detailed description of the above communication module, encoding module, decoding module and storage module, please refer to Figure 5 The relevant description in the method embodiment shown is directly obtained and will not be repeated here.
[0251] Fig.13 FIG. 1 is a schematic diagram of the structure of an encoder 1300 provided in this embodiment. Fig.13 As shown, the encoder 1300 includes a processor 1310 , a bus 1320 , a memory 1330 , and a communication interface 1340 .
[0252] It should be understood that in this embodiment, the processor 1310 may be a central processing unit (CPU), and the processor 1310 may also be other general-purpose processors, digital signal processors (DSP), ASICs, FPGAs or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0253] The processor may also be a graphics processing unit (GPU), a neural network processing unit (NPU), a microprocessor, or one or more integrated circuits for controlling the execution of the program of the present application.
[0254] The communication interface 1340 is used to implement communication between the encoder 1300 and an external device or component. In this embodiment, the communication interface 1340 is used to obtain video.
[0255] The bus 1320 may include a path for transmitting information between the above components (such as the processor 1310 and the memory 1330). In addition to the data bus, the bus 1320 may also include a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are labeled as bus 1320 in the figure.
[0256] As an example, the encoder 1300 may include multiple processors. The processor may be a multi-core (multi-CPU) processor. The processor here may refer to one or more devices, circuits, and / or computing units for processing data (e.g., computer program instructions). The processor 1310 encodes the video, obtains a bitstream, and encrypts the bitstream. Among them, the bitstream does not contain an anti-counterfeiting code. Each encrypted basic unit in the bitstream that does not contain an anti-counterfeiting code is encrypted to obtain an encrypted basic unit; when the encrypted basic unit contains a pseudo start code, the initialization vector used by the encrypted basic unit is updated, and the encrypted basic unit is processed again using the updated initialization vector and the key contained in the security parameter until the updated encrypted basic unit does not contain a pseudo start code, and an encrypted code stream is obtained.
[0257] It is worth mentioning that Fig.13 In the example, the encoder 1300 includes one processor 1310 and one memory 1330. Here, the processor 1310 and the memory 1330 are respectively used to indicate a type of device or equipment. In a specific embodiment, the number of each type of device or equipment can be determined according to business requirements.
[0258] The memory 1330 may correspond to a storage medium used to store information such as an initialization vector and a key in the above method embodiment, for example, a disk such as a mechanical hard disk or a solid state disk.
[0259] The encoder 1300 may be a general-purpose device or a dedicated device. For example, the encoder 1300 may be a server based on X86 or ARM, or may be other dedicated servers. The embodiment of the present application does not limit the type of the encoder 1300.
[0260] It should be understood that the encoder 1300 of this embodiment may correspond to the data processing device 1200 of this embodiment, and may correspond to the device for executing the Figure 5 The corresponding subject in any method, and the above and other operations and / or functions of each module in the data processing device 1200 are respectively to implement Figure 5 For the sake of brevity, the corresponding processes of each method in are not repeated here.
[0261] Fig.14 FIG. 1 is a schematic diagram of a structure of a decoder 1400 provided in this embodiment. Fig.14 As shown, decoder 1400 includes a processor 1410 , a bus 1420 , a memory 1430 , and a communication interface 1440 .
[0262] It should be understood that in this embodiment, the processor 1410 may be a central processing unit (CPU), and the processor 1410 may also be other general-purpose processors, digital signal processors (DSP), ASICs, FPGAs or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0263] The processor may also be a graphics processing unit (GPU), a neural network processing unit (NPU), a microprocessor, or one or more integrated circuits for controlling the execution of the program of the present application.
[0264] The communication interface 1440 is used to implement communication between the decoder 1400 and an external device or component. In this embodiment, the communication interface 1440 is used to obtain video.
[0265] The bus 1420 may include a path for transmitting information between the above components (such as the processor 1410 and the memory 1430). In addition to the data bus, the bus 1420 may also include a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are labeled as bus 1420 in the figure.
[0266] As an example, the decoder 1400 may include multiple processors. The processor may be a multi-core (multi-CPU) processor. The processor here may refer to one or more devices, circuits, and / or computing units for processing data (e.g., computer program instructions). The processor 1410 decrypts the encrypted basic unit according to the security parameter to obtain the decrypted encrypted basic unit. The decrypted encrypted basic unit is decoded to obtain decoded data.
[0267] It is worth mentioning that Fig.14 In the example, the decoder 1400 includes a processor 1410 and a memory 1430. Here, the processor 1410 and the memory 1430 are respectively used to indicate a type of device or equipment. In a specific embodiment, the number of each type of device or equipment can be determined according to business requirements.
[0268] The memory 1430 may correspond to a storage medium used to store information such as an initialization vector and a key in the above method embodiment, for example, a disk such as a mechanical hard disk or a solid state disk.
[0269] The decoder 1400 may be a general device or a dedicated device. For example, the decoder 1400 may be a server based on X86 or ARM, or may be other dedicated servers, etc. The embodiment of the present application does not limit the type of the decoder 1400.
[0270] It should be understood that the decoder 1400 according to this embodiment may correspond to the data processing device 1200 in this embodiment, and may correspond to the device for executing the Figure 5 The corresponding subject in any method, and the above and other operations and / or functions of each module in the data processing device 1200 are respectively to implement Figure 5 For the sake of brevity, the corresponding processes of each method in are not repeated here.
[0271] Optionally, the encryption module is disposed inside the encoder 1300 and the decryption module is disposed inside the decoder 1400, the encoder 1300 further comprises an encryption module for encrypting the code stream, and the decoder 1400 further comprises a decryption module for decrypting the encrypted code stream.
[0272] The method steps in this embodiment can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a network device or a terminal device. Of course, the processor and the storage medium can also exist in a network device or a terminal device as discrete components.
[0273] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with a medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).
[0274] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other changes to the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0275] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0276] In the description of the present application, unless otherwise specified, " / " indicates that the objects associated with each other are in an "or" relationship, for example, A / B can represent A or B; "and / or" in the present application is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. In the description of the present application, unless otherwise specified, "multiple" means two or more than two. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b and / or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or plural.
[0277] In addition, in order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit the difference.
[0278] In the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a concrete way for easy understanding.
[0279] It is understood that the "embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, throughout the specification, each embodiment does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It is understood that in various embodiments of the present application, the size of the sequence number of each process does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0280] Some optional features in the embodiments of the present application may be implemented independently in some scenarios without relying on other features, such as the solution on which they are currently based, to solve corresponding technical problems and achieve corresponding effects. They may also be combined with other features according to needs in some scenarios. Accordingly, the devices given in the embodiments of the present application may also realize these features or functions accordingly, which will not be described in detail here.
[0281] In this application, unless otherwise specified, the same or similar parts between the various embodiments can refer to each other. In the various embodiments of this application, if there is no special description and logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships. The following implementation methods of this application do not constitute a limitation on the scope of protection of this application.
Claims
1. A data processing method, characterized in that: include: Obtaining a code stream, wherein the code stream does not include an anti-counterfeiting code; Processing the encrypted basic unit of the code stream according to a first security parameter to obtain a first encrypted basic unit, wherein the first security parameter includes a first initialization vector and a key; In the case where the first encrypted basic unit includes a pseudo start code, updating the first initialization vector to obtain a second initialization vector; Processing the encrypted basic unit of the code stream according to a second security parameter to obtain a second encrypted basic unit, wherein the second security parameter includes the second initialization vector and the key; In the case where the second encrypted basic unit does not include the pseudo start code, an encrypted code stream is sent, the encrypted code stream including the second encrypted basic unit.
2. The method according to claim 1, characterized in that: The method further comprises: When the (n-1)th encrypted basic unit includes a pseudo start code, updating the first initialization vector to obtain an nth initialization vector, where n is a positive integer greater than or equal to 3; Processing the encrypted basic unit of the code stream according to an nth security parameter to obtain an nth encrypted basic unit, wherein the nth security parameter includes the nth initialization vector and the key; In the case that the nth encrypted basic unit does not include the pseudo start code, an encrypted code stream is sent, the encrypted code stream including the nth encrypted basic unit.
3. The method according to claim 2, characterized in that The method further comprises: When the nth encrypted basic unit includes a pseudo start code, updating the first initialization vector to obtain an n+1th initialization vector; Processing the encrypted basic unit of the code stream according to the n+1th security parameter to obtain the n+1th encrypted basic unit, wherein the n+1th security parameter includes the n+1th initialization vector and the key; In the case that the n+1th encrypted basic unit does not include the pseudo start code, an encrypted code stream is sent, and the encrypted code stream includes the n+1th encrypted basic unit.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: In the case that the first encrypted basic unit does not include the pseudo start code, an encrypted code stream is sent, the encrypted code stream including the first encrypted basic unit.
5. The method according to any one of claims 1 to 4, characterized in that The leading data of the n-1th encrypted basic unit includes the n-1th initialization vector, where n is a positive integer greater than or equal to 3.
6. The method according to any one of claims 1 to 4, characterized in that The encrypted code stream includes extended enhancement information, and the extended enhancement information includes an n-1th initialization vector, and a starting position and a length of an n-1th encrypted basic unit.
7. The method according to any one of claims 1 to 4, characterized in that The leading data of the n-1th encrypted basic unit includes a change factor for generating the n-1th initialization vector.
8. The method according to any one of claims 1 to 4, characterized in that The encrypted code stream includes extended enhancement information, and the extended enhancement information includes a change factor for generating an n-1th initialization vector.
9. The method according to any one of claims 1 to 8, characterized in that Updating the first initialization vector to obtain an n-1th initialization vector includes: An n-1th initialization vector is incrementally generated according to the first initialization vector.
10. The method according to any one of claims 1 to 8, characterized in that Updating the first initialization vector to obtain an n-1th initialization vector includes: An n-1th initialization vector is generated according to the identifier of the encryption basic unit, where the identifier of the encryption basic unit includes a starting position and a length of the encryption basic unit.
11. The method according to any one of claims 1 to 10, characterized in that The encryption basic unit is any one of NAL, LU or AU.
12. A data processing method, characterized in that: include: receiving an encrypted code stream, the encrypted code stream comprising an encrypted basic unit and a security parameter, the security parameter comprising an initialization vector or a variation factor for generating the initialization vector; Decrypting the encrypted basic unit according to the security parameter to obtain a decrypted encrypted basic unit; The decrypted encryption basic unit is decoded to obtain decoded data.
13. The method according to claim 12, characterized in that The leading data of the encrypted basic unit includes the initialization vector or the variation factor.
14. The method according to claim 12, characterized in that The encrypted code stream includes extended enhancement information, and the extended enhancement information includes the change factor or the initialization vector and the starting position and length of the encrypted basic unit.
15. The method according to any one of claims 12 to 14, characterized in that: The security parameter also includes an identifier of a key, and the key is used to decrypt the encrypted basic unit.
16. A data processing device, characterized in that: The data processing device includes at least one processor and a memory, wherein the memory is used to store a computer program so that when the computer program is executed by the at least one processor, it implements the method as described in any one of claims 1 to 11, or so that when the computer program is executed by the at least one processor, it implements the method as described in any one of claims 12 to 15.
Citation Information
Cited By
Data security processing method and device, computer equipment and storage medium
CN120524529A