Video encryption method capable of carrying secret information

文档序号:1448940 发布日期:2020-02-18 浏览:21次 中文

阅读说明:本技术 一种可搭载隐秘信息的视频加密方法 (Video encryption method capable of carrying secret information ) 是由 何军辉 梁剑 于 2019-10-15 设计创作,主要内容包括:本发明公开了一种可搭载隐秘信息的视频加密方法,包括:S1,获取待加密的YUV原始格式的视频文件;S2,逐帧对每一个宏块进行帧内预测或帧间预测,得到最优预测模式下的宏块类型、预测相关参数、CBP、量化指标以及残差系数;S3,将每帧的宏块划分为四个区域,分别为A1、A2、A3、A4,并将每一个区域的宏块按光栅扫描的方式线性排列;S4,获取用户的加密口令Key1,根据加密口令Key1通过伪随机数生成器生成一个伪随机密钥序列random1;本发明具有可抵抗各类轮廓攻击、提供更好的视觉加密效果,同时适用于未经压缩和已经过H.264压缩的视频等特点。(The invention discloses a video encryption method capable of carrying secret information, which comprises the following steps: s1, acquiring a video file in a YUV original format to be encrypted; s2, performing intra-frame prediction or inter-frame prediction on each macro block frame by frame to obtain a macro block type, prediction related parameters, CBPs (cubic boron complexes), quantization indexes and residual coefficients under an optimal prediction mode; s3, dividing the macro block of each frame into four areas, namely A1, A2, A3 and A4, and linearly arranging the macro blocks of each area in a raster scanning mode; s4, acquiring an encrypted password Key1 of a user, and generating a pseudorandom Key sequence random1 through a pseudorandom number generator according to the encrypted password Key 1; the invention has the characteristics of resisting various contour attacks, providing better visual encryption effect, being suitable for uncompressed and H.264 compressed videos and the like.)

1. A video encryption method capable of carrying hidden information is characterized by comprising the following steps:

s1, acquiring a video file in a YUV original format to be encrypted;

s2, performing intra-frame prediction or inter-frame prediction on each macro block frame by frame to obtain a macro block type, prediction related parameters, CBPs (cubic boron complexes), quantization indexes and residual coefficients under an optimal prediction mode;

s3, dividing the macro block of each frame into four areas, namely A1, A2, A3 and A4, and linearly arranging the macro blocks of each area in a raster scanning mode;

s4, acquiring an encrypted password Key1 of a user, and generating a pseudorandom Key sequence random1 through a pseudorandom number generator according to the encrypted password Key 1;

s5, calculating skip _ run of each non-skip macroblock in the A2 and A4 areas and I _ run of each non-skip type P/B macroblock; the skip _ run is represented by the number of adjacent skip macroblocks in front of the current non-skip macroblock, and the I _ run is represented by the number of I macroblocks between the P/B macroblock of the current non-skip type and the P/B macroblock of the previous non-skip type;

s6, scrambling all skip _ run according to the pseudo-random number sequence random1, and rearranging each macro block according to the scrambled skip _ run;

s7, scrambling all I _ run according to the pseudo-random number sequence random1, and rearranging each macro block according to the scrambled I _ run;

s8, scrambling all I macroblocks according to the pseudorandom number sequence random 1;

s9, keeping the CBP and residual coefficient of the P/B macroblock of non-skip type unchanged, scrambling the optimal macroblock mode, the prediction related parameter and the quantization step of the P/B macroblock of non-skip type according to the pseudo random number sequence random 1;

s10, randomly scrambling all types of macro blocks in the A3 area;

s11, reconstructing the macro blocks of the four areas into a frame in a raster scanning order, and then entropy coding the macro blocks one by one to complete the video encryption;

and S12, embedding the additional information to be embedded into the encrypted video, and completing the hiding of the additional information.

2. The method of claim 1, wherein the dividing each frame into four regions comprises: the macroblock in the first row and the first column of each frame is an a1 area, all macroblocks in the first row except a1 are an a2 area, all macroblocks in the first column except a1 are an A3 area, and all macroblocks in the whole frame except a1, a2 and A3 are an a4 area.

3. The method for video encryption capable of carrying hidden information according to claim 1, wherein the scrambling of all skip _ run according to the pseudo random number sequence random1 in step S6 comprises:

and (3) taking log (N) bits backward from a pseudorandom key sequence random1, wherein the log (N) is represented as T in decimal, wherein N is represented as the number of non-skip macroblocks, exchanging the values of a first skip _ run and a T% N skip _ run, wherein% is a modular operation, and sequentially exchanging the values of a second skip _ run and a third skip _ run according to the same method until the value of the Nth skip _ run is exchanged, thereby finishing the scrambling of all skip _ runs.

4. The method for video encryption capable of carrying hidden information according to claim 1, wherein the scrambling of all I _ run according to the pseudo random number sequence random1 in step S7 comprises:

taking log (K) bits backward from the pseudorandom key sequence random1, log (K) being denoted T in decimal, where K denotes the number of P/B macroblocks of non-skip type, exchanging the values of the first I _ run and the T% K I _ run, where% are modulo; and sequentially exchanging the values of the second … I _ run and the third … I _ run in the same method until the value of the K I _ run is exchanged, thereby completing the scrambling of all I _ runs.

5. The method for video encryption capable of carrying hidden information according to claim 1, wherein the scrambling of all I macroblocks according to the pseudo random number sequence random1 in step S8 comprises:

taking log (R) bits backward from the pseudorandom key sequence random1, expressing log (R) as T in decimal, where R is the number of I macroblocks, exchanging the positions of the first I macroblock and the T% R I macroblocks, where% is modulo; and sequentially exchanging the positions of the second … I macro block and the third … I macro block according to the same method until the position of the Rth I macro block is exchanged, and completing the scrambling of all I macro blocks.

6. The method for video encryption capable of carrying covert information according to claim 1, wherein said prediction related parameters comprise: intra prediction mode, reference frame index, and motion vector.

7. The method for video encryption capable of carrying hidden information according to claim 1, wherein the scrambling of the optimal macroblock mode, prediction related parameters, and quantization step size of the non-skip type P/B macroblock according to the pseudo random number sequence random1 in step S9 comprises:

taking log (M) bits backwards from a pseudorandom key sequence random1, expressing the log (M) as T in decimal, wherein M is the number of P/B macro blocks of non-skip type, and exchanging the optimal macro block mode, the prediction related parameters and the quantization step size of the first P/B macro block of non-skip type and the T% M P/B macro blocks of non-skip type, wherein% is modulo operation; and sequentially exchanging the information of the second and third … non-skip type P/B macro blocks according to the same method until the information of the Mth non-skip type P/B macro block is exchanged, and finishing the information scrambling of all non-skip type P/B macro blocks.

8. The method for video encryption capable of carrying hidden information according to claim 1, wherein the randomly scrambling all types of macroblocks in the A3 region in step S10 comprises:

taking log (X) bits backward from the pseudorandom key sequence random1, expressing log (X) as T in decimal, where X is the number of all macroblocks in the A3 region, exchanging the positions of the first macroblock and the T% X macroblocks, where% is modulo; the positions of the second and third … macroblocks are sequentially exchanged in the same way until the position of the Xth macroblock is exchanged, and the scrambling of all macroblocks in the A3 region is completed.

9. The method for encrypting video with stego information according to claim 1, wherein the step S12 of embedding the additional information to be embedded into the encrypted video comprises:

s121, converting the additional information to be embedded into a binary information sequence data 1;

s122, acquiring an information encryption password Key to be embedded 2 of a user, and generating a pseudorandom Key sequence seq2 with the same length as the information sequence data1 through a pseudorandom number generator algorithm according to the information encryption password Key2 to be embedded;

s123, serializing all non-zero coefficients in all non-skip type P/B macro blocks in a frame in a mode that macro blocks are scanned according to raster and non-zero coefficients are scanned according to zig-zag, and obtaining serialization C;

s124, carrying out exclusive OR operation on the binary information sequence data1 and the pseudo-random number sequence seq2 to generate a binary encryption information sequence data2, and embedding data in the binary encryption information sequence data2 according to the following rules:

when the suffixLength>1, if the binary encrypted information bit d to be embedded currentlyi0, the modified coefficient c'iAnd coefficient c before modificationiThe relationship of (1):

Figure FDA0002233747420000041

if the binary encrypted information bit d to be embedded currentlyiWhen 1, the modified coefficient c'iAnd coefficient c before modificationiThe relationship of (1):

wherein% is modulo arithmetic;

and S125, entropy coding the residual coefficient of the macro block and outputting the encrypted video bit stream embedded with the additional information.

10. The method for encrypting video according to claim 9, further comprising, after step S12: extracting the embedded additional information; the extracting of the embedded additional information includes:

acquiring a video bit stream with hidden information, and performing entropy decoding on the video bit stream;

obtaining the nonzero coefficient of each P/B macro block of the non-skip type, and extracting the nonzero coefficients c 'one by one according to the modes of macro block raster scanning and coefficient zig-zag scanning'iData d hidden iniAnd obtaining an information sequence data2, wherein the extracted standard is as follows:

Figure FDA0002233747420000051

wherein% is modulo arithmetic;

acquiring a data encryption password Key2 to be embedded, and generating a pseudo-random number sequence seq2 through a pseudo-random number generator according to the data encryption password Key2 to be embedded;

and carrying out XOR operation on the information sequence data2 extracted from the nonzero coefficient sequence and the pseudo-random number sequence seq2 to obtain original data embedded in the video.

Technical Field

The invention relates to the technical field of multimedia information security, in particular to a video encryption method capable of carrying secret information.

Background

With the continuous development of cloud computing and big data, related applications (such as mobile distributed storage) have rapidly merged into our lives. However, the cloud server is vulnerable to the internal unreliable system administrator, and more attacks may be induced externally due to its importance, which has become one of the main obstacles for the development of cloud computing. To meet the need of providing trusted video data sharing by an untrusted cloud storage provider, we need to store private video in an encrypted form to cope with a possible data leakage situation. Thus, the cloud storage administrator is authorized to access the encrypted video instead of the original video and embed some additional information directly in the encrypted video to extend additional functionality (e.g., copyright attribution or integrity authentication) while keeping the original video content imperceptible. Performing data hiding directly in the encrypted domain is also applicable to other scenarios where high security and privacy protection is required, especially in the fields of surveillance and medicine, and it is therefore worthwhile for researchers to develop an effective solution.

In the last years, a large number of methods for hiding image ciphertext domain information exist. However, although these methods are very practical, they cannot be directly applied to video because the coding standards and data structures of video are more complicated. H.264/AVC becomes the most widely applied video coding standard by virtue of the excellent characteristics of low code rate, high picture quality and the like, so that a set of efficient ciphertext domain information hiding method based on H.264/AVC is very required to be explored. However, there are some considerable challenges in embedding additional data in the compressed and encrypted video bitstream: firstly, information hiding depends on redundant information, however, after video data is compressed and coded in the H.264/AVC format, the redundancy is greatly reduced, and the difficulty of data embedding is improved. In addition, data hiding requires us to extract the hidden data accurately before or after encryption, but the compressed video data after encryption will be severely disturbed, so it is difficult to effectively combine the information hiding algorithm with the encryption scheme. Furthermore, neither video encryption nor information hiding used should significantly increase the size of the video file in view of video compression rate and network load.

Lian S et al propose a scheme for video Encryption and Watermarking in compressed video bitstreams (Lians, Liu Z, Ren Z, et al. commercial Encryption and Watermarking in video compression [ J ]. IEEE Transactions on Circuits and Systems for video technology,2007,17(6): 0-778). In H.264/AVC compression, the intra prediction mode, motion vector differences and the sign of Discrete Cosine Transform (DCT) coefficients are encrypted, and the DCT coefficients are adaptively watermarked. Xu D et al propose an encryption and Information Hiding method for CAVLC Codeword Substitution (Xu D, Wang R, Shi Y Q. data formatting in encrypted H.264/AVC Video Streams by coded subsystem [ J ]. IEEETransactions on Information principles & Security,2014,9(4): 596-. The codewords for intra prediction mode, the codewords for motion vector differences and the codewords for residual coefficients are encrypted and then additional data is embedded in the encrypted domain by using DCT coefficient codeword replacement techniques. Subsequently, Xu D et al Improved the Data Hiding method for codeword substitution (Xu D, Wang R, Shi Y Q. an Improved Scheme for Data formatting in Encrypted H.264/AVC Videos [ J ]. Journal of Visual Communication and Image reproduction, 2016: S1047320316000286). The redundancy existing in the CAVLC code words is fully utilized, when the suffixLength is equal to 1, the maximum embedding capacity is further enhanced through paired code word replacement, and when the suffixLength is greater than 2, a symbol system based on a plurality of symbols is adopted. Yao Y et al have conducted theoretical analysis of image distortion caused by data embedding and subsequent inter-frame distortion drift (YaoY, Zhang W, Yu N. Inter-frame distortion correction for reversible data in encrypted H.264/AVC video bitstream [ J ]. Signal Processing,2016: S0165168416300561). Based on this analysis, they give different priorities to different DCT coefficients, and data embedding is performed according to the priorities.

The above-described method and almost all other literature encryption methods are disturbing intra prediction modes, motion vector differences and residual coefficients. Since these encryptions cause much damage to the perception of the original content of the Video, they are vulnerable to MBS framework attacks (Minemura K, Wong K S, Phan R, et al. A Novel Sketch attach for H.264/AVCFormat-compatible Encrypted Video [ J ]. IEEE Transactions on Circuits and systems for Video Technology,2016: 1-1). The MBS framework attack may construct an outline corresponding to a frame according to the number of bits spent for entropy coding of each macroblock,

therefore, the industry needs to design a set of video additional information hiding method capable of resisting MBS framework attack.

Disclosure of Invention

The invention aims to overcome the defects that the existing H.264/AVC video ciphertext domain information hiding generally cannot resist various types of contour attacks and the existing encryption method capable of resisting the contour attacks cannot be combined with the information hiding, and provides a video encryption method capable of carrying secret information.

The purpose of the invention is realized by the following technical scheme:

a video encryption method capable of carrying secret information comprises the following steps:

s1, acquiring a video file in a YUV original format to be encrypted;

s2, performing intra-frame prediction or inter-frame prediction on each macro block frame by frame to obtain a macro block type, prediction related parameters, CBPs (cubic boron complexes), quantization indexes and residual coefficients under an optimal prediction mode;

s3, dividing the macro block of each frame into four areas, namely A1, A2, A3 and A4, and linearly arranging the macro blocks of each area in a raster scanning mode;

s4, acquiring an encrypted password Key1 of a user, and generating a pseudorandom Key sequence random1 through a pseudorandom number generator according to the encrypted password Key 1;

s5, calculating skip _ run of each non-skip macroblock in the A2 and A4 areas and I _ run of each non-skip type P/B macroblock; the skip _ run is represented by the number of adjacent skip macroblocks in front of a current non-skip macroblock, and the I _ run is represented by the number of I macroblocks between a P/B macroblock of a non-skip type and a P/B macroblock of a previous non-skip type;

s6, scrambling all skip _ run according to the pseudo-random number sequence random1, and rearranging each macro block according to the scrambled skip _ run;

s7, scrambling all I _ run according to the pseudo-random number sequence random1, and rearranging each macro block according to the scrambled I _ run;

s8, scrambling all I macroblocks according to the pseudorandom number sequence random 1;

s9, keeping the CBP and residual coefficient of the P/B macroblock of non-skip type unchanged, scrambling the optimal macroblock mode, the prediction related parameter and the quantization step of the P/B macroblock of non-skip type according to the pseudo random number sequence random 1;

s10, randomly scrambling all types of macro blocks in the A3 area;

s11, reconstructing the macro blocks of the four areas into a frame in a raster scanning order, and then entropy coding the macro blocks one by one to complete the video encryption;

and S12, embedding the additional information to be embedded into the encrypted video, and completing the hiding of the additional information.

Preferably, the dividing each frame into four regions includes: the macroblock in the first row and the first column of each frame is an a1 area, all macroblocks in the first row except a1 are an a2 area, all macroblocks in the first column except a1 are an A3 area, and all macroblocks in the whole frame except a1, a2 and A3 are an a4 area.

Preferably, the scrambling of all skip _ run according to the pseudo random number sequence random1 in step S6 includes: and (3) taking log (N) bits backward from a pseudorandom key sequence random1, wherein the log (N) is represented as T in decimal, wherein N is represented as the number of non-skip macroblocks, exchanging the values of a first skip _ run and a T% N skip _ run, wherein% is a modular operation, and sequentially exchanging the values of a second skip _ run and a third skip _ run according to the same method until the value of the Nth skip _ run is exchanged, thereby finishing the scrambling of all skip _ runs.

Preferably, the scrambling of all I _ run according to the pseudo random number sequence random1 in step S7 includes: taking log (K) bits backward from the pseudorandom key sequence random1, log (K) being denoted T in decimal, where K denotes the number of P/B macroblocks of non-skip type, exchanging the values of the first I _ run and the T% K I _ run, where% are modulo; and sequentially exchanging the values of the second … I _ run and the third … I _ run in the same method until the value of the K I _ run is exchanged, thereby completing the scrambling of all I _ runs.

Preferably, the scrambling of all I macroblocks according to the pseudo random number sequence random1 in step S8 includes: taking log (R) bits backward from the pseudorandom key sequence random1, expressing log (R) as T in decimal, where R is the number of I macroblocks, exchanging the positions of the first I macroblock and the T% R I macroblocks, where% is modulo; and sequentially exchanging the positions of the second … I macro block and the third … I macro block according to the same method until the position of the Rth I macro block is exchanged, and completing the scrambling of all I macro blocks.

Preferably, the prediction-related parameters include: intra prediction mode, reference frame index, and motion vector.

Preferably, the scrambling of the optimal macroblock mode, the prediction related parameters and the quantization step size of the non-skip type P/B macroblock according to the pseudo random number sequence random1 in step S9 includes: taking log (M) bits backwards from a pseudorandom key sequence random1, expressing the log (M) as T in decimal, wherein M is the number of P/B macro blocks of non-skip type, and exchanging the optimal macro block mode, the prediction related parameters and the quantization step size of the first P/B macro block of non-skip type and the T% M P/B macro blocks of non-skip type, wherein% is modulo operation; and sequentially exchanging the information of the second and third … non-skip type P/B macro blocks according to the same method until the information of the Mth non-skip type P/B macro block is exchanged, and finishing the information scrambling of all non-skip type P/B macro blocks.

Preferably, the randomly scrambling all types of macroblocks of the A3 region in step S10 includes: taking log (X) bits backward from the pseudorandom key sequence random1, expressing log (X) as T in decimal, where X is the number of all macroblocks in the A3 region, exchanging the positions of the first macroblock and the T% X macroblocks, where% is modulo; the positions of the second and third … macroblocks are sequentially exchanged in the same way until the position of the Xth macroblock is exchanged, and the scrambling of all macroblocks in the A3 region is completed.

Preferably, the embedding of the additional information to be embedded in the encrypted video in step S12 includes:

s121, converting the additional information to be embedded into a binary information sequence data 1;

s122, acquiring an information encryption password Key to be embedded 2 of a user, and generating a pseudorandom Key sequence seq2 with the same length as the information sequence data1 through a pseudorandom number generator algorithm according to the information encryption password Key2 to be embedded;

s123, serializing all non-zero coefficients in all non-skip type P/B macro blocks in a frame in a mode that macro blocks are scanned according to raster and non-zero coefficients are scanned according to zig-zag, and obtaining serialization C;

s124, carrying out exclusive OR operation on the binary information sequence data1 and the pseudo-random number sequence seq2 to generate a binary encryption information sequence data2, and embedding data in the binary encryption information sequence data2 according to the following rules:

when the suffixLength>1, if the binary encrypted information bit d to be embedded currentlyi0, the modified coefficient c'iAnd coefficient c before modificationiThe relationship of (1):

if the binary encrypted information bit d to be embedded currentlyiWhen 1, the modified coefficient c'iAnd coefficient c before modificationiThe relationship of (1):

Figure BDA0002233747430000071

wherein% is modulo arithmetic;

and S125, entropy coding the residual coefficient of the macro block and outputting the encrypted video bit stream embedded with the additional information.

Preferably, step S12 is followed by: extracting the embedded additional information; the extracting of the embedded additional information includes: acquiring a video bit stream with hidden information, and performing entropy decoding on the video bit stream; obtaining the nonzero coefficient of each P/B macro block of the non-skip type, and extracting the nonzero coefficients c 'one by one according to the modes of macro block raster scanning and coefficient zig-zag scanning'iData d hidden iniAnd obtaining an information sequence data2, wherein the extracted standard is as follows:

Figure BDA0002233747430000072

wherein% is modulo arithmetic;

acquiring a data encryption password Key2 to be embedded, and generating a pseudo-random number sequence seq2 through a pseudo-random number generator according to the data encryption password Key2 to be embedded; and carrying out XOR operation on the information sequence data2 extracted from the nonzero coefficient sequence and the pseudo-random number sequence seq2 to obtain original data embedded in the video.

Compared with the prior art, the invention has the following advantages:

the scheme mainly comprises three parts of video encryption, data embedding and data extraction. In video encryption, the information of skip _ run, I macro block and non-skip type P/B macro block is scrambled to meet the security requirement and effectively resist MBS frame attack. In data embedding, the requirement is met by replacing residual coefficient code words under the condition that the suffix length is greater than 1; at the data extraction section, embedded data information is output by judging the parity of the residual coefficient. The scheme has the characteristics of resisting various contour attacks, providing a better visual encryption effect, being suitable for uncompressed and H.264 compressed videos and the like, providing various expansion functions through embedded additional information, being capable of being used for protecting the safety and privacy of commercial or personal videos transmitted or stored to a cloud storage platform through a public channel and having high practical value.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:

fig. 1 is a schematic flow chart of a video encryption method capable of carrying hidden information according to the present invention.

Fig. 2 is an encryption flow diagram of the present invention.

FIG. 3 is a schematic diagram of the division of the regions A1, A2, A3 and A4 according to the present invention.

FIG. 4 is a schematic diagram of skip _ run, I _ run replacement, I macroblock replacement, and non-skip type P/B macroblock replacement for the A2 and A4 regions according to the present invention.

FIG. 5 is a flow chart of data embedding of the present invention.

FIG. 6 is a flow chart of data extraction according to the present invention.

Detailed Description

The invention is further illustrated by the following figures and examples.

Referring to fig. 1-6, a video encryption method capable of carrying hidden information includes:

s1, acquiring a video file in a YUV original format to be encrypted;

s2, performing intra-frame prediction or inter-frame prediction on each macro block frame by frame to obtain a macro block type, prediction related parameters, CBPs (cubic boron complexes), quantization indexes and residual coefficients under an optimal prediction mode; the prediction-related parameters include: intra prediction mode, reference frame index, and motion vector. According to the H.264/AVC protocol standard, the operations of intra-frame prediction/inter-frame prediction, residual calculation, integer DCT transformation, quantization and the like are carried out on each macro block frame by frame, so that the intra-frame prediction or the inter-frame prediction can be carried out on each macro block frame by frame, and the macro block type, the prediction related parameters, the CBP, the quantization index and the residual coefficient under the optimal prediction mode are obtained;

s3, dividing the macro block of each frame into four areas, namely A1, A2, A3 and A4, and linearly arranging the macro blocks of each area in a raster scanning mode; referring to fig. 3, the dividing of each frame into four regions includes: let the macroblock in the first row and the first column (top left corner) of each frame be an a1 area, all macroblocks in the first row except a1 be an a2 area, all macroblocks in the first column except a1 be an A3 area, and all macroblocks in the whole frame except a1, a2, and A3 be an a4 area.

S4, acquiring an encrypted password Key1 of a user, and generating a pseudorandom Key sequence random1 through a pseudorandom number generator according to the encrypted password Key 1; each frame of the video is encrypted using steps S5 through S10.

S5, calculating skip _ run of each non-skip macroblock in the A2 and A4 areas and I _ run of each non-skip type P/B macroblock; the a1 region is not scrambled. The skip _ run is represented by the number of adjacent skip macroblocks in front of the current non-skip macroblock, and the I _ run is represented by the number of I macroblocks between the P/B macroblock of the current non-skip type and the P/B macroblock of the previous non-skip type;

s6, scrambling all skip _ run according to the pseudo-random number sequence random1, and rearranging each macro block according to the scrambled skip _ run; wherein scrambling all skip _ run according to the pseudo random number sequence random1 includes: and (3) taking log (N) bits backward from a pseudorandom key sequence random1, wherein the log (N) is represented as T in decimal, wherein N is represented as the number of non-skip macroblocks, exchanging the values of a first skip _ run and a T% N skip _ run, wherein% is a modular operation, and sequentially exchanging the values of a second skip _ run and a third skip _ run according to the same method until the value of the Nth skip _ run is exchanged, thereby finishing the scrambling of all skip _ runs.

S7, scrambling all I _ run according to the pseudo-random number sequence random1, and rearranging each macro block according to the scrambled I _ run; wherein scrambling all I _ run according to the pseudo random number sequence random1 comprises: taking log (K) bits backward from the pseudorandom key sequence random1, log (K) being denoted T in decimal, where K denotes the number of P/B macroblocks of non-skip type, exchanging the values of the first I _ run and the T% K I _ run, where% are modulo; and sequentially exchanging the values of the second … I _ run and the third … I _ run in the same method until the value of the K I _ run is exchanged, thereby completing the scrambling of all I _ runs. Such as: assuming that there are 14 macroblocks, it is taken over the key sequence random1

Figure BDA0002233747430000101

One bit, these 4 bits are denoted as T in decimal, interchanging the position of the first I macroblock with the T% R I macroblock.

S8, scrambling all I macroblocks according to the pseudorandom number sequence random 1; scrambling all I macroblocks according to the pseudo random number sequence random1 includes: taking log (R) bits backward from the pseudorandom key sequence random1, expressing log (R) as T in decimal, where R is the number of I macroblocks, exchanging the positions of the first I macroblock and the T% R I macroblocks, where% is modulo; and sequentially exchanging the positions of the second … I macro block and the third … I macro block according to the same method until the position of the Rth I macro block is exchanged, and completing the scrambling of all I macro blocks.

S9, keeping the CBP and residual coefficient of the P/B macroblock of non-skip type unchanged, scrambling the optimal macroblock mode, the prediction related parameter and the quantization step of the P/B macroblock of non-skip type according to the pseudo random number sequence random 1; the scrambling of the optimal macroblock mode, the prediction related parameters and the quantization step of the non-skip type P/B macroblock according to the pseudo-random number sequence random1 comprises the following steps: taking log (M) bits backwards from a pseudorandom key sequence random1, expressing the log (M) as T in decimal, wherein M is the number of P/B macro blocks of non-skip type, and exchanging the optimal macro block mode, the prediction related parameters and the quantization step size of the first P/B macro block of non-skip type and the T% M P/B macro blocks of non-skip type, wherein% is modulo operation; and sequentially exchanging the information of the second and third … non-skip type P/B macro blocks according to the same method until the information of the Mth non-skip type P/B macro block is exchanged, and finishing the information scrambling of all non-skip type P/B macro blocks.

S10, randomly scrambling all types of macro blocks in the A3 area; wherein randomly scrambling all types of macroblocks of the a3 region includes: taking log (X) bits backward from the pseudorandom key sequence random1, expressing log (X) as T in decimal, where X is the number of all macroblocks in the A3 region, exchanging the positions of the first macroblock and the T% X macroblocks, where% is modulo; the positions of the second and third … macroblocks are sequentially exchanged in the same way until the position of the Xth macroblock is exchanged, and the scrambling of all macroblocks in the A3 region is completed.

S11, reconstructing the macro blocks of the four areas into a frame in a raster scanning order, and then entropy coding the macro blocks one by one to complete the video encryption;

and S12, embedding the additional information to be embedded into the encrypted video, and completing the hiding of the additional information. Referring to fig. 5, wherein embedding the additional information to be embedded into the encrypted video includes:

s121, the additional information to be embedded (data to be embedded) is bit-converted into a binary information sequence data 1;

s122, acquiring an information encryption password Key to be embedded 2 of a user, and generating a pseudorandom Key sequence seq2 with the same length as the information sequence data1 through a pseudorandom number generator algorithm according to the information encryption password Key2 to be embedded;

s123, serializing all non-zero coefficients in all non-skip type P/B macro blocks in a frame in a mode that macro blocks are scanned according to raster and non-zero coefficients are scanned according to zig-zag, and obtaining serialization C; the non-zero coefficient sequence C is the carrier in which the data is embedded.

S124, carrying out exclusive OR operation on the binary information sequence data1 and the pseudo-random number sequence seq2 to generate a binary encryption information sequence data2, and embedding data in the binary encryption information sequence data2 according to the following rules:

when the suffixLength>1, if the binary encrypted information bit d to be embedded currentlyi0, the modified coefficient c'iAnd coefficient c before modificationiThe relationship of (1):

Figure BDA0002233747430000121

if the binary encrypted information bit d to be embedded currentlyiWhen 1, the modified coefficient c'iAnd coefficient c before modificationiThe relationship of (1):

wherein% is modulo arithmetic; the suffixLength is a variable in a protocol, and is a variable well known in the art.

And S125, entropy coding the residual coefficient of the macro block and outputting the H.264/AVC encrypted video bit stream embedded with the additional information.

In this embodiment, step S12 is followed by: extracting the embedded additional information; referring to fig. 6, the extracting of the embedded additional information includes: acquiring an H.264/AVC video bit stream (in an encryption or decryption state) embedded with additional information (with hidden information), and performing entropy decoding on the video stream; obtaining the nonzero coefficient of each P/B macro block of the non-skip type, and extracting the nonzero coefficients c 'one by one according to the modes of macro block raster scanning and coefficient zig-zag scanning'iData d hidden iniObtaining an information sequence data2, and extracting the standard:

Figure BDA0002233747430000123

wherein% is modulo arithmetic;

acquiring a data encryption password Key2 to be embedded, and generating a pseudo-random number sequence seq2 through a pseudo-random number generator according to the data encryption password Key2 to be embedded; and carrying out XOR operation on the information sequence data2 extracted from the nonzero coefficient sequence and the pseudo-random number sequence seq2 to obtain original data embedded in the video.

The scheme provides a new H.264/AVC ciphertext domain information hiding scheme, video additional data are embedded into the encrypted video bit stream, and meanwhile MBS framework attack is effectively resisted. First, for each non-skip macroblock, there is a skip _ run for recording the number of consecutive skip macroblocks in its previous neighbor position, and the skip _ run will be replaced randomly. For each non-skip type inter-predicted macroblock (P/B macroblock), there is also an I _ run to record the number of intra-predicted macroblocks (I macroblocks) between the current non-skip type P/B macroblock and the last non-skip type inter-predicted macroblock (P/B macroblock), which is also randomly scrambled. To further encrypt the video stream and affect the effect of MBS frame attack, we also randomly scramble intra-predicted macroblocks (I macroblocks), and randomly scramble information of non-skip type inter-predicted macroblocks (P/B macroblocks). These encryption and data hiding steps are carefully designed to maintain format compatibility and only minimally increase file size. The proposed scheme can achieve excellent performance in terms of security, especially in MBS framework attacks and other JPEG-oriented framework attacks, including EAC, PLZ, DCCA, INCC attacks, and so on. In addition, some widely adopted encryption techniques, such as sign bits of non-zero DCT coefficients and intra prediction modes, may be incorporated as an option into the proposed encryption scheme to provide further security

The above-mentioned embodiments are preferred embodiments of the present invention, and the present invention is not limited thereto, and any other modifications or equivalent substitutions that do not depart from the technical spirit of the present invention are included in the scope of the present invention.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种用于保护网络技术的监控装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类