H.264 encryption and ciphertext domain information hiding method, device and storage medium
By defining the feature extraction function and macroblock replacement technology in H.264/AVC video, we solve the problem that the encryption part in the existing technology cannot resist contour attacks, and achieve good visual security and embedding capacity while resisting MBS contour attacks. Effect.
Patent Information
- Application Number
- CN202210794440.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-07
- Publication Date
- 2024-10-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing H.264/AVC video ciphertext domain information hiding scheme cannot resist the MBS profile attack in the encryption part, resulting in privacy and security risks.
By defining the feature extraction function, the feature values of the macroblocks are calculated, and the macroblocks in the frame are replaced according to the feature values of the macroblocks to generate encrypted videos, ensuring the encryption visual security and resisting contour attacks.
While maintaining good embedding capacity, it is able to resist MBS contour attacks, ensuring the visual security of video encryption and the separability of information hiding.
Smart Images

Figure CN115361563B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of multimedia information security technology, and in particular to an H.264 encryption and ciphertext domain information hiding method, device and storage medium. Background Art
[0002] With the development of computer networks and the advancement of video coding and communication technologies, digital videos have been used more and more widely. At the same time, in the Internet environment, protecting the privacy and security of video data has become a major demand. Encrypting videos can protect the privacy of video data. In addition, service providers often want to embed some additional messages in the video, such as authentication messages, for video management. Therefore, it is important to design a scheme for format-compatible encryption of videos and information hiding in the ciphertext domain.
[0003] In view of the high-efficiency coding performance, good network adaptability and practical application popularity of H.264 / AVC, the ciphertext domain H.264 / AVC video data hiding technology has high practical value and is also the focus of academic research. Although ciphertext domain information hiding schemes for H.264 / AVC have been proposed in recent years, the encryption part of these ciphertext domain information hiding schemes generally cannot resist MBS profile attacks because they cannot drastically change the bit overhead distribution of macroblocks in the frame, which brings huge privacy and security risks. Summary of the invention
[0004] In order to solve at least one of the technical problems existing in the prior art to a certain extent, the present invention aims to provide an H.264 encryption and ciphertext domain information hiding method, device and storage medium.
[0005] The technical solution adopted by the present invention is:
[0006] An H.264 encryption and ciphertext domain information hiding method includes an H.264 / AVC video encryption step and an H.264 / AVC video ciphertext domain data hiding step:
[0007] The H.264 / AVC video encryption step includes:
[0008] A1, define area S0 as the area consisting of the macroblocks in the first row and the first column in a frame, and define area S1 as the area consisting of the macroblocks other than S0 in a frame;
[0009] A2. Define a function F that satisfies the following conditions: 1. Takes the field information of a single macroblock as input and outputs a numerical value, called the F value; 2. For the input macroblock, encryption and information hiding operations do not affect the F value of the input macroblock;
[0010] A3. Determine the encryption key K enc ;
[0011] A4. For the input H.264 file, read the field information of each frame, and perform the following steps A41-A43 for each frame:
[0012] A41. For the macroblocks in S1, calculate the F values of all macroblocks in S1, and obtain an F value distribution graph G indicating the correspondence between the macroblock positions and F values of the current processing frame, where G[y][x]=F (y,x) Indicates that the value of the yth row and xth column in the F value distribution graph G is the F value of the macroblock of the yth row and xth column in the frame;
[0013] A42. According to the encryption key K enc The generated pseudo-random sequence scrambles the order of F values corresponding to the macroblocks in the S1 region in the F value distribution diagram;
[0014] A43, according to the scrambled F value distribution map, rearrange the positions of each macroblock in the current frame S1 area, and the rearrangement process satisfies: 1. For all rearranged macroblocks, the F value corresponding to the macroblock position of the macroblock in the scrambled F value distribution map after the rearrangement of the macroblock is the same as the F value of the macroblock; 2. Before and after the rearrangement of the macroblocks, raster scan the current frame S1 area, and the order of macroblocks with the same F value remains unchanged;
[0015] A5. Re-encode the encrypted macroblock information to generate a ciphertext H.264 video.
[0016] Further, in step A2, the F function is the number of non-zero quantized residual coefficients in the input macroblock.
[0017] Furthermore, the H.264 / AVC video ciphertext domain data hiding step includes:
[0018] B1. For a frame, define region S0 as a region consisting of macroblocks in the first row and the first column in a frame, and define region S1 as a region consisting of macroblocks other than S0 in a frame;
[0019] B2. Obtain the definition of the F function and determine the priority order of the F value;
[0020] B3, determine the embedded message bit stream;
[0021] B4. For the input ciphertext domain H.264 file, read the information of each frame, and perform the following steps B41-B43 for each frame that needs to be hidden:
[0022] B41, calculate the F value of all macroblocks in S1;
[0023] B42, determining the order of macroblocks in S1 for information hiding according to the priority order of F value, that is, the order of macroblocks with higher priority F value for information hiding is before the order of macroblocks with lower priority F value; for multiple macroblocks with the same F value, the order of macroblocks for information hiding is the raster scanning order;
[0024] B43, hiding information for each macroblock according to the information hiding order determined in step B42;
[0025] B5. Re-encode the macroblock information after information hiding to generate a ciphertext domain H.264 video carrying the hidden information.
[0026] Furthermore, the method further includes an H.264 / AVC video decryption step, wherein the H.264 / AVC video decryption step includes:
[0027] C1, define area S0 as the area consisting of the macroblocks in the first row and the first column in a frame, and define area S1 as the area consisting of the macroblocks other than S0 in a frame;
[0028] C2, get the definition of F function;
[0029] C3. Determine the decryption key K dec ;
[0030] C4. For the input H.264 file, read the field information of each frame, and perform the following steps C41-C43 for each frame respectively:
[0031] C41. For the macroblocks in S1, the F values of all macroblocks in S1 are calculated, thereby obtaining an F value distribution graph G showing the correspondence between the macroblock positions and F values of the current processing frame, where G[y][x] = F (y,x) Indicates that the value of the yth row and xth column in the F value distribution graph G is the F value of the macroblock of the yth row and xth column in the frame;
[0032] C42, according to the decryption key K dec The generated pseudo-random sequence reverses the arrangement order of the F values corresponding to the macro blocks in the S1 region in the F value distribution diagram;
[0033] C43, according to the inverse scrambled F value distribution map, rearrange the positions of each macroblock in the S1 area of the current frame, and the rearrangement process satisfies: 1. For all rearranged macroblocks, the F value corresponding to the macroblock position of the macroblock in the inverse scrambled F value distribution map after the rearrangement of the macroblock is the same as the F value of the macroblock; 2. Before and after the rearrangement of the macroblocks, raster scan the S1 area of the current frame, and the order of macroblocks with the same F value remains unchanged;
[0034] C5. Re-encode the decrypted macroblock information to generate output H.264 video.
[0035] Furthermore, the method further includes an H.264 / AVC video data extraction step, wherein the H.264 / AVC video data extraction step includes:
[0036] D1, for a frame, define area S0 as the area consisting of the macroblocks in the first row and the first column in the frame, and define area S1 as the area consisting of the macroblocks other than S0 in the frame;
[0037] D2. Get the definition of the F function and the priority order of the F value;
[0038] D3, initialize the extracted information bit stream to be empty;
[0039] D4. Read the information of each frame of the input H.264 file, and perform the following steps D41-D43 on each frame that needs to be extracted:
[0040] D41, calculate the F value of all macroblocks in S1;
[0041] D42, determining the order of macroblocks for information extraction from each macroblock in S1 according to the priority order of F value, that is, the order of information extraction from macroblocks with higher priority F value is before that of macroblocks with lower priority F value; for multiple macroblocks with the same F value, the order of macroblocks for information extraction is the raster scanning order;
[0042] D43, extracting information from each macroblock according to the information extraction order determined in step D42, and appending the extracted bit string to the extracted information bit stream;
[0043] D5. Re-encode the extracted macroblock information to generate an output H.264 video.
[0044] Furthermore, in step B2 and step D2, the priority order of the F value is the same as the descending order of the F value.
[0045] Furthermore, the scrambling process in step A42 is as follows:
[0046] According to the encryption key K enc Determine the pseudo-random number generator;
[0047] Initialize the F value list L F , scan the F value corresponding to the macroblock in region S1 in G in raster scan order, and store the scanned F value in the F value list L in raster scan order F , get the list L F =(F0, F1, F2, ..., F n ), n is the number of macroblocks in S1;
[0048] Use a pseudo-random number generator to generateF Pseudo-random number sequence r = (s0, s1, s2, ..., s n ), and the pseudo-random sequence is stably sorted to obtain the sequence r′=(s′0,s′1,s′2,...,s′ n ), record the position of each element of r′ in the original sequence r, and get the scrambled sequence P F =(p0, p1, p2, ..., p n );
[0049] According to the scrambled sequence P F Scramble the F value list L F , get the scrambled F value list L′ F , that is, traverse the scrambled sequence P F , each time you traverse to a position i, if the scrambled sequence P F The i-th element in is p i , then the scrambled F value list L′ F The i-th F value is the original F value list L F The pth i F value;
[0050] According to the scrambled F value list L′ F Rearrange the F values corresponding to the macroblocks in the S1 region in G to obtain a scrambled F value distribution map G′, which satisfies the F value order obtained by raster scanning the F values corresponding to the macroblocks in the S1 region in G′ and the scrambled F value list L′ F The order of F values is the same.
[0051] Furthermore, the processing process of the reverse scrambling in step C42 is:
[0052] According to the decryption key K dec Determine the pseudo-random number generator;
[0053] Initialize the F value list L F , scan the F value corresponding to the macroblock in region S1 in G in raster scan order, and store the scanned F value in the F value list L in raster scan order F , get the list L F =(F0, F1, F2, ..., F n ), n is the number of macroblocks in S1;
[0054] Use a pseudo-random number generator to generate F Pseudo-random number sequence r = (s0, s1, s2, ..., s n ), and the pseudo-random sequence is stably sorted to obtain the sequence r′=(s′0,s′1,s′2,...,s′ n), record the position of each element of r′ in the original sequence r, and get the scrambled sequence P F =(p0, p1, p2, ..., p n );
[0055] According to the scrambled sequence P F Reverse scrambled F value list L F , get the reverse scrambled F value list L′ F , that is, traverse the scrambled sequence P F , each time you traverse to a position i, if the scrambled sequence P F The i-th element in is p i , then the inverse scrambled F value list L′ F The pth i The F value is the original F value list L F The i-th F value in ;
[0056] According to the inverse scrambled F value list L′ F Rearrange the F values corresponding to the macroblocks in the S1 region of G to obtain the inversely scrambled F value distribution map G′, which satisfies the F value order obtained by raster scanning the F values corresponding to the macroblocks in the S1 region of G′ and the inversely scrambled F value list L′ F The order of F values is the same.
[0057] Furthermore, the information hiding process in step B43 is as follows:
[0058] Traverse the 16 4x4 quantized residual coefficient blocks of the macroblock currently being hidden. Each time a 4x4 quantized residual coefficient block is traversed, the processing process is: scan the current 4x4 quantized residual coefficient block in zigzag order. Each time a quantized residual coefficient is traversed, the processing process includes steps b1-b4:
[0059] b1. If the currently processed quantized residual coefficient is the first 4 coefficients in the zigzag scanning order in the current 4x4 quantized residual coefficient block, no processing is performed;
[0060] b2. If the current processing quantization residual coefficient value is 0, no processing is performed;
[0061] b3. If the absolute value of the currently processed quantized residual coefficient is 1, obtain a 1-bit embedded message; if the currently embedded message bit is 0, do not process the currently processed quantized residual coefficient; if the currently embedded message bit is 1, modify the currently processed quantized residual coefficient so that the absolute value of the currently processed quantized residual coefficient is 2 and the sign of the currently processed quantized residual coefficient remains unchanged before and after the modification;
[0062] b4. If the absolute value of the currently processed quantized residual coefficient is greater than 1, modify the currently processed quantized residual coefficient so that the absolute value of the currently processed quantized residual coefficient increases by 1 and the sign of the currently processed quantized residual coefficient remains unchanged before and after the modification.
[0063] Furthermore, the information extraction process in step D43 is as follows:
[0064] Traverse the 16 4x4 quantized residual coefficient blocks of the macroblock currently being extracted. Each time a 4x4 quantized residual coefficient block is traversed, the processing process is: scan the current 4x4 quantized residual coefficient block in zigzag order. Each time a quantized residual coefficient is traversed, the processing process includes steps d1-d4:
[0065] d1. If the currently processed quantized residual coefficient is the first 4 coefficients in the zigzag scan order in the current 4x4 quantized residual coefficient block, no processing is performed;
[0066] d2. If the current processing quantization residual coefficient value is 0, no processing is performed;
[0067] d3. If the absolute value of the currently processed quantized residual coefficient is 1, the 1-bit message is extracted as 0, and the currently processed quantized residual coefficient is not processed; if the absolute value of the currently processed quantized residual coefficient is 2, the 1-bit message is extracted as 1, and the currently processed quantized residual coefficient is modified so that the absolute value of the currently processed quantized residual coefficient is 1 and the sign of the currently processed quantized residual coefficient remains unchanged before and after the modification;
[0068] d4. If the absolute value of the currently processed quantized residual coefficient is greater than 2, modify the currently processed quantized residual coefficient so that the absolute value of the currently processed quantized residual coefficient is reduced by 1 and the sign of the currently processed quantized residual coefficient remains unchanged before and after the modification.
[0069] Another technical solution adopted by the present invention is:
[0070] An H.264 encryption and ciphertext domain information hiding device, comprising:
[0071] at least one processor;
[0072] at least one memory for storing at least one program;
[0073] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0074] Another technical solution adopted by the present invention is:
[0075] A computer-readable storage medium stores a program executable by a processor, wherein the program executable by the processor is used to execute the method described above when executed by the processor.
[0076] The beneficial effects of the present invention are as follows: the present invention can define a feature extraction function in the encryption part to calculate the feature value of the macroblock; and replace the macroblock of the current frame according to the feature value of each macroblock of the current frame, thereby ensuring the visual security of encryption while resisting contour attacks. In general, the present invention can resist MBS contour attacks while maintaining good embedding capacity. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the embodiments of the present invention or the drawings of related technical solutions in the prior art are introduced below. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0078] Figure 1 is an overall flow chart of video encryption and information hiding in an embodiment of the present invention;
[0079] Figure 2 is an overall flow chart of video decryption and information extraction in an embodiment of the present invention;
[0080] Figure 3 is a flow chart of encrypting a video frame in an embodiment of the present invention;
[0081] Figure 4 It is a flowchart of information hiding for a video frame in an embodiment of the present invention. DETAILED DESCRIPTION
[0082] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0083] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0084] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0085] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0086] In the existing technology, the bit overhead distribution of each macroblock in the frame is not changed, which makes it unable to resist the MBS contour attack. Therefore, this embodiment proposes a new H.264 / AVC video encryption and ciphertext domain information hiding scheme to improve the disadvantage that the encryption part of the existing H.264 / AVC video ciphertext domain information hiding scheme cannot resist the contour attack.
[0087] like Figure 1 As shown, this embodiment provides an H.264 encryption and ciphertext domain information hiding method, including an H.264 / AVC video encryption step, an H.264 / AVC video ciphertext domain data hiding step, an H.264 / AVC video decryption step, and an H.264 / AVC video data extraction step.
[0088] Among them, see Figure 3 , H.264 / AVC video encryption steps include:
[0089] Step 1-1: define area S0 as an area consisting of macroblocks in the first row and the first column in a frame, and define area S1 as an area consisting of macroblocks other than S0 in a frame;
[0090] Step 1-2: Define function F, the input is macroblock, the output is the number of non-zero quantized residual coefficients of the input macroblock, the output is called F value;
[0091] Step 1-3: Enter the encryption key K enc And initialize the pseudo-random number generator;
[0092] Step 1-4: For the input H.264 file, obtain the field information of each frame through entropy decoding, and perform the following steps for each frame respectively:
[0093] Step 1-4-1: For the macroblocks in S1, calculate the F value of all macroblocks in S1, thereby obtaining an F value distribution graph G showing the correspondence between the macroblock position and the F value of the current processing frame, where G[y][x] = F (y,x) Indicates that the value of the yth row and xth column in the F value distribution graph G is the F value of the macroblock of the yth row and xth column in the frame;
[0094] Step 1-4-2: According to the encryption key K enc The pseudo-random sequence generated scrambles the F value arrangement order corresponding to the macroblock in the S1 region of the F value distribution map. The processing process is:
[0095] (a) Initialize the F value list L F , scan the F value corresponding to the macroblock in region S1 in G in raster scan order, and store the scanned F value in raster order into the F value list L F , get the list L F =(F0, F1, F2, ..., F n ), n is the number of macroblocks in S1;
[0096] (b) Use a pseudo-random number generator to generate F Pseudo-random number sequence r = (s0, s1, s2, ..., s n ), and the pseudo-random sequence is stably sorted to obtain the sequence r′=(s′0,s′1,s′2,...,s′ n ), record the position of each element in r′ in the original sequence r, and get the scrambled sequence P F =(p0, p1, p2, ..., p n );
[0097] (c) According to the scrambled sequence P F Scramble list L F , that is, traverse the scrambled sequence P F , each time you traverse to a position i, if the scrambled sequence P F The i-th element in is p i , then the scrambled F value list L′ F The i-th F value is the original F value list L F The pth i F value;
[0098] (d) According to the scrambled F value list L′ F Rearrange the F values corresponding to the macroblocks in the S1 region in G to obtain a scrambled F value distribution map G′, which satisfies the F value order obtained by raster scanning the F values corresponding to the macroblocks in the S1 region in G′ and the scrambled F value list L′ F The order of F values is the same;
[0099] Step 1-4-3: According to the scrambled F value distribution map, rearrange the positions of each macroblock in the S1 area of the current frame, and the rearrangement process satisfies: 1. For all rearranged macroblocks, the F value corresponding to the macroblock position of the macroblock after the rearrangement of the macroblock in the scrambled F value distribution map is the same as the F value of the macroblock; 2. Before and after the rearrangement of the macroblocks, perform raster scanning on the S1 area of the current frame, and the order between macroblocks with the same F value remains unchanged;
[0100] Step 1-5: Re-encode the encrypted macroblock information to generate a ciphertext H.264 video.
[0101] Among them, see Figure 4 , the steps of hiding data in the ciphertext domain of H.264 / AVC video include:
[0102] Step 2-1: For a frame, define region S0 as a region consisting of macroblocks in the first row and the first column in the frame, and define region S1 as a region consisting of macroblocks other than S0 in the frame;
[0103] Step 2-2: Obtain the number of non-zero quantized residual coefficients of the macroblock defined by the F function, and define the priority order of the values as the descending order of the F values;
[0104] Step 2-3: Determine the embedded message bit stream;
[0105] Step 2-4: For the input ciphertext domain H.264 file, read the information of each frame, and perform the following steps for each frame that needs to be hidden:
[0106] Step 2-4-1: Calculate the F value of all macroblocks in S1;
[0107] Step 2-4-2: Determine the order of information hiding for each macroblock in S1 according to the priority order of F value, that is, among the macroblocks to be hidden, the macroblock with the largest F value is preferentially selected for information hiding; for multiple macroblocks with the same F value, the order of information hiding is the raster scanning order;
[0108] Step 2-4-3: According to the information hiding order determined in step 2-4-2, one-dimensional histogram shift information hiding is performed on each macroblock. The processing process is as follows:
[0109] (a) Traverse the 16 4x4 quantized residual coefficient blocks of the macroblock currently performing information hiding. Each time a 4x4 quantized residual coefficient block is traversed, the processing process is as follows:
[0110] (a)-1: Scan the current 4x4 quantized residual coefficient block in zigzag order. Each time a quantized residual coefficient is traversed, the processing process is as follows:
[0111] (a) -1-1: If the currently processed quantized residual coefficient is the first 4 coefficients in the zigzag scan order in the current 4x4 quantized residual coefficient block, no processing is performed;
[0112] (a) -1-2: If the current processing quantization residual coefficient value is 0, no processing is performed;
[0113] (a)-1-3: If the absolute value of the current quantized residual coefficient is 1, obtain a 1-bit message; if the current message bit is 0, do not process the current quantized residual coefficient; if the current message bit is 1, modify the current quantized residual coefficient so that the absolute value of the current quantized residual coefficient is 2 and the sign of the current quantized residual coefficient remains unchanged before and after modification;
[0114] (a)-1-4: If the absolute value of the current quantized residual coefficient is greater than 1, modify the current quantized residual coefficient so that the absolute value of the current quantized residual coefficient increases by 1 and the sign of the current quantized residual coefficient remains unchanged before and after the modification;
[0115] Step 2-5: Re-encode the macroblock information after information hiding to generate a ciphertext domain H.264 video carrying the hidden information.
[0116] See also Figure 2 In some embodiments, the additional information extraction and video decryption of the ciphertext video carrying the additional information are completely separable, that is, the additional information can be extracted from the ciphertext video and then decrypted, or the ciphertext video carrying the additional information can be first decrypted to obtain a high visual quality video carrying the additional information, and then the additional information can be extracted. The good separability comes from the fact that during the encryption, hiding, decryption, and extraction processes, the F value of each macroblock, the priority order between the F values, and the raster scanning order between multiple macroblocks with the same F value in the S1 region remain unchanged, thereby ensuring that the method of the present invention can resist contour attacks by scrambling the macroblocks while ensuring that the order of the macroblocks for information hiding (extraction) remains unchanged.
[0117] Among them, Figure 2 As shown, the H.264 / AVC video decryption steps include:
[0118] Step 3-1: define area S0 as an area consisting of macroblocks in the first row and the first column in a frame, and define area S1 as an area consisting of macroblocks other than S0 in a frame;
[0119] Step 3-2: Obtain the number of non-zero quantized residual coefficients in the macroblock defined by the F function;
[0120] Step 3-3: Determine the decryption key K dec And initialize the pseudo-random number generator;
[0121] Step 3-4: For the input H.264 file, read the field information of each frame and perform the following steps for each frame:
[0122] Step 3-4-1: For the macroblocks in S1, calculate the F value of all macroblocks in S1, thereby obtaining an F value distribution graph G showing the correspondence between the macroblock position and the F value of the current processing frame, where G[y][x] = F (y,x) Indicates that the value of the yth row and xth column in the F value distribution graph G is the F value of the macroblock of the yth row and xth column in the frame;
[0123] Step 3-4-2: According to the decryption key K dec The pseudo-random sequence generated reverses the F value arrangement order corresponding to the macroblock in the S1 region of the F value distribution map; the processing process is:
[0124] (a) Initialize the F value list L F , scan the F value corresponding to the macroblock in region S1 in G in raster scan order, and store the scanned F value in raster order into the F value list L F , get the list L F =(F0, F1, F2, ..., F n ), n is the number of macroblocks in S1;
[0125] (b) Use a pseudo-random number generator to generate F Pseudo-random number sequence r = (s0, s1, s2, ..., s n ), and the pseudo-random sequence is stably sorted to obtain the sequence r′=(s′0,s′1,s′2,...,s′ n ), record the position of each element in r′ in the original sequence r, and get the scrambled sequence P F =(p0, p1, p2, ..., p n );
[0126] (c) According to the scrambled sequence P F Reverse scrambled list L F , that is, traverse the scrambled sequence P F , each time you traverse to a position i, if the scrambled sequence P F The i-th element in is p i , then the inverse scrambled F value list L′ F The pth i The F value is the original F value list L F The i-th F value in ;
[0127] (d) According to the reverse scrambled F value list L′ FRearrange the F values corresponding to the macroblocks in the S1 region of G to obtain the inversely scrambled F value distribution map G′, which satisfies the F value order obtained by raster scanning the F values corresponding to the macroblocks in the S1 region of G′ and the inversely scrambled F value list L′ F The order of F values is the same;
[0128] Step 3-4-3: According to the inverse scrambled F value distribution map, rearrange the positions of each macroblock in the S1 area of the current frame, and the rearrangement process satisfies: 1. For all rearranged macroblocks, the F value corresponding to the macroblock position of the macroblock after the rearrangement of the macroblock in the inverse scrambled F value distribution map is the same as the F value of the macroblock; 2. Before and after the rearrangement of the macroblocks, perform raster scanning on the S1 area of the current frame, and the order between macroblocks with the same F value remains unchanged;
[0129] Step 3-5: Re-encode the decrypted macroblock information to generate output H.264 video.
[0130] The H.264 / AVC video data extraction step includes:
[0131] Step 4-1: For a frame, define region S0 as a region consisting of macroblocks in the first row and the first column in the frame, and define region S1 as a region consisting of macroblocks other than S0 in the frame;
[0132] Step 4-2: Obtain the number of non-zero quantized residual coefficients of the macroblock defined by the F function, and obtain the priority order of the values in descending order of the F values;
[0133] Step 4-3: Initialize the extracted information bit stream to be empty;
[0134] Step 4-4: For the input H.264 file, read the information of each frame, and perform the following steps for each frame that needs to be extracted:
[0135] Step 4-4-1: Calculate the F value of all macroblocks in S1;
[0136] Step 4-4-2: Determine the order of macroblocks in S1 for information extraction according to the priority order of F value, that is, among the macroblocks to be extracted, the macroblock with the largest F value is preferentially extracted; for multiple macroblocks with the same F value, the order of macroblocks for information extraction is the raster scanning order;
[0137] Step 4-4-3: According to the information extraction order determined in step 4-4-2, one-dimensional histogram shift information is extracted for each macroblock, and the extracted bit string is appended to the extracted information bit stream; the processing process is:
[0138] (a) Traverse the 16 4x4 quantized residual coefficient blocks of the macroblock currently being extracted. Each time a 4x4 quantized residual coefficient block is traversed, the processing process is as follows:
[0139] (a)-1: Scan the current 4x4 quantized residual coefficient block in zigzag order. Each time a quantized residual coefficient is traversed, the processing process is as follows:
[0140] (a) -1-1: If the currently processed quantized residual coefficient is the first 4 coefficients in the zigzag scan order in the current 4x4 quantized residual coefficient block, no processing is performed;
[0141] (a) -1-2: If the current processing quantization residual coefficient value is 0, no processing is performed;
[0142] (a)-1-3: If the absolute value of the current processing quantization residual coefficient is 1, the 1-bit message is extracted as 0, and the current processing quantization residual coefficient is not processed; if the absolute value of the current processing quantization residual coefficient is 2, the 1-bit message is extracted as 1, and the current processing quantization residual coefficient is modified so that the absolute value of the current processing quantization residual coefficient is 1 and the sign of the current processing quantization residual coefficient remains unchanged before and after the modification;
[0143] (a)-1-4: if the absolute value of the current processing quantization residual coefficient is greater than 2, modify the current processing quantization residual coefficient so that the absolute value of the current processing quantization residual coefficient is reduced by 1 and the sign of the current processing quantization residual coefficient remains unchanged before and after the modification;
[0144] Step 4-5: Re-encode the extracted macroblock information to generate an output H.264 video and output the extracted information bit stream.
[0145] In summary, the method of this embodiment has the following advantages and beneficial effects compared with the prior art:
[0146] (1) In the encryption (decryption) part of the present invention, a feature extraction function is defined to calculate the feature value of a macroblock. The macroblocks of the current frame are permuted (inversely permuted) according to the feature values of each macroblock of the current frame, thereby resisting contour attacks while ensuring the visual security of encryption.
[0147] (2) The information hiding (extraction) part of the present invention determines the information embedding (extraction) order according to the macroblock position and feature value of each macroblock of the current frame. Because the information embedding (extraction) order is not affected by the encryption module, the encryption and decryption part and the information hiding and extraction part maintain good separability. The present invention can be used to protect the security and privacy of commercial videos, medical videos, etc. or personal videos when they are transmitted through public channels or stored in public clouds.
[0148] (3) The H.264 / AVC ciphertext domain information hiding technology proposed in the present invention can maintain good embedding capacity while its encryption algorithm part can resist MBS profile attack.
[0149] This embodiment also provides an H.264 encryption and ciphertext domain information hiding device, including:
[0150] at least one processor;
[0151] at least one memory for storing at least one program;
[0152] When the at least one program is executed by the at least one processor, the at least one processor implements Figure 1 and Figure 2 The method shown.
[0153] An H.264 encryption and ciphertext domain information hiding device of this embodiment can execute an H.264 encryption and ciphertext domain information hiding method provided by the method embodiment of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.
[0154] The present application also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes Figure 1 and Figure 2 The method shown.
[0155] This embodiment also provides a storage medium, which stores instructions or programs that can execute an H.264 encryption and ciphertext domain information hiding method provided by the method embodiment of the present invention. When the instructions or programs are run, any combination of implementation steps of the method embodiment can be executed, and the corresponding functions and beneficial effects of the method can be obtained.
[0156] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0157] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0158] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0159] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0160] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0161] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0162] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0163] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0164] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A method for H.264 encryption and ciphertext domain information hiding, characterized in that: Including H.264 / AVC video encryption steps and H.264 / AVC video ciphertext field data hiding steps: The H.264 / AVC video encryption step includes: A1, define area S0 as the area consisting of the macroblocks in the first row and the first column in a frame, and define area S1 as the area consisting of the macroblocks other than S0 in a frame; A2. Define a function F that satisfies the following conditions:
1. Takes the field information of a single macroblock as input and outputs a numerical value, called the F value; 2. For the input macroblock, encryption and information hiding operations do not affect the F value of the input macroblock; A3. Determine the encryption key K enc ; A4. For the input H.264 file, read the field information of each frame, and perform the following steps A41-A43 for each frame: A41. For the macroblocks in S1, calculate the F values of all macroblocks in S1, and obtain an F value distribution graph G indicating the correspondence between the macroblock positions and F values of the current processing frame, where G[y][x]=F (y,x) Indicates that the value of the yth row and xth column in the F value distribution graph G is the F value of the macroblock of the yth row and xth column in the frame; A42. According to the encryption key K enc The generated pseudo-random sequence scrambles the order of F values corresponding to the macroblocks in the S1 region in the F value distribution diagram; A43, according to the scrambled F value distribution map, rearrange the positions of each macroblock in the current frame S1 area, and the rearrangement process satisfies:
1. For all rearranged macroblocks, the F value corresponding to the macroblock position of the macroblock in the scrambled F value distribution map after the rearrangement of the macroblock is the same as the F value of the macroblock; 2. Before and after the rearrangement of the macroblocks, raster scan the current frame S1 area, and the order of macroblocks with the same F value remains unchanged; A5, re-encode according to the encrypted macroblock information to generate a ciphertext H.264 video; The scrambling process in step A42 is as follows: According to the encryption key K enc Determine the pseudo-random number generator; Initialize the F value list L F , scan the F value corresponding to the macroblock in region S1 in G in raster scan order, and store the scanned F value in the F value list L in raster scan order F , get the list L F =(F0, F1, F2, ..., F n ), n is the number of macroblocks in S1; a pseudo-random number generator is used to generate F Pseudo-random number sequence r = (s0, s1, s2, ..., s n ), and the pseudo-random sequence is stably sorted to obtain the sequence r′=(s′0,s′1,s′2,...,s′ n ), record the position of each element of r′ in the original sequence r, and get the scrambled sequence P F =(p0, p1, p2, ..., p n ); According to the scrambled sequence P F Scramble the F value list L F , get the scrambled F value list L′ F , that is, traverse the scrambled sequence P F , each time you traverse to a position i, if the scrambled sequence P F The i-th element in is p i , then the scrambled F value list L′ F The i-th F value is the original F value list L F The pth i F value; According to the scrambled F value list L′ F Rearrange the F values corresponding to the macroblocks in the S1 region in G to obtain a scrambled F value distribution map G′, which satisfies the F value order obtained by raster scanning the F values corresponding to the macroblocks in the S1 region in G′ and the scrambled F value list L′ F The order of F values is the same; The H.264 / AVC video ciphertext domain data hiding step includes: B1. For a frame, define region S0 as a region consisting of macroblocks in the first row and the first column in a frame, and define region S1 as a region consisting of macroblocks other than S0 in a frame; B2. Obtain the definition of the F function and determine the priority order of the F value; B3, determine the embedded message bit stream; B4. For the input ciphertext domain H.264 file, read the information of each frame, and perform the following steps B41-B43 for each frame that needs to be hidden: B41, calculate the F value of all macroblocks in S1; B42, determining the order of macroblocks in S1 for information hiding according to the priority order of F value, that is, the order of macroblocks with higher priority F value for information hiding is before the order of macroblocks with lower priority F value; for multiple macroblocks with the same F value, the order of macroblocks for information hiding is the raster scanning order; B43, hiding information for each macroblock according to the information hiding order determined in step B42; B5. Re-encode the macroblock information after information hiding to generate a ciphertext domain H.264 video carrying the hidden information.
2. The H.264 encryption and ciphertext domain information hiding method according to claim 1, characterized in that: It also includes an H.264 / AVC video decryption step, wherein the H.264 / AVC video decryption step includes: C1, define area S0 as the area consisting of the macroblocks in the first row and the first column in a frame, and define area S1 as the area consisting of the macroblocks other than S0 in a frame; C2, get the definition of F function; C3. Determine the decryption key K dec ; C4. For the input H.264 file, read the field information of each frame, and perform the following steps C41-C43 for each frame respectively: C41. For the macroblocks in S1, the F values of all macroblocks in S1 are calculated, thereby obtaining an F value distribution graph G showing the correspondence between the macroblock positions and F values of the current processing frame, where G[y][x] = F (y,x) Indicates that the value of the yth row and xth column in the F value distribution graph G is the F value of the macroblock of the yth row and xth column in the frame; C42, according to the decryption key K dec The generated pseudo-random sequence reverses the arrangement order of the F values corresponding to the macro blocks in the S1 region in the F value distribution diagram; C43, according to the inverse scrambled F value distribution map, rearrange the positions of each macroblock in the S1 area of the current frame, and the rearrangement process satisfies:
1. For all rearranged macroblocks, the F value corresponding to the macroblock position of the macroblock in the inverse scrambled F value distribution map after the rearrangement of the macroblock is the same as the F value of the macroblock; 2. Before and after the rearrangement of the macroblocks, raster scan the S1 area of the current frame, and the order of macroblocks with the same F value remains unchanged; C5. Re-encode the decrypted macroblock information to generate output H.264 video.
3. The H.264 encryption and ciphertext domain information hiding method according to claim 1, characterized in that: The H.264 / AVC video data extraction step is also included, and the H.264 / AVC video data extraction step includes: D1, for a frame, define area S0 as the area consisting of the macroblocks in the first row and the first column in the frame, and define area S1 as the area consisting of the macroblocks other than S0 in the frame; D2. Get the definition of the F function and the priority order of the F value; D3, initialize the extracted information bit stream to be empty; D4. Read the information of each frame of the input H.264 file, and perform the following steps D41-D43 on each frame that needs to be extracted: D41, calculate the F value of all macroblocks in S1; D42, determining the order of macroblocks for information extraction from each macroblock in S1 according to the priority order of F value, that is, the order of information extraction from macroblocks with higher priority F value is before that of macroblocks with lower priority F value; for multiple macroblocks with the same F value, the order of macroblocks for information extraction is the raster scanning order; D43, extracting information from each macroblock according to the information extraction order determined in step D42, and appending the extracted bit string to the extracted information bit stream; D5. Re-encode the extracted macroblock information to generate an output H.264 video.
4. The H.264 encryption and ciphertext domain information hiding method according to claim 2, characterized in that: The process of reverse scrambling in step C42 is as follows: According to the decryption key K dec Determine the pseudo-random number generator; Initialize the F value list L F , scan the F value corresponding to the macroblock in region S1 in G in raster scan order, and store the scanned F value in the F value list L in raster scan order F , get the list L F =(F0, F1, F2, ..., F n ), n is the number of macroblocks in S1; Use a pseudo-random number generator to generate F Pseudo-random number sequence r = (s0, s1, s2, ..., s n ), and the pseudo-random sequence is stably sorted to obtain the sequence r′=(s′0,s′1,s′2,...,s′ n ), record the position of each element of r′ in the original sequence r, and get the scrambled sequence P F =(p0, p1, p2, ..., p n ); According to the scrambled sequence P F Reverse scrambled F value list L F , get the reverse scrambled F value list L′ F , that is, traverse the scrambled sequence P F , each time you traverse to a position i, if the scrambled sequence P F The i-th element in is p i , then the inverse scrambled F value list L′ F The pth i The F value is the original F value list L F The i-th F value in ; According to the inverse scrambled F value list L′ F Rearrange the F values corresponding to the macroblocks in the S1 region in G to obtain the inversely scrambled F value distribution map G′, which satisfies the F value order obtained by raster scanning the F values corresponding to the macroblocks in the S1 region in G′ and the inversely scrambled F value list L′ F The order of F values is the same.
5. The H.264 encryption and ciphertext domain information hiding method according to claim 1, characterized in that: The information hiding process in step B43 is as follows: Traverse the 16 4x4 quantized residual coefficient blocks of the macroblock currently being hidden. Each time a 4x4 quantized residual coefficient block is traversed, the processing process is: scan the current 4x4 quantized residual coefficient block in zigzag order. Each time a quantized residual coefficient is traversed, the processing process includes steps b1-b4: b1. If the currently processed quantized residual coefficient is the first 4 coefficients in the zigzag scanning order in the current 4x4 quantized residual coefficient block, no processing is performed; b2. If the current processing quantization residual coefficient value is 0, no processing is performed; b3. If the absolute value of the currently processed quantized residual coefficient is 1, a 1-bit embedded message is obtained; if the currently embedded message bit is 0, no processing is performed on the currently processed quantized residual coefficient; If the current embedded message bit is 1, modify the current processing quantization residual coefficient so that the absolute value of the current processing quantization residual coefficient is 2 and the sign of the current processing quantization residual coefficient remains unchanged before and after the modification; b4. If the absolute value of the currently processed quantized residual coefficient is greater than 1, modify the currently processed quantized residual coefficient so that the absolute value of the currently processed quantized residual coefficient increases by 1 and the sign of the currently processed quantized residual coefficient remains unchanged before and after the modification.
6. The H.264 encryption and ciphertext domain information hiding method according to claim 3, characterized in that: The processing procedure of information extraction in step D43 is as follows: Traverse the 16 4x4 quantized residual coefficient blocks of the macroblock currently being extracted. Each time a 4x4 quantized residual coefficient block is traversed, the processing process is: scan the current 4x4 quantized residual coefficient block in zigzag order. Each time a quantized residual coefficient is traversed, the processing process includes steps d1-d4: d1. If the currently processed quantized residual coefficient is the first 4 coefficients in the zigzag scan order in the current 4x4 quantized residual coefficient block, no processing is performed; d2. If the current processing quantization residual coefficient value is 0, no processing is performed; d3. If the absolute value of the currently processed quantized residual coefficient is 1, the extracted 1-bit message is 0, and the currently processed quantized residual coefficient is not processed; If the absolute value of the currently processed quantized residual coefficient is 2, extract the 1-bit message as 1, and modify the currently processed quantized residual coefficient so that the absolute value of the currently processed quantized residual coefficient is 1 and the sign of the currently processed quantized residual coefficient remains unchanged before and after the modification; d4. If the absolute value of the currently processed quantized residual coefficient is greater than 2, modify the currently processed quantized residual coefficient so that the absolute value of the currently processed quantized residual coefficient is reduced by 1 and the sign of the currently processed quantized residual coefficient remains unchanged before and after the modification.
7. An H.264 encryption and ciphertext domain information hiding device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 6.
8. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to perform the method according to any one of claims 1 to 6 when executed by the processor.
Citation Information
Patent Citations
Video encryption algorithm based on new spatiotemporal chaos system
CN104093029A
Video encryption method for resisting contour attacks
CN110677694A
