CN116016990A - Encoding and decoding method and device - Google Patents

Encoding and decoding method and device Download PDF

Info

Publication number
CN116016990A
CN116016990A CN202211694806.6A CN202211694806A CN116016990A CN 116016990 A CN116016990 A CN 116016990A CN 202211694806 A CN202211694806 A CN 202211694806A CN 116016990 A CN116016990 A CN 116016990A
Authority
CN
China
Prior art keywords
code stream
coding
authority
area
encoding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211694806.6A
Other languages
Chinese (zh)
Inventor
秦宇
刘祥凯
王莉
孙煜程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN202211694806.6A priority Critical patent/CN116016990A/en
Publication of CN116016990A publication Critical patent/CN116016990A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a coding and decoding method and a device, and belongs to the technical field of image processing. The method comprises the steps of obtaining a coding block, a right area and position information of the right area in a target video; judging whether the current coding block belongs to a right area or not; encoding the encoding blocks which do not belong to the authority area to obtain a first code stream; performing shielding coding on the coding blocks belonging to the authority region to obtain a second code stream, and performing coding on the coding blocks belonging to the authority region to obtain a third code stream; and packaging the position information of the first code stream, the second code stream, the third code stream and the authority area to obtain a packaged data stream. The technical scheme of the invention does not need to carry out the copying process of all pixel values, saves the code stream generated by repeatedly encoding the non-authority region, thereby saving the code rate, saving the computing resources of encoding and decoding, and simultaneously realizing the picture display effect corresponding to different authorities.

Description

Encoding and decoding method and device
Technical Field
The invention relates to the field of image processing, in particular to a video image encoding method and device based on a right area, and a video image decoding method and device based on the right area.
Background
The development of new generation video multimedia such as short video also brings about a high demand for protecting security privacy information in video content, and usually, at least a number of video image frames in such video image sequences contain pictures to be protected, so that the content in the video image sequences needs to be shielded or blocked to protect the security privacy information in the images. For example, in the prior art, two parallel processing code streams are used to copy and encrypt the image pixels, however, the resources consumed by such processing and computation are doubled.
Therefore, how to effectively protect the picture area to be masked in the video while reducing the computational overhead is an urgent problem to be solved.
Disclosure of Invention
The invention aims to solve the technical problems, and provides an encoding and decoding method, a device and electronic equipment.
According to a first aspect of embodiments of the present application, there is provided an encoding method, including:
acquiring all coding blocks, authority areas and position information of the authority areas in a target video;
sequentially judging whether the current coding block belongs to the authority region or not for all the coding blocks according to the position information of the authority region;
coding the coding blocks which do not belong to the authority area according to a preset coding mode to obtain a first code stream;
performing shielding coding on the coding blocks belonging to the authority region to obtain a second code stream, and coding the coding blocks belonging to the authority region according to a preset coding mode to obtain a third code stream;
and packaging the position information of the first code stream, the second code stream, the third code stream and the authority area to obtain a packaged data stream.
According to a second aspect of embodiments of the present application, there is provided a decoding method based on the encoding method of the first aspect, including:
obtaining an encapsulated data stream, and decapsulating the encapsulated data stream to obtain a first code stream, a second code stream, a third code stream and position information of an authority area; wherein the first code stream and the second code stream are one code stream which is combined according to the coding sequence.
Decoding the first code stream and the second code stream to obtain a first picture;
selecting whether to decode the third code stream according to the opening authority of the current user, and decoding to obtain a second picture when the current user has the opening authority;
and combining the first picture and the second picture to obtain a complete third picture.
According to a third aspect of embodiments of the present application, there is provided an encoding apparatus, including:
the acquisition module is used for acquiring the coding block, the authority area and the position information of the authority area in the target video;
the judging module is used for judging whether the current coding block belongs to the authority area according to the position information;
the coding module is used for coding the coding blocks which do not belong to the authority area according to a preset coding mode to obtain a first code stream, and coding the coding blocks which belong to the authority area according to the preset coding mode to obtain a third code stream;
the shielding coding module is used for carrying out shielding coding on the coding blocks belonging to the authority region to obtain a second code stream, and combining the second code stream with the first code stream according to the coding sequence;
and the packaging module is used for packaging the position information of the first code stream, the second code stream, the third code stream and the authority area to obtain a packaged data stream.
According to a fourth aspect of embodiments of the present application, there is provided a decoding apparatus including:
the acquisition module is used for acquiring the encapsulated data stream;
the unpacking module is used for unpacking the packed data stream to obtain the first code stream, the second code stream, the third code stream and the position information of the authority area;
the decoding module is used for decoding the first code stream and the second code stream to obtain a first picture;
the shielding selection decoding module is used for selecting whether to correspondingly decode the third code stream according to the opening authority of the current user, and decoding the third code stream to obtain a second picture when the current user has the opening authority;
and the picture merging module is used for merging the pictures of the first picture and the second picture to obtain a complete third picture.
According to a fifth aspect of embodiments of the present application, there is provided an apparatus comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor for executing the machine-executable instructions to implement the encoding method or decoding method of the present invention.
According to a sixth aspect of embodiments of the present application, there is provided a computer readable storage medium comprising a computer program which, when executed by a processor, implements the encoding method or decoding method according to the present invention.
The coding and decoding method and the device provided by the invention respectively code the data corresponding to different authorities, and further splice and combine the coded code stream data according to the coding sequence by utilizing the code stream splicing, thereby directly realizing the protection of the content of the authority area part. Second, for the problem of error drift that may occur in intra-and inter-prediction during encoding, specific pixel copy mode encoding is used and the range of motion search windows is limited. In addition, a decoding system with authority grading is designed for the client decoding end with different authorities to selectively decode the encapsulation data containing two types of code streams and authority area position information for the encoding process, and only the non-authority area encoding block and the shielded authority area code stream are decoded for the non-authority user; for the authorized user, the normal decoding of the authorized region coding block replaces the screen coding of the authorized region, so as to obtain unprotected complete video data corresponding to the open authorization. Compared with the prior art, the coding and decoding method does not need to carry out the copying process of all pixel values, and saves the code stream generated by repeatedly coding the non-authority area; and meanwhile, the picture display corresponding to different authorities is realized, and when the user side does not have the open authority, the user side does not need to additionally set a special coding and decoding mode, and the shielded video data is directly obtained, so that the code rate is saved, and the coding and decoding calculation resources are saved.
Drawings
The invention will now be described by way of example and with reference to the accompanying drawings in which:
fig. 1 is a flow chart of an encoding method according to an embodiment of the present invention.
Fig. 2 is a flow chart of another encoding method provided in an embodiment of the present invention.
Fig. 3 is a schematic diagram of a code stream splicing method according to an embodiment of the present invention.
Fig. 4 is a flow chart of a decoding method according to an embodiment of the present invention.
Fig. 5 is a schematic structural diagram of an encoding device according to an embodiment of the present invention.
Fig. 6 is a schematic structural diagram of a decoding apparatus according to an embodiment of the present invention.
Fig. 7 is a schematic hardware structure of an encoding end/decoding end device according to an embodiment of the present application.
Detailed Description
In order to make the technical solution of the present invention better understood by those skilled in the art, the technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings, and based on the embodiments in the present application, other similar embodiments obtained by those skilled in the art without making creative efforts should fall within the scope of protection of the present application. The following embodiments and features of the embodiments may be combined with each other without conflict.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
The coding method provided by the invention is based on the splicing of the code streams of the authority areas, and when the coding process starts, whether each coding block is the coding block of the authority area is judged according to the coding sequence and the position information of the authority area.
According to the determined authority area position information, respectively encoding the target images: including normal regular coding and mask coding.
If the current coding block is not the authority region coding block, normally coding according to the video coding standard, and writing the code stream information into a first code stream; if the current coding block is the authority region coding block, dividing the current coding block into two paths, wherein one path sets the coefficient to be coded of the current coding block to be a preset value, and writes the code stream information into a second code stream, and the second code stream and the first code stream are combined according to the coding sequence; and the other way normally codes the real coefficient value to be coded of the current coding block according to the video coding standard, and writes the code stream information into a third code stream.
Specific embodiments will now be described in detail.
An embodiment is an encoding method for performing two-pass encoding protection on a target image including a rights area, as shown in fig. 1, and fig. 1 is a simple flow chart of an encoding method according to an embodiment of the invention. The encoding method may include the steps of:
step S101, obtaining coding blocks and authority areas in a target video image, and judging whether each coding block is an authority area coding block.
At the beginning of encoding, the target video is taken as an original video sequence to be encoded, and first, the rights area information therein needs to be determined, including but not limited to the position information of the rights area. For example, when the authority area is a rectangular area, the position information of the authority area may be coordinate information of diagonal vertices (such as an upper left vertex and a lower right vertex, an upper right vertex and a lower left vertex) of the rectangular area, coordinate information of one vertex and width and height information of the rectangular area, coordinate information of a center point of the rectangular area, width and height information, and the like.
And then judging whether each coding block belongs to the authority region or not according to the coding sequence for each frame of image in the video according to the information of the authority region. For example, when the position of the encoded block is the same as the position of the right area, or the overlap of the position of the encoded block and the position of the right area is large, the current encoded block is considered to belong to the right area encoded block. The dividing and determining of the encoding block and the authority area may use the prior art to enable the judging step in the embodiment, which is not limited in this embodiment.
The permission area can include, but is not limited to, an area to be shielded in a video, wherein the area to be shielded can be a guideboard area, a license plate area, a person image captured by a shooting device and the like in a video image, such as a face image and a face human body image, or can be a preset picture fixing position according to requirements. The number of rights areas in a video image may be one or more. For example, all license plate regions in one image including a plurality of license plates may be used as the authority regions, or only one or a plurality of license plates may be designated as the authority regions.
In the embodiment of the present application, when the target contour of the non-standard rectangle is obtained by the target detection method, for example, a face or a figure, in the case where the right region to be masked is determined by the target detection method, the position information of the minimum circumscribed rectangle of the target contour may also be used as the position information of the right region.
One of the objects of the present embodiment is to mask the picture of the authority area, including but not limited to blurring processing, modifying picture information, masking using other image information, and the like, such as mosaic processing. The masking processing for a plurality of different authority areas can adopt the same processing mode or different processing modes.
Step S102, if the current coding block does not belong to the authority region coding block, the current coding block is coded in the first code stream according to a preset conventional coding mode. And if the current coding block belongs to the authority region coding block, performing shielding coding in the second code stream according to a preset shielding coding mode.
In the embodiment of the application, different coding schemes are adopted in different code streams for the right region coding blocks and the non-right region coding blocks which are already distinguished from the same video image respectively.
Correspondingly, in this embodiment, the first code stream is used to encode the non-authority area encoding block according to a preset conventional encoding mode. The conventional coding mode refers to a coding mode performed in order to obtain a correct display effect for an image in the field of image coding, for example, mainstream video coding standards such as h.264/AVC and h.265/HEVC. The encoded data is stored in a first code stream.
The second code stream is used for carrying out shielding coding on the authority region coding block according to a preset shielding coding mode. In this embodiment, considering the requirement of reducing the consumption of computing resources, the encoding coefficients of the rights area encoding block are all set to a preset value. The preset value may be, for example, 0, 128 or 255, or may be a calculated value associated with the image parameter value, or may be random. And the changed coefficient value is stored in the second code stream, so that the coding resource can be saved, and the coded data volume is smaller.
Other more complex masking methods may be used in other embodiments, for example, masking the region of rights to be masked (i.e., performing a mosaic process on the region to be masked) may be performed by multi-tap averaging and downsampling.
Step S103, merging the first code stream and the second code stream according to the coding sequence, and packaging the position information of all coded data and the authority area after finishing the coding of all the coding blocks, thereby being used for data decoding or data storage at a communication transmission or decoding end.
After the coding blocks are coded respectively in the first code stream or the second code stream according to the coding sequence, the coding blocks in the two code streams are combined in a code stream splicing mode according to the coding sequence, the combined code stream data are packaged, and then the packaged data transmission can be transmitted to the corresponding decoding end in a communication mode. In a preferred embodiment, the code stream combining may be performed while encoding in the encoding order, or may be performed after encoding all the encoding blocks.
The encoding process is carried out by encoding terminal equipment, and after the corresponding communication data is transmitted to decoding terminal equipment, the decoding terminal equipment directly decodes and reconstructs and displays the unpacked spliced code stream data according to a decoding method corresponding to encoding. The decoded video data is the video data after shielding the authority area, the authority area is in an invisible state in the user side picture, and the non-authority area is in a normal display state in the user side picture.
On the basis of the first embodiment, the second embodiment describes a decoding method, when the decoding end needs to select whether to mask the decoding authority area according to different authorities, the unmasked source data needs to be reserved during encoding in the scene, so as to restore the video data of the corresponding authorities for the decoding end of different authorities while reducing the consumption of computing resources as much as possible.
As shown in fig. 2, a simple flow chart of an encoding method, which performs different encoding processes on encoding blocks with different purposes based on a right area and a right, includes:
step S201, each coding block of the original video sequence is obtained after coding is started, the authority area in the corresponding target video image is obtained, and whether each coding block belongs to the authority area coding block or not is judged.
In this step, the determination method in the foregoing embodiment may be adopted, or the determination of the encoding block may be performed using other image parameters, which is not limited in this embodiment.
One of the purposes of this embodiment is: the picture of the authority area is processed by the user end without the open authority so that the picture can be shielded from being seen on the decoded display picture without an additional decoder, and the authority area can be displayed normally after the user end with the open authority is selectively shielded. In order to achieve the purpose, the decoding end needs to receive the shielding coded data and the unshielded coded data of the authority area at the same time, so that different decoding processes of the authority area can be carried out according to different open authorities, and further the terminal with the viewable authorities displays a complete unshielded video sequence, and the terminal without the open authorities displays the video sequence after shielding the authority area.
Step S202, if the current coding block does not belong to the authority region coding block, coding the current coding block in a first code stream according to a preset conventional coding mode; if the current coding block belongs to the authority region coding block, the authority region coding block is further shielded and processed correspondingly according to whether the authority region coding block is shielded or not.
Correspondingly, in this embodiment, the first code stream is used for encoding the non-authority area encoding block according to a preset conventional encoding mode. The conventional coding mode refers to a coding mode performed in order to obtain a correct display effect for an image in the field of image coding, for example, mainstream video coding standards such as h.264/AVC and h.265/HEVC. The encoded data is stored in a first code stream.
Step S203, if the current authority region coding block is shielded, the authority region coding block is directly shielded and coded in a second code stream according to a preset shielding coding mode; if the current authority region coding block does not need to be shielded, the authority region coding block is shielded and coded in a second code stream according to a preset shielding coding mode, and meanwhile, the authority region coding block is coded in a third code stream according to a preset conventional coding mode.
In this processing step, the same mask encoding method as that of the previous embodiment may be used for the mask encoding method of the right region encoding block in the second code stream, that is, the encoding coefficients of the right region encoding block are all set to a preset value, and the changed coefficient values are stored in the second code stream, and other mask encoding schemes may be used in other embodiments.
In the processing step, the right region coding block is coded in the third code stream, and the coding mode which is the same as that of the first code stream for the non-right region can be adopted, or other conventional coding modes which can enable the right region picture to be finally and correctly displayed can be adopted, so that the coded data after the right region is coded is finally obtained.
Step S204, after the encoding of the video image of the three-way code stream is completed, all the encoded data are encapsulated, so that the encoded data are used for the communication transmission and the data decoding of the decoding end.
After the first code stream, the second code stream and the third code stream are respectively encoded, the code streams are combined into one code stream according to the encoding sequence by the encoding blocks in the first code stream and the second code stream, and the combined one code stream data and the third code stream are packaged.
And merging and packaging the code streams of the three parts of coded data, and then, carrying out network communication on the packaged data to transmit to a corresponding decoding end or storing the data. All the encoding processes are carried out by encoding terminal equipment, and after the corresponding decoding terminal receives communication data, the encapsulated data are selectively decoded and displayed according to the open authority of the user terminal. If the current user does not have the open authority, the decoded data is the video data which comprises the authority area after shielding, and the authority area is in an abnormal display state in the picture; if the current user has the open authority, the decoded data are video data which comprise the authority area and are not shielded, and all the video data are normally displayed in the picture.
In the above embodiment, the step of encoding and storing the authority area and the non-authority area by using the first code stream and the second code stream respectively may be used as a preferred embodiment, after determining whether the authority area is the authority area, the normal encoding information of the non-authority area and the shielding encoding information of the authority area may be sequentially written into the first code stream according to the encoding sequence, and the normal encoding information of the authority area may be written into the second code stream. This allows two encodings of the rights region to be accomplished while using only two streams as in example one.
In a specific embodiment, the method of merging the code streams of the first code stream and the second code stream may be a method of splicing the code streams based on the first code stream as shown in fig. 3, taking the first code stream bs1 and the second code stream bs2 as an example, a first temporary storage block tmp_bs1 of the code stream is set, and when the nth code block is encoded, the bs1 already contains the code stream information (encoding block) corresponding to the n-1 encoded data blocks that have been encoded previously. If the nth coding block is a non-authority area coding block, temporarily storing the coding block in a first code stream temporary storage block tmp_bs1 when coding, and splicing the coded code stream in tmp_bs1 to the code stream of bs1 after finishing coding; if the nth coding block is the shielding coding of the authority region coding block, shielding coding is carried out in the second code stream, and after coding is finished, the coding block data in the second code stream bs2 is spliced in the code stream bs 1. Accordingly, the relationship between the first code stream bs1 and the first code stream temporary storage blocks tmp_bs1 and the second code stream bs2 can be expressed as follows: bs1+=tmp_bs1, bs1+=bs2. That is, the corresponding coding information when the current nth coding block is coded is temporarily stored in the first temporary code stream storage block tmp_bs1 or the second code stream bs2, then the code stream information about the nth coding block in the first temporary code stream storage block tmp_bs1 or the second code stream bs2 is additionally written into the first code stream bs1 through code stream splicing, and finally the first code stream bs1 contains all the code stream information of all the coding blocks in the target video sequence which are spliced in sequence according to the coding sequence.
In another embodiment, the coded block code stream information in the first code stream bs1 and the second code stream bs2 may be sequentially spliced and written in a new code stream bs_new according to the coding sequence, and finally the coded code stream in the non-authority area and the shielded coded code stream in the authority area may be stored as a complete code stream according to the coding sequence. The splicing of the complete code stream can lead the decoding end to directly decode the complete code stream by using a common or conventional standard decoder (no extra special decoder) when the shielding picture is not needed to be checked, thus being capable of decoding and reconstructing an independent video image containing a shielded target area, greatly reducing the workload of the decoding end and improving the decoding speed and efficiency.
In a specific embodiment, after the encoding of all video image data is completed, the encoding end encapsulates and packages all data, including a code stream in which the first code stream information and the second code stream information are combined according to the encoding order, third code stream information, and position information of the authority area. And finally, the packaged data comprises normal coding data of the non-authority area, shielding coding data of the authority area, normal coding data of the authority area and position information of the authority area.
In one embodiment, the encapsulation data may further include rights confirmation information of non-open rights and open rights corresponding to the mask encoded data and the normal encoded data of the rights area, respectively, for verifying the rights information and obtaining video display data corresponding to the rights when the corresponding decoding end decodes.
In any of the foregoing embodiments, the presence of the alternate splice coding of the two non-entitlement region codes and the mask coding of the entitlement region results in the occurrence of a partially normal coded non-entitlement region requiring a reference coded entitlement region. At this time, if the reference mask encoded block is a block of the right region, for example, a block of the right region filled with a preset coefficient value, intra prediction errors may occur in the non-right region encoding. In this embodiment, PCM mode is used for the special non-authority region coding block to code the sub-blocks at the left and upper boundaries of the coding block, so as to ensure that error diffusion does not occur at the decoding end.
The PCM mode is a special coding mode within a frame that directly transmits pixel values at the encoding end. When the PCM mode is adopted, the original pixel value is directly transmitted to the decoding end without the steps of prediction, transformation, quantization, entropy coding and the like. Similarly, the decoding end does not need to undergo steps such as prediction, and the pixel value can be directly read out from the code stream.
On the other hand, the two alternate encodings, namely encoding of the non-privileged region and masking encoding of the privileged region, result in possible inter-prediction error drift, and this problem is solved by limiting the range of the motion estimation search window in the present embodiment, specifically including: as shown in fig. 4, the reference frame image is divided into two parts of a permission area Spr and a non-permission area Snpr, the motion estimation search window range of the current macro block of the current frame is set as Sw, snpr and Sw are intersected, and the obtained range Snpr n Sw is the motion estimation search window used by the current macro block.
The parameters of the current Motion Vector (Motion Vector) determine the parameter size of the Motion estimation search window range SW of the current macroblock, and in one embodiment the search Motion pattern of the current Motion Vector (Motion Vector) and the size of the current Motion Vector (Motion Vector) area are used to determine
By setting the range of the Motion estimation search window of the current frame, it is ensured that the reference block formed by the offset of the current macro block in the search of the current Motion Vector in the reference frame does not generate intersection with the authority region (Spr), namely the current Motion Vector in the intersection region cannot be selected as the optimal Motion Vector for search in the reference frame. The specific operation is as follows: if the reference block formed by the current motion vector is judged to have an intersection region, the corresponding rate distortion Cost (RD Cost) is set to be the maximum value in a selectable range in the corresponding rate distortion optimization process (RDO), so that the current motion vector cannot be selected when the optimal motion vector is selected. The rate-distortion Cost (RD Cost) is a measurement criterion used in the rate-distortion optimization process.
The present embodiment provides a decoding method corresponding to the foregoing implementation, as shown in fig. 4.
The decoding method comprises the following steps:
step S401, after obtaining and receiving the package data, unpacking the package data to obtain the position information of the first code stream, the second code stream, the third code stream and the authority area; the first code stream and the second code stream are the code streams which are combined according to the coding sequence.
Step S402, completing authority hierarchical decoding operation according to the opening authority of the current user. The method comprises the following steps: for users without open rights, decoding the first code stream and the second code stream directly according to a decoding mode corresponding to the encoding mode to obtain a first picture containing a normally decoded non-right area and a shielded right area; and aiming at the users with the open rights, decoding the third code stream according to a decoding mode corresponding to the encoding mode to obtain a second picture containing a right area of normal decoding.
In this embodiment, the determination of whether the open right is provided may be performed after decoding one of the combined first and second streams, or may be performed before decoding one of the combined first and second streams.
Step S403, according to the position information of the authority area, combining the second picture and the first picture containing the authority area after normal decoding to obtain a third picture containing the complete video image. And the third picture comprises a complete video image which is normally displayed in both the authority area and the non-authority area.
For users with open rights, the decoding end combines the right region image decoded by the third code stream with all the previous decoded images after all the decoding is completed, namely, the unshielded right region covers the shielded right region, and all the complete video images which are not shielded are obtained. At this point the corresponding user can view all of the unshielded video pictures.
In a preferred embodiment, when decoding the first code stream and the second code stream, a decoding scheme corresponding to the decoding scheme when encoding the non-authority region is adopted, and the first picture with the authority region shielded is obtained after direct decoding. The decoding scheme may be mainstream video coding standards h.264/AVC, h.265/HEVC, etc., and the decoding process includes operations such as inter/intra prediction, transformation quantization, entropy coding, etc., and after a coding and decoding standard or mode is selected, the standard process of specific coding and decoding is not limited in this embodiment.
Corresponding to the above-mentioned encoding method provided by the embodiment of the present invention, the present embodiment further provides an encoding device.
Fig. 5 is a schematic structural diagram of an encoding device according to an embodiment of the present invention, and as shown in fig. 5, the encoding device may include the following modules:
the obtaining module 510 is configured to obtain each encoding block in the video to be encoded, and obtain a rights area in the corresponding target video image and location information of the rights area;
the judging module 520 is configured to judge, for each encoding block, whether the encoding block belongs to the encoding block of the authority area according to the position information of the authority area;
the encoding module 530 is configured to perform normal encoding on the non-authority area and the authority area according to a predetermined encoding manner, so as to obtain a first code stream and a third code stream respectively;
the mask encoding module 540 is configured to mask-encode the authority area to obtain a second code stream, and combine the second code stream with the first code stream according to an encoding sequence;
and the encapsulation module 550 is configured to encapsulate the first code stream, the second code stream, the third code stream, and the location information of the authority area, to obtain an encapsulated data stream.
In a preferred embodiment, the second code stream and the third code stream respectively include corresponding open authority confirmation information, so that after the decoding end confirms whether the current user has the open authority, the second code stream or the third code stream corresponding to the authority is used for decoding.
Corresponding to the decoding method provided in the above embodiment of the present invention, the present embodiment further provides a decoding device.
Fig. 6 is a schematic structural diagram of a decoding device according to an embodiment of the present invention, as shown in fig. 6, the device may include the following modules:
an obtaining module 610, configured to obtain an encapsulated data stream;
a decapsulation module 620, configured to decapsulate the encapsulated data stream to obtain a first code stream, a second code stream, a third code stream, and location information of a permission area;
a decoding module 630, configured to decode the first code stream and the second code stream to obtain a first picture that includes a normally decoded non-right area and a masked right area;
the mask selection decoding module 640 is configured to select whether to decode the third code stream corresponding to the authority area according to whether the current user has an open authority, and decode to obtain a second picture containing the normally decoded authority area when the current user has an open authority;
the frame combining module 650 is configured to combine the first frame and the second frame to obtain a third frame containing the completely decoded video image and display the third frame.
Corresponding to the encoding method and the decoding method provided by the embodiments of the present invention, the embodiments of the present invention further provide a corresponding electronic device, as shown in fig. 7, including a processor 701, a communication interface 702, a memory 703, and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete communication with each other through the communication bus 704, and the memory 703 is used for storing a computer program; the processor 701 is configured to implement the steps of an encoding method provided in the above-described embodiment of the present invention and/or the steps of a decoding method provided in the above-described embodiment of the present invention when executing the program stored in the memory 703.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The memory may include random access memory (Random Access Memory, RAM) or may include non-volatile memory (Non Volatile Memory, NVM), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In still another embodiment of the present invention, a computer readable storage medium is provided, where a computer program is stored, where the computer program, when executed by a processor, implements the steps of an encoding method provided by the embodiment of the present invention and/or the steps of a decoding method provided by the embodiment of the present invention.
In yet another embodiment of the present invention, a computer program product comprising instructions, which when run on a computer, causes the computer to perform the steps of an encoding method provided by the above-mentioned embodiment of the present invention and/or the steps of a decoding method provided by the above-mentioned embodiment of the present invention is also provided.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the apparatus embodiments, the electronic device embodiments, the computer-readable storage medium embodiments, and the computer program product embodiments, the description is relatively simple, as relevant to the description of the method embodiments in part, since they are substantially similar to the method embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (11)

1. A method of encoding, the method comprising:
acquiring all coding blocks, authority areas and position information of the authority areas in a target video;
sequentially judging whether the current coding block belongs to the authority region or not for all the coding blocks according to the position information of the authority region;
coding the coding blocks which do not belong to the authority area according to a preset coding mode to obtain a first code stream;
performing shielding coding on the coding blocks belonging to the authority region to obtain a second code stream, and coding the coding blocks belonging to the authority region according to a preset coding mode to obtain a third code stream;
and packaging the position information of the first code stream, the second code stream, the third code stream and the authority area to obtain a packaged data stream.
2. The coding method according to claim 1, wherein the first code stream obtained by coding in a predetermined coding manner and the second code stream obtained by mask coding are combined into one code stream by code stream in coding order.
3. The encoding method of claim 2, wherein the mask encoding the encoded blocks belonging to the rights area comprises: and setting all the coding coefficients of the coding blocks belonging to the authority area to be preset values, and storing the modified coding coefficient values in a second code stream.
4. A coding method according to claim 3, wherein if the current coding block is a non-entitlement region coding block requiring a reference entitlement region, sub-blocks at left and upper boundaries of the coding block are coded using a pixel value transmission coding mode.
5. A coding method according to claim 3, wherein a current macroblock motion estimation search window is provided in the current frame, and the motion estimation search range of the current frame is defined as an intersection of the non-authorized region of the reference frame and the current macroblock motion search window of the current frame.
6. The encoding method of claim 7, wherein it is determined in the reference frame whether the search of the current motion vector generates an intersection between the reference block formed by the offset of the current macroblock and the right region, and if the intersection region exists, the corresponding rate-distortion cost is set to a maximum value within a selectable range in the corresponding rate-distortion optimization process, so that the current motion vector cannot be selected when the optimal motion vector is selected.
7. A decoding method based on the encoding method of any one of claims 1 to 6, comprising:
obtaining an encapsulated data stream, and decapsulating the encapsulated data stream to obtain a first code stream, a second code stream, a third code stream and position information of an authority area; the first code stream and the second code stream are one code stream which is combined according to the coding sequence;
decoding the first code stream and the second code stream to obtain a decoded first picture;
selecting whether to decode the third code stream according to the opening authority of the current user, and decoding to obtain a second picture containing at least part of the unshielded authority area when the current user has the opening authority;
and combining the second picture with the first picture according to the position information of the authority area to obtain a decoded third picture.
8. The decoding method as claimed in claim 7, wherein the open right refers to a right of a user to view a complete right area image; the shielding degree of the right areas corresponding to the open rights of different levels is different.
9. An encoding apparatus, the apparatus comprising:
the acquisition module is used for acquiring the coding block, the authority area and the position information of the authority area in the target video;
the judging module is used for judging whether the current coding block belongs to the authority area according to the position information;
the coding module is used for coding the coding blocks which do not belong to the authority area according to a preset coding mode to obtain a first code stream, and coding the coding blocks which belong to the authority area according to the preset coding mode to obtain a third code stream;
the shielding coding module is used for carrying out shielding coding on the coding blocks belonging to the authority region to obtain a second code stream, and combining the second code stream with the first code stream according to the coding sequence;
and the packaging module is used for packaging the position information of the first code stream, the second code stream, the third code stream and the authority area to obtain a packaged data stream.
10. A decoding device, the device comprising:
the acquisition module is used for acquiring the encapsulated data stream;
the unpacking module is used for unpacking the packed data stream to obtain the first code stream, the second code stream, the third code stream and the position information of the authority area;
the decoding module is used for decoding the first code stream and the second code stream to obtain a first picture;
the shielding selection decoding module is used for selecting whether to decode the third code stream according to the opening authority of the current user, and decoding the third code stream to obtain a second picture when the current user has the opening authority;
and the picture merging module is used for carrying out picture merging on the first picture and the second picture to obtain a third picture and displaying the third picture.
11. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a computer program which, when executed by a processor, implements the encoding method or the decoding method according to any one of claims 1 to 10.
CN202211694806.6A 2022-12-28 2022-12-28 Encoding and decoding method and device Pending CN116016990A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211694806.6A CN116016990A (en) 2022-12-28 2022-12-28 Encoding and decoding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211694806.6A CN116016990A (en) 2022-12-28 2022-12-28 Encoding and decoding method and device

Publications (1)

Publication Number Publication Date
CN116016990A true CN116016990A (en) 2023-04-25

Family

ID=86020466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211694806.6A Pending CN116016990A (en) 2022-12-28 2022-12-28 Encoding and decoding method and device

Country Status (1)

Country Link
CN (1) CN116016990A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116761023A (en) * 2023-07-04 2023-09-15 唯科终端技术(东莞)有限公司 Video transmission method between different devices

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101674477A (en) * 2009-09-25 2010-03-17 中国科学院计算技术研究所 Suppression method and system of error drift in scramble video of private area
CN108833921A (en) * 2018-06-12 2018-11-16 浙江大华技术股份有限公司 A kind of decoding method and device
CN112243127A (en) * 2020-09-30 2021-01-19 江苏大学 HEVC video encryption method based on region of interest
CN113453012A (en) * 2021-06-25 2021-09-28 杭州海康威视数字技术股份有限公司 Encoding and decoding method and device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101674477A (en) * 2009-09-25 2010-03-17 中国科学院计算技术研究所 Suppression method and system of error drift in scramble video of private area
CN108833921A (en) * 2018-06-12 2018-11-16 浙江大华技术股份有限公司 A kind of decoding method and device
CN112243127A (en) * 2020-09-30 2021-01-19 江苏大学 HEVC video encryption method based on region of interest
CN113453012A (en) * 2021-06-25 2021-09-28 杭州海康威视数字技术股份有限公司 Encoding and decoding method and device and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116761023A (en) * 2023-07-04 2023-09-15 唯科终端技术(东莞)有限公司 Video transmission method between different devices

Similar Documents

Publication Publication Date Title
US20200252650A1 (en) Video processing method for blocking in-loop filtering from being applied to at least one boundary in reconstructed frame and associated video processing apparatus
CA3027764C (en) Intra-prediction video coding method and device
AU2020309130B2 (en) Sample padding in adaptive loop filtering
CN113453012B (en) Encoding and decoding method and device and electronic equipment
US20110170609A1 (en) Apparatus, a method and a computer program for video processing
JP7560227B2 (en) Padding process in adaptive loop filtering.
JP7568353B2 (en) Adaptive Loop Filtering Between Different Video Units - Patent application
CN108965882B (en) Encoding and decoding method and device
CN116016990A (en) Encoding and decoding method and device
US20170374364A1 (en) Method and Apparatus of Face Independent Coding Structure for VR Video
JP7454042B2 (en) Padding process at unavailable sample positions in adaptive loop filtering
WO2021008546A1 (en) Accessing samples across video unit boundaries in adaptive loop filtering
WO2023093501A1 (en) Method and system for processing privacy content in video, and electronic device and medium
TW201834453A (en) Method and apparatus for adaptive video decoding
CN110022481A (en) Decoding, generation method and device, storage medium, the electronic device of video code flow
JP2024081752A (en) Information processing method and device, equipment, and storage medium
KR20210055278A (en) Method and system for hybrid video coding
CN109660806B (en) Encoding method and device and electronic equipment
CN116800965A (en) Image processing method, encoding device, decoding device and storage medium
CN112385235A (en) Prediction of light field encoding and decoding
CN111818333B (en) Intra-frame prediction method, device, terminal and storage medium
Kim et al. An efficient architecture of in-loop filters for multicore scalable HEVC hardware decoders
CN115086659A (en) Image encoding and decoding method, encoding device, decoding device, and storage medium
CN104573546A (en) Processing system with virtual clients and methods for use therewith
KR20040111436A (en) Video signal post-processing method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination