CN117412053A - Video encoding method, video encoding device, electronic equipment and storage medium - Google Patents
Video encoding method, video encoding device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117412053A CN117412053A CN202210805167.XA CN202210805167A CN117412053A CN 117412053 A CN117412053 A CN 117412053A CN 202210805167 A CN202210805167 A CN 202210805167A CN 117412053 A CN117412053 A CN 117412053A
- Authority
- CN
- China
- Prior art keywords
- image
- encoded
- slice
- coding
- target
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 58
- 238000004891 communication Methods 0.000 claims description 13
- 239000013598 vector Substances 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012545 processing Methods 0.000 abstract description 5
- 230000008569 process Effects 0.000 description 8
- 230000006835 compression Effects 0.000 description 4
- 238000007906 compression Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000000903 blocking effect Effects 0.000 description 3
- 238000009499 grossing Methods 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/157—Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
- H04N19/159—Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/172—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/176—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/42—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The application relates to a video coding method, a video coding device, electronic equipment and a storage medium, which are applied to the technical field of data processing, wherein the method comprises the following steps: acquiring an image to be encoded and encoding indication information of the image to be encoded; dividing an image to be encoded into a first number of slices, the first number being a positive integer greater than 2; when the coding indication information indicates that the image to be coded needs to be coded by a video access point, configuring the type of a target slice in the image to be coded as an I type, configuring slices except the target slice as a P type, wherein the target slice is any target number of slices in the image to be coded, and the target number is an integer smaller than the first number; determining the type of each slice in the image to be encoded and the position of each slice in the image to be encoded as the encoding information of the image to be encoded, and encoding based on the encoding information; and after the number of the target slices reaches the first number, determining video access point coding, wherein the positions of the target slices in each image to be coded, which is subjected to video access point coding, are different.
Description
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a video encoding method, apparatus, electronic device, and storage medium.
Background
Rate smoothness and image quality are two important indicators in the field of IDR frame coding. IDR frames (video random access points) are key elements in video codec systems, which are the start point of the codec and the point of error recovery. The macroblock is the smallest coding unit in IDR frame coding, followed by a slice (slice) and then a frame (frame). The coding type of each macroblock can be divided into inter coding and intra coding, and slices (slices) can be divided into: I_Slice, P_Slice. Wherein, the i_slice only contains intra-coded macro blocks, and the p_slice may contain both inter-coded and intra-coded macro blocks.
In the related art, since the slices included in the IDR frame are all i_slices, the same macroblock uses intra-frame coding to occupy a larger amount of data than inter-frame coding, resulting in a particularly large amount of data after each IDR frame is coded.
Therefore, in order to realize rate control and prevent the phenomenon of instantaneous super-rate in the field of video conferences, measures for reducing image quality are generally taken to limit the data size after IDR frame compression, so that all terminal images are subjected to virtual/flash, and in addition, in the case of overlarge IDR frame data volume, the blocking and delay can be caused in a system with limited bandwidth.
Disclosure of Invention
The application provides a video coding method, a video coding device, an electronic device and a storage medium, which are used for solving the problems that in the prior art, IDR frames have overlarge data quantity due to the fact that all included slices are I_slices, and the IDR frames can cause blocking and delay in a system with limited bandwidth.
In a first aspect, an embodiment of the present application provides a video encoding method, including:
the following encoding steps are performed: acquiring an image to be encoded and encoding indication information of the image to be encoded;
dividing the image to be encoded into a first number of slices, the first number being a positive integer greater than 2;
when the coding indication information indicates that the image to be coded needs to be coded by a video access point, configuring the type of a target slice in the image to be coded as an I type, configuring slices except the target slice as a P type, wherein the target slice is any target number of slices in the image to be coded, and the target number is an integer smaller than the first number;
determining the type of each slice in the image to be encoded and the position of each slice in the image to be encoded as the encoding information of the image to be encoded, and encoding based on the encoding information;
and repeatedly executing the coding step, and determining that the video access point coding is finished after the number of the target slices reaches the first number, wherein the positions of the target slices in the to-be-coded images subjected to video access point coding are different.
Optionally, before the coding indication information indicates that the image to be coded needs to be coded by a video access point, the method further includes:
judging whether the coding indication information indicates that video access point coding is needed to be carried out from the current image to be coded or not;
if yes, configuring a second number of pieces of the residual I type in the coding indication information, wherein the initial value of the second number is the first number;
after obtaining the coding information of the image to be coded each time, the method further comprises the following steps:
updating the second number to the second number minus one.
Optionally, the coding indication information indicates that the image to be coded needs to be coded by a video access point, including:
and the second quantity in the coding indication information is not 0, and the image to be coded is determined to need to be coded by a video access point.
Optionally, the configuring the type of the target slice in the image to be encoded to be I type includes:
determining the position of the first quantity minus the second quantity in the image to be coded as the target slice;
the type of the target tile is configured as type I.
Optionally, before the encoding based on the encoding information, the method further includes:
when the I-type slice is included in the image to be encoded, determining a motion vector range of a target P-type slice in the image to be encoded, wherein the motion vector range comprises the position of the target P-type slice in the previous image to be encoded and the I-type slice in the previous image to be encoded, and the target P-type slice is a P-type slice above the I-type slice;
and determining the motion vector range of the slice as the coding information.
Optionally, the method further comprises:
and when the coding indication information indicates that the image to be coded does not need to be coded by a video access point, configuring the types of all the slices in the image to be coded as P types.
Optionally, after the configuring the types of all slices in the image to be encoded to be P-type, the method further includes:
counting the configured third number of the images to be encoded;
and ending the coding when the third number reaches the number of the preset coded images.
In a second aspect, an embodiment of the present application provides a video encoding apparatus, including:
the acquisition module is used for executing the following coding steps: acquiring an image to be encoded and encoding indication information of the image to be encoded;
a slicing module, configured to divide the image to be encoded into a first number of slices, where the first number is a positive integer greater than 2;
a configuration module, configured to configure a type of a target slice in the image to be encoded as an I type, configure slices other than the target slice as a P type, where the target slice is any target number of slices in the image to be encoded, and the target number is an integer smaller than the first number, when the encoding indication information indicates that the image to be encoded needs video access point encoding;
the first determining module is used for determining the type of each slice in the image to be encoded and the position of each slice in the image to be encoded as the encoding information of the image to be encoded, and encoding based on the encoding information;
and the second determining module is used for repeatedly executing the encoding step, and determining video access point encoding after the number of the target slices reaches the first number, wherein the positions of the target slices in the images to be encoded after the video encoding is completed are different.
In a third aspect, an embodiment of the present application provides an electronic device, including: the device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to execute the program stored in the memory, and implement the video encoding method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program, where the computer program implements the video encoding method of the first aspect when executed by a processor.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: according to the method provided by the embodiment of the application, the image to be encoded and the image encoding indication information to be encoded are obtained; dividing the image to be encoded into a first number of slices, the first number being a positive integer greater than 2; when the coding indication information indicates that the image to be coded needs to be coded by a video access point, configuring the type of a target slice in the image to be coded as an I type, configuring slices except the target slice as a P type, wherein the target slice is any target number of slices in the image to be coded, and the target number is an integer smaller than the first number; determining the type of each slice in the image to be encoded and the position of each slice in the image to be encoded as the encoding information of the image to be encoded, and encoding based on the encoding information; and repeatedly executing the coding step, and determining video access point coding after the number of the target slices reaches the first number, wherein the positions of the target slices in the to-be-coded images subjected to video coding are different. In this way, by the above coding method, the I-type Slice in the IDR frame is coded into at least two consecutive pictures to be coded, so that the I-type Slice in each picture to be coded is reduced, and thus the data volume coded in the frame in the same macroblock is reduced, a video random access point is divided into a plurality of i_slice and allocated to different positions of consecutive frames of pictures to be coded for coding, so that the data volume of each frame is not excessively large, thereby achieving the purpose of code rate smoothing, and avoiding the blocking and delay of the system.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
Fig. 1 is an application scenario diagram of a video encoding method according to an embodiment of the present application;
FIG. 2 is a flowchart of a video encoding method according to an embodiment of the present application;
fig. 3 is a schematic diagram of a motion search range of a video encoding method according to an embodiment of the present application;
fig. 4 is a block diagram of a video encoding apparatus according to an embodiment of the present application;
fig. 5 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present application based on the embodiments herein.
According to one embodiment of the present application, a video encoding method is provided. Alternatively, in the embodiment of the present application, the video encoding method described above may be applied to a hardware environment constituted by the terminal 101 and the server 102 as shown in fig. 1. As shown in fig. 1, the server 102 is connected to the terminal 101 through a network, which may be used to provide services (such as video services, application services, etc.) to the terminal or clients installed on the terminal, and a database may be provided on the server or independent of the server, for providing data storage services to the server 102, where the network includes, but is not limited to: the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, or the like.
The application environment of the video coding method of the present application may be, but not limited to, all application scenarios including video coding, such as video conference, video live broadcast, video monitoring, video transcoding, etc.
The video encoding method of the embodiment of the present application may be performed by the server 102, may be performed by the terminal 101, or may be performed by both the server 102 and the terminal 101. The terminal 101 may perform the video encoding method according to the embodiment of the present application, or may be performed by a client installed thereon.
Taking a terminal to execute the video encoding method according to the embodiment of the present application as an example, fig. 2 is a schematic flow chart of an alternative video encoding method according to the embodiment of the present application, as shown in fig. 2, the flow of the method may include the following steps:
step 201, obtaining an image to be encoded and the image encoding indication information to be encoded.
In some embodiments, the coding indication information of the image to be coded may include information for indicating whether the image to be coded needs video access point coding.
Step 202, dividing the image to be encoded into a first number of slices, wherein the first number is a positive integer greater than 2.
In some embodiments, the first number may be preset at initialization of the encoding system. Illustratively, at the initialization of the encoding system, the wide and high pixels of each frame of image are set to width and height, respectively. The number N of slices (slices) to be divided per frame of image is set (the dividing method is equal ratio division), wherein N can be, but is not limited to, a positive integer less than height/16.
Step 203, when the coding indication information indicates that the image to be coded needs to be coded by a video access point, configuring a type of a target slice in the image to be coded as an I type, configuring slices other than the target slice as a P type, wherein the target slice is any target number of slices in the image to be coded, and the target number is an integer smaller than the first number.
In some embodiments, when the encoding indication information indicates that the image to be encoded needs to be encoded by using the video access point, the image to be encoded is divided into a first number of slices, the type of a target slice in the image to be encoded is configured as an I type, and the slices except for the target slice are configured as a P type, so that the number of slices of the I type in the image to be encoded is reduced when the image to be encoded is encoded by using the video access point, and the data size of the image to be encoded is not excessively large.
The number of the target slices can be one or a plurality of target slices, and when the number of the target slices is a plurality of target slices, the positions of the target slices in the image to be coded are different.
And 204, determining the type of each slice in the image to be encoded and the position of each slice in the image to be encoded as the encoding information of the image to be encoded, and encoding based on the encoding information.
In some embodiments, after the configuration of the type of each slice in the image to be encoded is completed, determining the position of each slice in the image to be encoded and the type of the slice as encoding information, and encoding based on the encoding information.
The coding information may be coded in various ways, and any coding algorithm in the related art may be used, for example, predictive coding, transform coding, entropy coding, and motion compensation.
The encoding steps 201 to 204 are repeatedly performed.
Step 205, determining that video access point encoding is completed after the number of target slices reaches the first number, where the positions of the target slices in the images to be encoded after video access point encoding is completed are different.
In some embodiments, after the number of target slices reaches the first number, the video access point encoding is completed, that is, the plurality of i_slices divided by the video random access point are configured into a plurality of images to be encoded. Since the positions of the plurality of i_slices obtained by dividing the video random access point are different, the positions of the target slices configured in the image to be encoded are also different.
In this embodiment, a video random access point is divided into a plurality of i_slices, and the i_slices are allocated to positions of different slices of several consecutive frames of images to be encoded for encoding, so that the data size of each frame is not excessively large, thereby achieving the purpose of code rate smoothing. Also, each frame image for the video random access point may still contain p_slice, so higher image quality and compression rate may still be obtained. Each frame of image for the video random access point still complies with the video codec standard such as h.264 and is therefore standard compatible.
In an optional embodiment, before the encoding indication information indicates that the image to be encoded needs video access point encoding, the method further includes:
judging whether the coding indication information indicates that video access point coding is needed to be carried out from the current image to be coded or not; if yes, configuring a second number of pieces of the residual I type in the coding indication information, wherein the initial value of the second number is the first number; if not, judging whether the second number of the remaining I-type slices in the coding indication information is zero, if the second number is zero, indicating that the I-type slices are configured completely, configuring all the slices in the image to be coded as P-type, and if the second number is not zero, configuring the I-type slices in the image to be coded;
after obtaining the coding information of the image to be coded each time, the method further comprises the following steps:
updating the second number to the second number minus one to determine a number of unconfigured type I slices.
In some embodiments, the second number is set, the number of slices of the type I is monitored based on the second number, and after each time the image to be encoded is configured to be a slice of the type I, the second number is updated, so that whether the configuration of the slice of the type I is completed can be monitored, and further, after the second number is zero, it can be determined that the encoding of the video access point is completed.
In an alternative embodiment, the coding indication information indicates that the image to be coded needs video access point coding, including:
and the second quantity in the coding indication information is not 0, and the image to be coded is determined to need to be coded by a video access point.
In some embodiments, adding a second number to the coding indication information, judging whether the acquired image to be coded needs to be coded by a video access point based on the second number, and determining that the image to be coded needs to be coded by the video access point when the second number is not 0, and configuring a type I slice in the image to be coded; when the second number is 0, it is determined that video access point encoding has been completed, and all slices in subsequent images to be encoded are configured as P-type.
In an alternative embodiment, the configuring the type of the target slice in the image to be encoded as the I type includes:
determining the position of the first quantity minus the second quantity in the image to be coded as the target slice; the type of the target tile is configured as type I.
Illustratively, when the image to be encoded is a first video access point image, a first slice of the image to be encoded is set to type I.
In an alternative embodiment, before the encoding based on the encoding information, the method further includes:
when the I-type slice is included in the image to be encoded, determining a motion vector range of a target P-type slice in the image to be encoded, wherein the motion vector range comprises the position of the target P-type slice in the previous image to be encoded and the I-type slice in the previous image to be encoded, and the target P-type slice is a P-type slice above the I-type slice; and determining the motion vector range of the slice as the coding information.
In some embodiments, by setting the running vector range of the target P-type slice, the situation that the target P-type slice in the image to be encoded searches all slices in the previous image to be encoded is avoided. Since the I-type slice in the image to be encoded does not need to refer to the previous frame image, the P-type slice needs to refer to the previous frame image, so that the part in the previous image to be encoded is searched, namely, the position of the target P-type slice in the previous image to be encoded and the I-type slice in the previous image to be encoded are subjected to motion search, the difference information between the target P-type slice and the current image to be encoded can be determined, the motion search range can be reduced, and the calculation amount in the decoding process is reduced.
In an alternative embodiment, the video encoding method of the present application further includes:
and when the coding indication information indicates that the image to be coded does not need to be coded by a video access point, configuring the types of all the slices in the image to be coded as P types.
In some embodiments, after all the slices of the type I are configured to the images to be encoded in consecutive frames, it may be determined that the subsequently acquired images to be encoded no longer need to be encoded by the video access point, and all the slices of the type I are configured to be of type P, so that the image quality and the compression rate of the subsequently encoded images to be identified can be ensured.
In an optional embodiment, after the configuring the types of all slices in the image to be encoded to be P-type, the method further includes:
counting the configured third number of the images to be encoded; and ending the coding when the third number reaches the number of the preset coded images.
In some embodiments, when the encoding system is initialized, the number of images to be encoded, that is, the number of preset encoded images, is further configured, and after the third number of configured images to be encoded reaches the number of preset encoded images, it is indicated that all video frames of the video encoding are encoded, so as to determine that the video encoding is finished.
In a specific embodiment, a video encoding method of the present application specifically includes the following steps:
the first step: initializing the coding system. The wide and high pixels of each frame of image are set to width and height, respectively. The number N of the Slice to be divided (the dividing mode is equal proportion division) of each frame of image is set, and N is a positive integer smaller than height/16. An index i for indicating the encoded image is set, and an initial value of i is set to 0. The variable configured pieces are set to the number of I types (RemainingIntraSliceNum), and the initial value of RemainingIntraSliceNum is set to 0. The number of pictures to be encoded, i.e., the preset number of encoded pictures (TotalFrameNum) is set.
And a second step of: the image frame i to be encoded is read, and a boolean-type parameter idr_flag (i.e. the above-mentioned encoding indication information) indicating whether or not this frame image (i.e. frame i) is encoded as a random access point.
And a third step of: if idr_flag is False (indicating that it is not necessary to code a random access point from the current frame), this indicates that it is not necessary to start a new random access point code, and therefore the process jumps to step five.
Fourth step: if idr_flag is turn (indicating that the random access point needs to be encoded from the current frame), remainingintslicenum=n is set, and encoding of one random access point is started.
Fifth step: judging whether the RemainingIntraSliceNum is 0 or not, if the RemainingIntraSliceNum is not 0 (in the process of judging whether a random access point is being coded currently or not), setting the type of N-RemainingIntraSliceNum slicenum slicems of the current image as I_Slices, setting the types of other slicems as P_Slices, and then updating the remainingIntrasliceNum to be the remainingIntrasliceNum-1; otherwise, all the Slice types are set as P_slice.
Sixth step: if there is an i_slice set in the fifth step in the current frame [ I ] of the image to be encoded (illustrating the process of encoding the random access point currently), the motion vector search range of all p_slices located above the i_slice is limited to be located only above the corresponding position of the i_slice in the reference image, and the motion vector range of the remaining slices is not limited (as shown in fig. 3, fig. 3 assumes that N set in the first step is equal to 4). Otherwise, not limiting the range of motion vectors of all slices.
Seventh step: and (3) coding according to the coding parameters set in the first step to the sixth step, and then outputting the compressed code stream after the current image coding.
Eighth step: updating i to i+1, ending the encoding if i is equal to TotalFrameNum (indicating that all frames of the video have been encoded), otherwise proceeding to the second step to continue encoding the next frame of image.
In this embodiment, a video random access point is divided into a plurality of i_slices, and the i_slices are allocated to different positions of consecutive frames of images to be encoded, so that the data size of each frame is not excessively large, thereby achieving the purpose of code rate smoothing. Each frame image for the video random access point can still contain p_slice and thus higher image quality and compression rate can still be obtained. Each frame of image for the video random access point still complies with the video codec standard such as h.264 and is therefore standard compatible. The new video random access point coding algorithm does not introduce additional computational complexity.
The video coding method can solve the problems of smooth code rate and unavailable image quality in the related art when the random access point is coded. No additional performance overhead is introduced for video coding when coding random access points. The encoded random access point is compatible with the standard protocol of video encoding, and the open source software of H.264 such as the well-known FFmpeg and JM can be resolved.
Based on the same concept, the embodiment of the present application provides a video encoding device, and the specific implementation of the device may be referred to the description of the embodiment of the method, and the repetition is omitted, as shown in fig. 4, where the device mainly includes:
the obtaining module 401 is configured to perform the following encoding steps: acquiring an image to be encoded and encoding indication information of the image to be encoded;
a slicing module 402, configured to divide the image to be encoded into a first number of slices, where the first number is a positive integer greater than 2;
a configuration module 403, configured to configure a type of a target slice in the image to be encoded as an I type, configure slices other than the target slice as a P type, where the target slice is any target number of slices in the image to be encoded, and the target number is an integer less than the first number, when the encoding indication information indicates that the image to be encoded needs video access point encoding;
a first determining module 404, configured to determine a type of each slice in the image to be encoded and a position of each slice in the image to be encoded as encoding information of the image to be encoded, and encode based on the encoding information;
and a second determining module 405, configured to repeatedly perform the encoding step, and determine video access point encoding after the number of target slices reaches the first number, where the positions of the target slices in the to-be-encoded images after video encoding are different.
Based on the same conception, the embodiment of the application also provides an electronic device, as shown in fig. 5, which mainly includes: processor 501, memory 502 and communication bus 503, wherein processor 501 and memory 502 accomplish the communication between each other through communication bus 503. The memory 502 stores a program executable by the processor 501, and the processor 501 executes the program stored in the memory 502 to implement the following steps:
the following encoding steps are performed: acquiring an image to be encoded and encoding indication information of the image to be encoded;
dividing the image to be encoded into a first number of slices, the first number being a positive integer greater than 2;
when the coding indication information indicates that the image to be coded needs to be coded by a video access point, configuring the type of a target slice in the image to be coded as an I type, configuring slices except the target slice as a P type, wherein the target slice is any target number of slices in the image to be coded, and the target number is an integer smaller than the first number;
determining the type of each slice in the image to be encoded and the position of each slice in the image to be encoded as the encoding information of the image to be encoded, and encoding based on the encoding information;
and repeatedly executing the coding step, and determining video access point coding after the number of the target slices reaches the first number, wherein the positions of the target slices in the to-be-coded images subjected to video coding are different.
The communication bus 503 mentioned in the above electronic device may be a peripheral component interconnect standard (Peripheral Component Interconnect, abbreviated to PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated to EISA) bus, or the like. The communication bus 503 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 5, but not only one bus or one type of bus.
The memory 502 may include random access memory (Random Access Memory, simply RAM) or may include non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor 501.
The processor 501 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), a digital signal processor (Digital Signal Processing, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a Field programmable gate array (Field-Programmable Gate Array, FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
In yet another embodiment of the present application, there is also provided a computer-readable storage medium having stored therein a computer program which, when run on a computer, causes the computer to perform the video encoding method described in the above embodiments.
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 the computer instructions are loaded and executed on a computer, the processes or functions described in accordance with the embodiments of the present application are produced 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 a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, by a wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, microwave, etc.) means from one website, computer, server, or data center to another. 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, etc.), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk), etc.
It should be noted that in this document, 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.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
1. A video encoding method, comprising:
the following encoding steps are performed: acquiring an image to be encoded and encoding indication information of the image to be encoded;
dividing the image to be encoded into a first number of slices, the first number being a positive integer greater than 2;
when the coding indication information indicates that the image to be coded needs to be coded by a video access point, configuring the type of a target slice in the image to be coded as an I type, configuring slices except the target slice as a P type, wherein the target slice is any target number of slices in the image to be coded, and the target number is an integer smaller than the first number;
determining the type of each slice in the image to be encoded and the position of each slice in the image to be encoded as the encoding information of the image to be encoded, and encoding based on the encoding information;
and repeatedly executing the coding step, and determining that the video access point coding is finished after the number of the target slices reaches the first number, wherein the positions of the target slices in the to-be-coded images subjected to video access point coding are different.
2. The video coding method according to claim 1, further comprising, before the coding indication information indicates that the image to be coded requires video access point coding:
judging whether the coding indication information indicates that video access point coding is needed to be carried out from the current image to be coded or not;
if yes, configuring a second number of pieces of the residual I type in the coding indication information, wherein the initial value of the second number is the first number;
after obtaining the coding information of the image to be coded each time, the method further comprises the following steps:
updating the second number to the second number minus one.
3. The video coding method according to claim 2, wherein the coding indication information indicates that the image to be coded requires video access point coding, comprising:
and the second quantity in the coding indication information is not 0, and the image to be coded is determined to need to be coded by a video access point.
4. The video coding method according to claim 2, wherein said configuring the type of the target slice in the image to be coded as I-type comprises:
determining the position of the first quantity minus the second quantity in the image to be coded as the target slice;
the type of the target tile is configured as type I.
5. The video coding method according to claim 4, wherein before the coding based on the coding information, further comprising:
when the I-type slice is included in the image to be encoded, determining a motion vector range of a target P-type slice in the image to be encoded, wherein the motion vector range comprises the position of the target P-type slice in the previous image to be encoded and the I-type slice in the previous image to be encoded, and the target P-type slice is a P-type slice above the I-type slice;
and determining the motion vector range of the slice as the coding information.
6. The video coding method of claim 1, further comprising:
and when the coding indication information indicates that the image to be coded does not need to be coded by a video access point, configuring the types of all the slices in the image to be coded as P types.
7. The video coding method according to claim 6, wherein after said configuring the types of all slices in the image to be coded as P-types, further comprising:
counting the configured third number of the images to be encoded;
and ending the coding when the third number reaches the number of the preset coded images.
8. A video encoding apparatus, comprising:
the acquisition module is used for executing the following coding steps: acquiring an image to be encoded and encoding indication information of the image to be encoded;
a slicing module, configured to divide the image to be encoded into a first number of slices, where the first number is a positive integer greater than 2;
a configuration module, configured to configure a type of a target slice in the image to be encoded as an I type, configure slices other than the target slice as a P type, where the target slice is any target number of slices in the image to be encoded, and the target number is an integer smaller than the first number, when the encoding indication information indicates that the image to be encoded needs video access point encoding;
the first determining module is used for determining the type of each slice in the image to be encoded and the position of each slice in the image to be encoded as the encoding information of the image to be encoded, and encoding based on the encoding information;
and the second determining module is used for repeatedly executing the encoding step, and determining video access point encoding after the number of the target slices reaches the first number, wherein the positions of the target slices in the images to be encoded after the video encoding is completed are different.
9. An electronic device, comprising: the device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to execute a program stored in the memory to implement the video encoding method of any one of claims 1 to 7.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the video encoding method of any one of claims 1-7.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210805167.XA CN117412053A (en) | 2022-07-08 | 2022-07-08 | Video encoding method, video encoding device, electronic equipment and storage medium |
PCT/CN2023/098575 WO2024007802A1 (en) | 2022-07-08 | 2023-06-06 | Video encoding method and apparatus, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210805167.XA CN117412053A (en) | 2022-07-08 | 2022-07-08 | Video encoding method, video encoding device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117412053A true CN117412053A (en) | 2024-01-16 |
Family
ID=89454161
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210805167.XA Pending CN117412053A (en) | 2022-07-08 | 2022-07-08 | Video encoding method, video encoding device, electronic equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN117412053A (en) |
WO (1) | WO2024007802A1 (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105163117B (en) * | 2015-08-26 | 2019-08-16 | 华为技术有限公司 | A kind of image encoding method and device |
US20190104321A1 (en) * | 2017-09-29 | 2019-04-04 | Ati Technologies Ulc | Method and apparatus for encoding video using intra refresh video encoding |
CN114630122B (en) * | 2021-03-19 | 2023-04-28 | 杭州海康威视数字技术股份有限公司 | Decoding and encoding method based on self-adaptive intra-frame refreshing mechanism and related equipment |
CN112929667B (en) * | 2021-03-26 | 2023-04-28 | 咪咕文化科技有限公司 | Encoding and decoding method, device, equipment and readable storage medium |
-
2022
- 2022-07-08 CN CN202210805167.XA patent/CN117412053A/en active Pending
-
2023
- 2023-06-06 WO PCT/CN2023/098575 patent/WO2024007802A1/en unknown
Also Published As
Publication number | Publication date |
---|---|
WO2024007802A1 (en) | 2024-01-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11451787B2 (en) | Method and apparatus for video encoding and decoding | |
US12041264B2 (en) | Method and apparatus for video encoding and decoding | |
US11412229B2 (en) | Method and apparatus for video encoding and decoding | |
US11196989B2 (en) | Video encoding method, device and storage medium using resolution information | |
US11558639B2 (en) | Selective resolution video encoding method, computer device, and readable storage medium | |
US11206405B2 (en) | Video encoding method and apparatus, video decoding method and apparatus, computer device, and storage medium | |
US11563974B2 (en) | Method and apparatus for video decoding | |
US20180332298A1 (en) | Bidirectional Prediction In Video Compression | |
US9414086B2 (en) | Partial frame utilization in video codecs | |
US20180035123A1 (en) | Encoding and Decoding of Inter Pictures in a Video | |
US11330254B2 (en) | Video encoding method and apparatus, video decoding method and apparatus, computer device, and storage medium | |
US20220279172A1 (en) | Image encoding/decoding method and device for determining division mode on basis of color format, and method for transmitting bitstream | |
US20210329252A1 (en) | Motion information acquisition method and device for video encoding or decoding | |
US12034950B2 (en) | Video decoding method and apparatus, video encoding method and apparatus, device, and storage medium | |
EP4024872A1 (en) | Video coding method and apparatus, video decoding method and apparatus, electronic device, and storage medium | |
WO2020042191A1 (en) | Encoding method, decoding method, encoding apparatus, and decoding apparatus | |
US20200145653A1 (en) | Decoding method and apparatus based on template matching | |
CN111629206A (en) | Video encoding method, video playing method, related device and medium | |
CN116567228A (en) | Encoding method, real-time communication method, apparatus, device and storage medium | |
CN111372088B (en) | Video coding method, video coding device, video coder and storage device | |
CN117412053A (en) | Video encoding method, video encoding device, electronic equipment and storage medium | |
CN113632494B (en) | Transform unit partitioning method for video coding | |
CN117041597B (en) | Video encoding and decoding methods and devices, electronic equipment and storage medium | |
US20230080747A1 (en) | Modifying a set of angle prediction modes for coding an equirectangular projection format image | |
US20230049298A1 (en) | Image encoding/decoding method and apparatus for performing prediction on basis of reconfigured prediction mode type of leaf node, and bitstream transmission method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication |