CN106231318B - Video scrambling method and device based on quantized transform coefficients - Google Patents

Video scrambling method and device based on quantized transform coefficients Download PDF

Info

Publication number
CN106231318B
CN106231318B CN201610871985.4A CN201610871985A CN106231318B CN 106231318 B CN106231318 B CN 106231318B CN 201610871985 A CN201610871985 A CN 201610871985A CN 106231318 B CN106231318 B CN 106231318B
Authority
CN
China
Prior art keywords
quantized transform
block
positive
bit
bit string
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610871985.4A
Other languages
Chinese (zh)
Other versions
CN106231318A (en
Inventor
吴参毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201610871985.4A priority Critical patent/CN106231318B/en
Publication of CN106231318A publication Critical patent/CN106231318A/en
Application granted granted Critical
Publication of CN106231318B publication Critical patent/CN106231318B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/40Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
    • H04L9/0631Substitution permutation network [SPN], i.e. cipher composed of a number of stages or rounds each involving linear and nonlinear transformations, e.g. AES algorithms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/18Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a set of transform coefficients
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/91Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2347Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving video stream encryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4405Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving video stream decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast

Abstract

The invention discloses a video scrambling method and a device based on a quantized transform coefficient, wherein the method constructs a bit string according to the positive and negative signs and position information of the quantized transform coefficient in a transform block to generate a plaintext data block to be encrypted; encrypting the generated plaintext data block to generate an encrypted ciphertext; and converting the bit corresponding to the non-zero quantized transform coefficient in the encrypted ciphertext into a new positive symbol and a new negative symbol for entropy coding. The device comprises a plaintext data block generation module, an encryption module and an entropy coding module. The method and the device of the invention meet the function of information scrambling or information descrambling by scrambling the positive and negative symbols of the quantized transformation coefficient, meet the condition of software multithreading by reasonably decomposing scrambling/descrambling and realize real-time and rapid transcoding.

Description

Video scrambling method and device based on quantized transform coefficients
Technical Field
The invention belongs to the technical field of video scrambling, and particularly relates to a video scrambling method and device based on quantized transform coefficients.
Background
In video surveillance, information security is becoming increasingly important. It is important to prevent the video images transmitted and stored in the video monitoring system from being still unable to see the image information under the premise of being accessed by unauthorized users. To achieve the purpose, the video image coded by the front-end equipment ipc (ip camera) must be scrambled under the premise of format compatibility (i.e. the code stream still is compatible with the MPEG-4/h.264/h.265 standard and can still be decoded by a decoder compatible with the MPEG-4/h.264/h.265 standard).
Because the current IPC coding chip does not support the video scrambling function, the video scrambling processing needs to carry out quick transcoding on the code stream output by the coding chip in the IPC in a software mode, namely, the real-time performance is met while transcoding and scrambling are carried out.
The most direct method is to scramble the video image with the same general text data by using a DES (data encryption Standard) algorithm, so that the overall efficiency of scrambling is improved. However, these conventional encryption algorithms are computationally complex, and the data size of video data is large, resulting in a slow operation speed. Therefore, scrambling the quantized transform coefficients after quantization and before entropy coding is a scrambling method which is frequently studied, and the method does not have a large image of the compression ratio and the code rate, thereby obtaining a very good encryption effect.
However, in the prior art, when the quantized transform coefficients are scrambled, the quantized transform coefficients are directly scrambled. However, when the code rate before and after scrambling is kept unchanged, the transcoding scrambling method cannot perform parallel processing due to the serial nature of coding and decoding of quantized transform coefficients when the code rate before and after scrambling is realized by software in a processor CPU in the IPC, and the real-time performance is seriously influenced.
Disclosure of Invention
The invention aims to provide a video scrambling method and a video scrambling device based on a quantized transform coefficient, which achieve a video scrambling effect by scrambling positive and negative symbols of the quantized transform coefficient and can avoid the defects of complex algorithm and high system overhead in the prior art.
In order to achieve the purpose, the technical scheme of the invention is as follows:
a video scrambling method based on quantized transform coefficients, the video scrambling method comprising:
constructing a bit string according to the positive and negative signs and the position information of the quantized transform coefficients in the transform block, and generating a plaintext data block to be encrypted;
encrypting the generated plaintext data block to generate an encrypted ciphertext;
and converting the bit corresponding to the non-zero quantized transform coefficient in the encrypted ciphertext into a new positive symbol and a new negative symbol for entropy coding.
Further, the generated plaintext data block is encrypted by adopting a symmetric encryption algorithm, and the plaintext and the ciphertext have the same length.
Further, the plaintext data block is a bit string having a fixed length, and the constructing the bit string based on the sign and the position information of the quantized transform coefficients in the transform block includes:
scanning the quantized transform coefficients in the transform block according to a set sequence, and sequentially arranging bit values corresponding to the positive and negative signs of the quantized transform coefficients to construct a bit string;
when the bit string length corresponding to the quantized transform coefficient in the transform block is less than the fixed length, filling the bit string to the fixed length;
when the length of a bit string corresponding to a quantized transform coefficient in a transform block exceeds a fixed length, splitting the bit string according to the fixed length and splitting the bit string into a plurality of bit strings;
converting the bit corresponding to the non-zero quantized transform coefficient in the encrypted ciphertext into a new positive or negative symbol, further comprising:
and removing the bit corresponding to the zero value coefficient and the filled bit in the encrypted ciphertext.
Before the method for scrambling video according to the present invention constructs bit strings and generates plaintext data block to be encrypted by quantizing the positive and negative signs and position information of transform coefficients in transform blocks, the method further comprises:
and carrying out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and position information of the quantized transform coefficients in the transform block.
Further, the video scrambling method adopts different threads to process in parallel, and comprises the following steps:
the first thread carries out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and position information of the quantized transform coefficient in the transform block;
the second thread constructs a bit string according to the positive and negative symbols and the position information of the quantization transformation coefficient in the transformation block, generates a plaintext data block to be encrypted, encrypts the generated plaintext data block to generate an encrypted ciphertext, and converts the bit corresponding to the nonzero quantization transformation coefficient in the encrypted ciphertext into a new positive and negative symbol;
the third thread performs entropy coding;
the second thread processing time sequence is after the first thread processing time sequence, the third thread processing time sequence is after the second thread processing time sequence, and the first thread and the third thread share the context statistical information of the same transformation block.
The invention also proposes a video scrambling device based on quantized transform coefficients, said video scrambling device comprising:
a plaintext data block generation module, configured to construct a bit string according to the positive and negative signs and the position information of the quantized transform coefficients in the transform block, and generate a plaintext data block to be encrypted;
the encryption module is used for encrypting the generated plaintext data block to generate an encrypted ciphertext;
and the entropy coding module is used for converting the bit corresponding to the nonzero quantized transform coefficient in the encrypted ciphertext into a new positive symbol and a new negative symbol for entropy coding.
Further, the encryption module encrypts the generated plaintext data block by using a symmetric encryption algorithm, and the plaintext and the ciphertext have the same length.
Further, the plaintext data block is a bit string with a fixed length, and the plaintext data block generation module performs the following operations when constructing the bit string according to the sign and the position information of the quantized transform coefficients in the transform block:
scanning the quantized transform coefficients in the transform block according to a set sequence, and sequentially arranging bit values corresponding to the positive and negative signs of the quantized transform coefficients to construct a bit string;
when the bit string length corresponding to the quantized transform coefficient in the transform block is less than the fixed length, filling the bit string to the fixed length;
when the length of a bit string corresponding to a quantized transform coefficient in a transform block exceeds a fixed length, splitting the bit string according to the fixed length and splitting the bit string into a plurality of bit strings;
the entropy coding module converts the bit corresponding to the non-zero quantized transform coefficient in the encrypted ciphertext into a new positive or negative symbol, and further performs the following operations:
and removing the bit corresponding to the zero value coefficient and the filled bit in the encrypted ciphertext.
The video scrambling apparatus of the present invention further comprises:
and the entropy decoding module is used for carrying out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and the position information of the quantized transform coefficients in the transform block.
Further, the entropy decoding module, the plaintext data block generating module, the encrypting module and the entropy coding module of the video scrambling device perform parallel processing according to the following threads:
the first thread carries out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and position information of the quantized transform coefficient in the transform block;
the second thread constructs a bit string according to the positive and negative symbols and the position information of the quantization transformation coefficient in the transformation block, generates a plaintext data block to be encrypted, encrypts the generated plaintext data block to generate an encrypted ciphertext, and converts the bit corresponding to the nonzero quantization transformation coefficient in the encrypted ciphertext into a new positive and negative symbol;
the third thread performs entropy coding;
the second thread processing time sequence is after the first thread processing time sequence, the third thread processing time sequence is after the second thread processing time sequence, and the first thread and the third thread share the context statistical information of the same transformation block.
The invention provides a video scrambling method and a device based on a quantized transform coefficient, which scramble positive and negative symbols of the quantized transform coefficient after DCT (discrete cosine transformation), particularly scramble symbols of non-zero quantized transform coefficients by using a symmetric encryption algorithm, realize high-strength scrambling/descrambling transcoding of entropy code streams of unit blocks on the premise of meeting the compatibility of video formats such as H.264/H.265 and the like without changing code rates, meet the functions of information hiding (scrambling) or information recovery (descrambling), simultaneously meet the multithreading condition of software by reasonably decomposing a scrambling/descrambling module, create conditions for meeting the requirements of real-time performance transcoding, and realize real-time and rapid transcoding.
Drawings
FIG. 1 is a block diagram of a normal video encoding and decoding process in the prior art;
FIG. 2 is a block diagram of a video encoding/decoding process according to the present invention;
FIG. 3 is a flow chart of a video scrambling method based on quantized transform coefficients according to the present invention;
FIGS. 4 a-4 d are schematic diagrams of the construction of plaintext data blocks according to an embodiment of the invention;
FIG. 5 is a diagram illustrating the corresponding conversion between symbols and identification bits during scrambling according to an embodiment of the present invention;
FIG. 6 is a flow chart of a scrambling and descrambling process according to another embodiment of the present invention;
FIG. 7 is a diagram of parallel processing according to the present invention;
FIG. 8 is a schematic diagram of a video scrambling apparatus based on quantized transform coefficients according to the present invention.
Detailed Description
The technical solutions of the present invention are further described in detail below with reference to the drawings and examples, which should not be construed as limiting the present invention.
As shown in fig. 1, when a normal video image is encoded, Discrete Cosine Transform (DCT), quantization and entropy coding processes are required; in decoding, processes of entropy decoding, inverse quantization and Inverse Discrete Cosine Transform (IDCT) are required.
For h.264 encoding, the basic unit of encoding is a macroblock (MicroBlock), and the luminance portion pixel size is 16 × 16. For h.265 Coding, the Coding unit is Coding tree unit (Coding tree unit), the maximum Coding tree unit luminance part pixel size is 64x64, and the minimum Coding tree unit luminance part pixel size is 8x 8. There are two transform block sizes for h.264 quantized transform, 4x4 transform and 8x8 transform, respectively, and 4x4, 8x8, 16x16, 32x32 for h.265 quantized transform.
For a 16x16 macroblock of h.264, if an 8x8 transform is adopted, 4 8x8 transforms are contained in total; if a 4x4 transform is used, there are 16 total transforms of 4x 4. The 8x8 transform has 64 Quantized transform coefficients (Quantized TransformCoefficience) and the 4x4 transform has 16 Quantized transform coefficients.
Coding units (Coding units) formed by leaf nodes of H.265 quadtree partitioning correspond to transform units (transform units), and transform blocks in the transform units can be further quadtree partitioned into transform blocks with the transform block sizes of 4x4, 8x8, 16x16 and 32x32, and have 16, 64, 128 and 256 transform coefficients respectively.
For the quantized transform coefficients, for convenience of description, in this embodiment, the quantized transform coefficients are also referred to as coefficients or transform coefficients, and are not described in detail later.
When entropy coding is performed on Quantized Transform coefficients (Quantized Transform coefficients), whether entropy coding (CAVLC or CABAC) in h.264 or entropy coding (CABAC) in h.265, the Quantized Transform coefficients are first scanned in a certain order and then entropy coding is performed, and the positions of all non-zero coefficients, the absolute value and the signs of each non-zero coefficient need to be coded. So the syntax elements in the entropy stream of a transform block contain the positions, signs, and absolute values of all non-zero quantized transform coefficients. By decoding these syntax elements, the sign and position information of all non-zero coefficients can be obtained.
The general idea of the invention is to scramble the positive and negative signs of the quantized transform coefficients before entropy coding the positive and negative signs of the quantized transform coefficients. As shown in fig. 2, when a video image is encoded, after Discrete Cosine Transform (DCT) and quantization, the sign of the quantized transform coefficient is scrambled and then output through entropy encoding; in decoding, after entropy decoding, descrambling is performed, and then video images are decoded through inverse quantization and Inverse Discrete Cosine Transform (IDCT).
In this embodiment, for scrambling positive and negative symbols of a quantized transform coefficient, an AES encryption algorithm in a standard CFB mode (Cipherfeedback) is used, and an AES decryption algorithm in a standard CFB mode is used for descrambling. Other symmetric encryption algorithms can also be adopted, namely the plaintext and the ciphertext have the same length, and the plaintext and the ciphertext correspond to each other according to bits. In this embodiment, an AES encryption algorithm in the CFB mode is taken as an example for description, and an AES encryption algorithm in an Electronic Codebook (ECB), a Cipher Block Chaining (CBC), an Output Feedback (OFB) mode, or other symmetric encryption algorithms such as ROT13 may also be used.
The AES encryption algorithm encrypts the plaintext data block Xi by using the key to obtain an encrypted data block Yi. When decrypting, the encrypted data block Yi is decrypted by using the key, and the plaintext data block is recovered, and the AES decryption and decryption algorithm is not described herein again.
As shown in fig. 3, the present embodiment is a video scrambling method based on quantized transform coefficients, including the following steps:
step S1 is to construct a bit string based on the sign and position information of the quantized transform coefficients in the transform block, and generate a plaintext data block to be encrypted.
In order to scramble the quantized transform coefficients by using the AES encryption and decryption algorithm while keeping the code rate unchanged, the present embodiment needs to construct plaintext data blocks. When a plaintext data block is constructed, the signs are converted into corresponding identification bits according to the sign and the position information of the quantized transform coefficients and the conversion relation between the identification bits and the signs.
In this embodiment, two types of conversion relationships between the flag bits and the positive/negative symbols are enumerated to realize the conversion between the positive/negative symbols and the flag bits, which are respectively described as follows:
the first rule is: for the quantized transform coefficient, the non-zero coefficient is represented by a bit "1" as "positive", the non-zero coefficient is represented by a bit "0" as "negative", and the zero-valued transform coefficient is identified by a bit "0". For coefficients that are skipped by the transform (without the transform step), the "0" flag is used throughout.
The second rule is: for quantized transform coefficients, the non-zero coefficient is represented by a bit "1", and a zero-valued transform coefficient is identified by a bit "0" regardless of whether its sign is "positive" or "negative". For coefficients skipped by the transform, all use the "0" flag.
According to the AES algorithm, the plaintext data block length must be 128 bits. In this embodiment, quantized transform coefficients in a transform block are scanned in a predetermined order, and bit values corresponding to the signs of the quantized transform coefficients are sequentially arranged to construct a bit string. The generation of a plaintext data block to be encrypted having a length of 128 bits from the positive and negative signs and position information of the coefficients in the quantized transform block is described below by way of specific examples:
as shown in fig. 4a, for a 4 × 4 transform block, after scanning according to the DTC scanning order specified in h.264/h.265, a one-dimensional quantized transform coefficient is obtained, and there are 16 coefficients in total, this embodiment designs a 16-bit non-zero coefficient identification double byte, as shown in fig. 4b, a DC coefficient symbol identification bit is placed at the most significant bit MSB, and so on, and an AC coefficient symbol identification bit with the highest frequency is placed at the least significant bit LSB. As shown in fig. 4c, for an 8x8 transform block, the transform block is divided into 2x 24 x4 transform blocks, the QTC scanning order of the 4x4 block is assumed as shown in fig. 4c, then the identification bits of the non-zero coefficients of the 2x 24 x4 transform blocks are shown in fig. 4d, the non-zero coefficients of each 4x4 block coefficient are identified as shown in fig. 4b, and then the identification bits of the first 4x4 transform block, then the identification bits of the second 4x4 transform block, and so on are placed in the scanning order according to fig. 4 c.
Similarly, for the 16x16 transform block and the 32x32 transform block, the transform blocks are scanned according to the h.264/h.265 specified scanning order, then the two-dimensional coefficient matrix is scanned for one dimension for the bottom layer 4 × 4 transform coefficient, and the coefficient symbol of each scanned position is identified by one bit, so as to obtain the coefficient symbol mark bit string of each coding block, which is not described herein again.
In the AES algorithm, the length of a plaintext data block Xi is 128 bits, and for a 4x4 transformation block, the maximum number of coefficients obtained after transformation is 16. For an 8x8 block, the maximum number of coefficients obtained after transformation is 64. For a 16x16 block, the maximum number of coefficients obtained after transformation is 256, and the 2 blocks of plaintext data need to be divided. For a 32x32 block, the transform coefficients are at most 1024, which requires splitting into 8 blocks of plaintext data.
When the length of the bit string corresponding to the quantized transform coefficient in the transform block is less than the fixed length, filling the bit string to the fixed length; when the bit length corresponding to the quantized transform coefficient in the transform block exceeds a fixed length, the transform block is divided into a plurality of bit strings according to the fixed length.
H.264 takes macroblocks as coding units, the luma block size is 16x16, and the chroma blocks are two 16x16(4:4:4), or two 16x8(4:2:2), or two 8x8(4:2: 0).
H.265 as the largest coding tree unit is the coding unit with the luminance size of 8x8, 16x16, 32x32 and 64x64, and the chroma blocks are two 8x8, 16x16, 32x32 and 64x64(4:4:4), or two 8x4, 16x8, 32x16 and 64x32(4:2:2), or two 4x4, 8x8, 16x16 and 32x32(4:2: 0).
When a plaintext data block is formed using the AES algorithm, the coefficient symbol identification bit is shifted into a bit string in the order of the luminance block first and the chrominance block, and the bit "0" is filled after less than 128 bits. One or more coding unit coefficient symbol identification bit strings together form a bit string.
Step S2 is to encrypt the generated plaintext data block and generate an encrypted ciphertext.
In this embodiment, for scrambling positive and negative symbols of a quantized transform coefficient, an AES encryption algorithm in a standard CFB mode (Cipherfeedback) is used, and an AES decryption algorithm in a standard CFB mode is used for descrambling. The AES encryption algorithm encrypts the plaintext data block Xi by using the key to obtain an encrypted data block Yi. And during decryption, the encrypted data block Yi is decrypted by using the key, and the plaintext data block is recovered.
And step S3, converting the bit corresponding to the non-zero quantized transform coefficient in the encrypted ciphertext into a new positive and negative symbol, and performing entropy coding.
As shown in fig. 5, taking an 8-bit quantized transform coefficient as an example (which should actually be supplemented to 128 bits), in step S1, the quantized transform coefficient is transformed into a plaintext data block Xi according to a set rule, where the transform rule is that the sign is "positive" corresponding to a bit value "1", the sign is "negative" corresponding to a bit value characteristic "0", and the bit value corresponding to the zero-valued coefficient is "0", that is, the transform is performed according to a first rule to obtain 10101000, and the plaintext data block is a string of bits. Subsequently, in step S2, the ciphertext Yi is generated to be 01011101.
In this step, for the encrypted ciphertext, according to the position information of the quantized transform coefficient, the bits corresponding to the zero-valued coefficient and the padded bits, i.e., the last two bits (i.e., the residue 010111) are removed, the bits corresponding to the remaining non-zero coefficient are analyzed for sign positivity and negativity according to the rule (i.e., the first rule) set before AES encryption, and the new positive and negative signs corresponding to the non-zero coefficient to be entropy-coded are obtained as "negative positive, positive and positive", and then entropy coding is performed using the new positive and negative signs.
At this point, scrambling of the quantized transform coefficients is completed. Correspondingly, at the decoding end, the flow is opposite, firstly, entropy decoding is carried out, then, the positive and negative symbols after entropy decoding are converted into the ciphertext Yi, and then, decryption is carried out, and the ciphertext Yi is converted back into the original positive and negative symbols. The specific implementation process is opposite to the scrambling process, and is not described in detail here.
It should be noted that, in the present embodiment, h.264/h.265 is taken as an example for description, but the scheme is not limited to h.264/h.265, and is also applicable to Video codec standards such as MPEG-2 Video, MPEG-1 Video, or Future Video Coding.
Meanwhile, the plaintext data block Xi is in a case where the resolution of the chrominance plane is lower than that of the luminance plane, such as 4:2:0 chrominance format, or even a 4:0:0 gray image having only a luminance component and no chrominance component. Therefore, the plaintext Xi may include a luma component block and a corresponding chroma component block, or may include only the luma component block and not the chroma component block, one reason being that the chroma component block has a low resolution and does not need to be scrambled; another source is that there may be some images that do not have chrominance component parts.
Since the current video encoding devices (such as IPC) do not generally have a video scrambling function, the video decoding devices (such as NVR) do not have a video descrambling function either. I.e. the video codec ASIC in the codec device does not have hardware scrambling and descrambling functionality. The scrambling or descrambling function needs to be implemented by using software, so at the encoding end, the entropy code stream after entropy encoding under the normal condition without scrambling usually needs to be decoded first, and then the video scrambling method based on the quantized transform coefficient of the embodiment is adopted for scrambling. Correspondingly, for the decoding end, entropy decoding is required to be carried out firstly, then descrambling is carried out, normal entropy code streams are formed after entropy coding, and decoding is carried out by decoding end equipment. Therefore, the technical scheme set forth in the embodiment can be realized only by upgrading software on the existing video equipment, and the video equipment is completely compatible with the existing video equipment.
As shown in fig. 6, a non-scrambled entropy code stream output by an existing video coding device needs to be entropy decoded to obtain a quantized transform coefficient of a current transform block, i.e. position information of all non-zero coefficients (decoding the entropy code stream to obtain mapping tables of all non-zero coefficients, absolute value values of the non-zero coefficients, and symbols of the non-zero coefficients), and then, according to a conversion relationship between an identification bit and a positive/negative symbol, the corresponding identification bit of the non-zero coefficient of the current transform block is identified to generate a plaintext data block; generating one or more plaintext data blocks { Xi, Xi +1} corresponding to the current data block according to the difference of the sizes of the transformation blocks, and obtaining corresponding ciphertext data blocks { Yi, Yi +1} by using AES encryption and an encrypted password key; and finally, analyzing the symbols of the non-zero coefficients in the ciphertext data block according to the original conversion relation between the identification bits and the positive and negative symbols, simultaneously eliminating the position symbols of the zero-valued coefficients and the filled position symbols, and performing entropy coding on the non-zero-valued coefficients.
When descrambling the scrambled entropy code stream, firstly decoding the quantized transform coefficient of the current transform block to obtain the position information of all non-zero coefficients (the scrambled entropy code stream already knows the mapping tables, the absolute value values and the symbols of the non-zero coefficients of all the non-zero coefficients), identifying the identification bits of the non-zero coefficients of the current block according to the conversion relation between the identification bits and the positive and negative symbols, and generating one or more ciphertext data blocks { Yi, Yi +1} corresponding to the current transform block; obtaining a corresponding plaintext data block { Xi, Xi +1} by using AES decryption and corresponding password key decryption; and finally, analyzing the non-zero coefficient position symbols in the plaintext data blocks according to the original conversion relation between the identification bits and the positive and negative symbols, and performing entropy coding on the non-zero coefficient symbols again.
It is easily understood that, with the above method, the scrambling/descrambling is performed by entropy decoding, then scrambling/descrambling, and then entropy re-encoding. Therefore, for the modification of the existing video device, through the multi-thread parallel processing, as shown in fig. 7, three threads can be established:
thread 1 is used for entropy code stream decoding of the transform block (decoding all non-zero coefficient positions, all non-zero coefficient absolute values and all non-zero coefficient symbols);
thread 2 uses AES algorithm to scramble/descramble the non-zero coefficient symbol identification bits of the transform block;
thread 3 is used for entropy re-encoding of the scrambled coefficients of the non-zero coefficient symbols of the transform block (encoding all non-zero coefficient positions, all non-zero coefficient absolute values, all non-zero coefficient symbols scrambled).
In this embodiment, the time sequences of the threads 1, 2, and 3 are different, and after the thread 1 completes decoding the entropy code stream of the transform block 1 (block 1 for short), the thread 2 starts to process scrambling/descrambling of the non-zero coefficient symbol flag of the block 1, and similarly, after the thread 2 completes processing the block 1, the thread 3 starts to process the entropy re-encoding process of the block 1.
It is easy to understand that, when entropy encoding and entropy code stream decoding are performed, context statistics information of the same transform block can be shared, and the context statistics information, namely, a symbol probability table is obtained according to contexts, and the probability of each symbol in the probability table changes with the occurrence of the symbol. Entropy coding of the block 1 of the thread 3 in the time sequence is started after the entropy code stream decoding processing is finished, and the common time sequence condition is met.
It is worth noting that, during decoding, the quantized transform coefficient of the technical scheme can be obtained directly after quantization conversion, and can also be obtained by decoding from the entropy code stream in the prior art; in decoding, for the video device of the prior art, after descrambling, the entropy coding process needs to be performed again. Therefore, the technical scheme is compatible with the existing video equipment, can perform parallel processing and creates conditions for meeting the real-time performance transcoding requirement.
As shown in fig. 8, a video scrambling apparatus based on quantized transform coefficients corresponding to the above method includes:
a plaintext data block generation module, configured to construct a bit string according to the positive and negative signs and the position information of the quantized transform coefficients in the transform block, and generate a plaintext data block to be encrypted;
the encryption module is used for encrypting the generated plaintext data block to generate an encrypted ciphertext;
and the entropy coding module is used for converting the bit corresponding to the nonzero quantized transform coefficient in the encrypted ciphertext into a new positive symbol and a new negative symbol for entropy coding.
Corresponding to the above method, the encryption module in the apparatus of this embodiment encrypts the generated plaintext data block, and a symmetric encryption algorithm is adopted, so that the plaintext and the ciphertext have the same length.
The plaintext data block is a bit string with fixed length, and when the plaintext data block generation module constructs the bit string according to the positive and negative signs and the position information of the quantized transform coefficients in the transform block, the following operations are executed:
scanning the quantized transform coefficients in the transform block according to a set sequence, and sequentially arranging bit values corresponding to the positive and negative signs of the quantized transform coefficients to construct a bit string;
when the bit string length corresponding to the quantized transform coefficient in the transform block is less than the fixed length, filling the bit string to the fixed length;
when the length of a bit string corresponding to a quantized transform coefficient in a transform block exceeds a fixed length, splitting the bit string according to the fixed length and splitting the bit string into a plurality of bit strings;
the entropy coding module in this embodiment converts the bit corresponding to the non-zero quantized transform coefficient in the encrypted ciphertext into a new positive or negative symbol, and further performs the following operations:
and removing the bit corresponding to the zero value coefficient and the filled bit in the encrypted ciphertext.
In order to be compatible with existing equipment, the video scrambling apparatus of this embodiment further includes:
and the entropy decoding module is used for carrying out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and the position information of the quantized transform coefficients in the transform block.
And the video scrambling device entropy decoding module, the plaintext data block generating module, the encrypting module and the entropy coding module are processed in parallel according to the following threads:
the first thread carries out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and position information of the quantized transform coefficient in the transform block;
the second thread constructs a bit string according to the positive and negative symbols and the position information of the quantization transformation coefficient in the transformation block, generates a plaintext data block to be encrypted, encrypts the generated plaintext data block to generate an encrypted ciphertext, and converts the bit corresponding to the nonzero quantization transformation coefficient in the encrypted ciphertext into a new positive and negative symbol;
the third thread performs entropy coding;
and the first thread and the third thread share the context statistical information of the same transformation block.
It should be noted that the video scrambling apparatus of this embodiment is applied in the front-end device IPC or the video stream encoding device. Correspondingly, in the decoding apparatus, for example, the video recorder NVR has a corresponding video descrambling device, which is used to descramble the scrambled video stream, and the descrambling process is described in the description of the scrambling method, and is not described herein again.
The above embodiments are only for illustrating the technical solution of the present invention and not for limiting the same, and those skilled in the art can make various corresponding changes and modifications according to the present invention without departing from the spirit and the essence of the present invention, but these corresponding changes and modifications should fall within the protection scope of the appended claims.

Claims (10)

1. A video scrambling method based on quantized transform coefficients, the video scrambling method comprising:
scanning the quantized transform coefficients in the transform block according to a set sequence according to the positive and negative signs and the position information of the quantized transform coefficients in the transform block, sequentially arranging bit values corresponding to the positive and negative signs of the quantized transform coefficients, constructing a bit string, and generating a plaintext data block to be encrypted;
encrypting the generated plaintext data block by adopting a symmetric encryption algorithm to generate an encrypted ciphertext;
and converting the bit corresponding to the non-zero quantized transform coefficient in the encrypted ciphertext into a new positive symbol and a new negative symbol for entropy coding.
2. The method of claim 1, wherein the generated plaintext data blocks are encrypted by a symmetric encryption algorithm, and the plaintext and ciphertext have the same length.
3. The method of claim 2, wherein the plaintext data block is a bit string having a fixed length, and the constructing the bit string based on the sign and position information of the quantized transform coefficients in the transform block comprises:
scanning the quantized transform coefficients in the transform block according to a set sequence, and sequentially arranging bit values corresponding to the positive and negative signs of the quantized transform coefficients to construct a bit string;
when the bit string length corresponding to the quantized transform coefficient in the transform block is less than the fixed length, filling the bit string to the fixed length;
when the length of a bit string corresponding to a quantized transform coefficient in a transform block exceeds a fixed length, splitting the bit string according to the fixed length and splitting the bit string into a plurality of bit strings;
converting the bit corresponding to the non-zero quantized transform coefficient in the encrypted ciphertext into a new positive or negative symbol, further comprising:
and removing the bit corresponding to the zero value coefficient and the filled bit in the encrypted ciphertext.
4. The method of claim 1, wherein the method further comprises, before constructing a bit string from the positive and negative signs and the position information of the quantized transform coefficients in the transform block to generate the plaintext data block to be encrypted:
and carrying out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and position information of the quantized transform coefficients in the transform block.
5. The method of claim 4, wherein the video scrambling method employs different threads for parallel processing, and comprises:
the first thread carries out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and position information of the quantized transform coefficient in the transform block;
the second thread constructs a bit string according to the positive and negative symbols and the position information of the quantization transformation coefficient in the transformation block, generates a plaintext data block to be encrypted, encrypts the generated plaintext data block to generate an encrypted ciphertext, and converts the bit corresponding to the nonzero quantization transformation coefficient in the encrypted ciphertext into a new positive and negative symbol;
the third thread performs entropy coding;
the second thread processing time sequence is after the first thread processing time sequence, the third thread processing time sequence is after the second thread processing time sequence, and the first thread and the third thread share the context statistical information of the same transformation block.
6. A video scrambling apparatus based on quantized transform coefficients, the video scrambling apparatus comprising:
a plaintext data block generation module, configured to scan the quantized transform coefficients in the transform block according to a set order according to the positive and negative signs and position information of the quantized transform coefficients in the transform block, sequentially arrange bit values corresponding to the positive and negative signs of the quantized transform coefficients, construct a bit string, and generate a plaintext data block to be encrypted;
the encryption module is used for encrypting the generated plaintext data block by adopting a symmetric encryption algorithm to generate an encrypted ciphertext;
and the entropy coding module is used for converting the bit corresponding to the nonzero quantized transform coefficient in the encrypted ciphertext into a new positive symbol and a new negative symbol for entropy coding.
7. The video scrambling device based on the quantized transform coefficient as claimed in claim 6, wherein the encryption module encrypts the generated plaintext data block by using a symmetric encryption algorithm, and the plaintext and the ciphertext have the same length.
8. The apparatus as claimed in claim 7, wherein the plaintext data block is a bit string having a fixed length, and the plaintext data block generating module performs the following operations when constructing the bit string according to the sign and the position information of the quantized transform coefficient in the transform block:
scanning the quantized transform coefficients in the transform block according to a set sequence, and sequentially arranging bit values corresponding to the positive and negative signs of the quantized transform coefficients to construct a bit string;
when the bit string length corresponding to the quantized transform coefficient in the transform block is less than the fixed length, filling the bit string to the fixed length;
when the length of a bit string corresponding to a quantized transform coefficient in a transform block exceeds a fixed length, splitting the bit string according to the fixed length and splitting the bit string into a plurality of bit strings;
the entropy coding module converts the bit corresponding to the non-zero quantized transform coefficient in the encrypted ciphertext into a new positive or negative symbol, and further performs the following operations:
and removing the bit corresponding to the zero value coefficient and the filled bit in the encrypted ciphertext.
9. The quantized transform coefficient-based video scrambling device of claim 6, wherein the video scrambling device further comprises:
and the entropy decoding module is used for carrying out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and the position information of the quantized transform coefficients in the transform block.
10. The video scrambling device based on quantized transform coefficients of claim 9, wherein the video scrambling device entropy decoding module, plaintext data block generation module, encryption module and entropy coding module are processed in parallel according to the following threads:
the first thread carries out entropy decoding on the received entropy code stream to obtain the positive and negative symbols and position information of the quantized transform coefficient in the transform block;
the second thread constructs a bit string according to the positive and negative symbols and the position information of the quantization transformation coefficient in the transformation block, generates a plaintext data block to be encrypted, encrypts the generated plaintext data block to generate an encrypted ciphertext, and converts the bit corresponding to the nonzero quantization transformation coefficient in the encrypted ciphertext into a new positive and negative symbol;
the third thread performs entropy coding;
the second thread processing time sequence is after the first thread processing time sequence, the third thread processing time sequence is after the second thread processing time sequence, and the first thread and the third thread share the context statistical information of the same transformation block.
CN201610871985.4A 2016-09-30 2016-09-30 Video scrambling method and device based on quantized transform coefficients Active CN106231318B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610871985.4A CN106231318B (en) 2016-09-30 2016-09-30 Video scrambling method and device based on quantized transform coefficients

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610871985.4A CN106231318B (en) 2016-09-30 2016-09-30 Video scrambling method and device based on quantized transform coefficients

Publications (2)

Publication Number Publication Date
CN106231318A CN106231318A (en) 2016-12-14
CN106231318B true CN106231318B (en) 2020-04-28

Family

ID=58076841

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610871985.4A Active CN106231318B (en) 2016-09-30 2016-09-30 Video scrambling method and device based on quantized transform coefficients

Country Status (1)

Country Link
CN (1) CN106231318B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108366259B (en) * 2018-01-15 2020-04-07 华南理工大学 High-fidelity H.264/AVC video three-coefficient reversible steganography method
CN112003859B (en) * 2020-08-21 2023-04-07 江苏徐工工程机械研究院有限公司 Data encryption method and device and data decryption method and device
CN112565779B (en) * 2020-12-12 2021-10-29 四川大学 Video steganography method based on distortion drift

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102905133A (en) * 2012-10-15 2013-01-30 南京邮电大学 Video stream-oriented hybrid encoding and encrypting method
CN103856786A (en) * 2012-12-04 2014-06-11 中山大学深圳研究院 Streaming media video encryption method and device based on H.264
CN104038761A (en) * 2014-06-05 2014-09-10 宁波工程学院 Encrypted domain H.264/AVC video data hiding method based on CABAC binary string mapping
CN104247422A (en) * 2011-11-07 2014-12-24 华为技术有限公司 Angular Table for Improving Intra Prediction

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7774831B2 (en) * 2002-12-24 2010-08-10 International Business Machines Corporation Methods and apparatus for processing markup language messages in a network
US7684497B2 (en) * 2005-06-30 2010-03-23 Nokia Corporation Method and apparatus for generating M-ary CPM waveforms from a superposition of PAM waveforms
JP5590133B2 (en) * 2010-09-30 2014-09-17 富士通株式会社 Moving picture coding apparatus, moving picture coding method, moving picture coding computer program, moving picture decoding apparatus, moving picture decoding method, and moving picture decoding computer program
CN104093018B (en) * 2011-03-10 2017-08-04 华为技术有限公司 The coding method of conversion coefficient, the coding/decoding method of conversion coefficient, and device
CN107801041B (en) * 2011-06-16 2019-08-13 Ge视频压缩有限责任公司 Decoder, decoding and encoded video method
TW201335769A (en) * 2011-11-07 2013-09-01 Vid Scale Inc Video and data processing using even-odd integer transforms
CN103428495B (en) * 2013-08-02 2017-02-08 中国联合网络通信集团有限公司 Image encryption method and device and image decryption method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104247422A (en) * 2011-11-07 2014-12-24 华为技术有限公司 Angular Table for Improving Intra Prediction
CN102905133A (en) * 2012-10-15 2013-01-30 南京邮电大学 Video stream-oriented hybrid encoding and encrypting method
CN103856786A (en) * 2012-12-04 2014-06-11 中山大学深圳研究院 Streaming media video encryption method and device based on H.264
CN104038761A (en) * 2014-06-05 2014-09-10 宁波工程学院 Encrypted domain H.264/AVC video data hiding method based on CABAC binary string mapping

Also Published As

Publication number Publication date
CN106231318A (en) 2016-12-14

Similar Documents

Publication Publication Date Title
Shahid et al. Visual protection of HEVC video by selective encryption of CABAC binstrings
Shahid et al. Fast protection of H. 264/AVC by selective encryption of CAVLC and CABAC for I and P frames
Qin et al. Flexible lossy compression for selective encrypted image with image inpainting
US8503671B2 (en) Method and apparatus for using counter-mode encryption to protect image data in frame buffer of a video compression system
US6505299B1 (en) Digital image scrambling for image coding systems
Xu Commutative encryption and data hiding in HEVC video compression
CN1893350A (en) Method and device for encryption and decryption of digital data
EP2568712A1 (en) Methods and devices for selective format-preserving data encryption
US20110191587A1 (en) Media Processing Devices With Joint Encryption-Compression, Joint Decryption-Decompression, And Methods Thereof
CN106231318B (en) Video scrambling method and device based on quantized transform coefficients
Unterweger et al. Length-preserving Bit-stream-based JPEG Encryption
GB2526636A (en) Encoder, decoder and methods employing partial data encryption
CN111372083A (en) SHVC video encryption method based on interlayer processing
Lian et al. A fast video encryption scheme based-on chaos
Zhang et al. Fast HEVC selective encryption scheme based on improved CABAC coding algorithm
EP1478185A2 (en) A method of protecting image data in the frame buffer of video compression system
Hooda et al. A comprehensive survey of video encryption algorithms
El-Arsh et al. A new light-weight jpeg2000 encryption technique based on arithmetic coding
Ruchaud et al. ASePPI: Robust Privacy Protection Against De-Anonymization Attacks.
Zhao et al. A content-based encryption scheme for wireless H. 264 compressed videos
Lei et al. A new H. 264 video encryption scheme based on chaotic cipher
Saleh et al. Fast selective encryption for video stream of high efficiency video coding standard
Shahid et al. Fast protection of H. 264/AVC by selective encryption of CABAC for I & P frames
Tew et al. Joint selective encryption and data embedding technique in HEVC video
Varalakshmi et al. An enhanced encryption algorithm for video based on multiple Huffman tables

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant