WO2019080136A1 - Video encoding and decoding method and device - Google Patents
Video encoding and decoding method and deviceInfo
- Publication number
- WO2019080136A1 WO2019080136A1 PCT/CN2017/108159 CN2017108159W WO2019080136A1 WO 2019080136 A1 WO2019080136 A1 WO 2019080136A1 CN 2017108159 W CN2017108159 W CN 2017108159W WO 2019080136 A1 WO2019080136 A1 WO 2019080136A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- video
- code stream
- stream data
- image
- segments
- Prior art date
Links
Images
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/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/174—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 slice, e.g. a line of blocks or a group of blocks
-
- 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
- H04N19/436—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 using parallelised computational arrangements
Definitions
- the present application relates to the field of video coding and decoding, and in particular, to a video coding and decoding method and device.
- the prior art specifically divides each frame of the source video into blocks, obtains multiple image blocks, and then simultaneously encodes and decodes multiple image blocks in one frame of image.
- the data amount of one frame of image is large, the video encoding and decoding efficiency is low, and the applicability is poor.
- the embodiment of the invention discloses a video encoding and decoding method and device, which improves the efficiency of video encoding and decoding and has wide applicability.
- an embodiment of the present invention provides a video encoding method, including:
- the video encoding device divides the source video into M first video segments, each of the M first video segments is composed of N frames of the first image, and the N frames of the first image are consecutive frame images. , wherein M and N are integers greater than one;
- the video encoding device divides each of the M first video segments into T second video segments to obtain M*T second video segments, where any of the second videos
- the segment includes an N-frame second image, the resolution of the second image is less than a resolution of the first image, and the T is an integer greater than one;
- the video encoding device performs parallel encoding on the T second video segments in each of the M first video segments to obtain M*T second code stream data;
- the video encoding device integrates the M*T second code stream data to obtain a code stream of the source video.
- the video encoding device divides each of the M first video segments into T second video segments, including:
- the video encoding device performs the following operations on the first video segment i of the M first video segments:
- the first video segment i is any one of the M first video segments.
- the video encoding device performs parallel encoding on the T second video segments in each of the M first video segments, including:
- the video encoding device performs the following operations on the first video segment i:
- the method before the video encoding device performs parallel encoding on the T second video segments in each of the M first video segments, the method further includes:
- the video encoding device generates a sequence header of a code stream of the source video according to the encoding configuration information.
- the video encoding device integrates the M*T code stream data to obtain a code stream of the source video, including:
- the video encoding device integrates T second code stream data of each of the M first video segments to obtain M first code stream data, where a first video segment is Integrating T pieces of second stream data to obtain a first stream data;
- the video encoding device integrates the sequence header, the M first code stream data, and a sequence termination code into a code stream of the source video.
- any second code stream data includes a set of image headers and a set of image data, and the video encoding device will each of the first of the M first video segments
- the T second code stream data of the segment is integrated to obtain M first code stream data, including:
- the video encoding device performs the following operations on the first video segment i:
- each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;
- the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data
- the image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes
- the T second video segments corresponding to the stream data belong to the same first video segment.
- the method further includes:
- the video encoding apparatus adds, in the sequence header, a first syntax element for indicating the preset resolution and a number of frames N for indicating the first image included in the first video segment. Two syntax elements.
- an embodiment of the present invention further provides a video decoding method, including:
- the video decoding device acquires code stream data of the source video from a code stream of the source video, where the code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code;
- the video decoding device divides the code stream data of the source video into M first code stream data, and the Each first code stream data of the M first code stream data is expanded into T second code stream data to obtain M*T second code stream data;
- the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data to obtain M*T second video segments;
- the video decoding device splices the M*T second video segments to obtain the source video.
- the method before the video decoding device divides the code stream data of the source video into M pieces of the first code stream data, the method further includes:
- the video decoding device acquires a sequence header from a code stream of the source video
- the video decoding device acquires the number T of the first code stream data that can be expanded into the second code stream data according to the resolution of the source video and the preset resolution indicated by the first syntax element in the sequence header.
- each of the first code stream data includes a set of image headers and T sets of image data
- each of the first streams of the M first code stream data The data is expanded into T second stream data, including:
- the video decoding device copies a set of image headers of the first code stream data i of the M first code stream data to obtain a T group image header;
- the video decoding device expands to obtain T second data code streams according to the T group image header and the T group image data of the first code stream data i;
- the video decoding device acquires T second code stream data corresponding to each first code stream data of the M first code stream data to obtain M*T second code stream data;
- the second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
- the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data, including:
- the video encoding device performs the following operations on the first code stream data i of the M first code stream data:
- T second Video clip Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip
- the first code stream data i is any one of the M first code stream data.
- the method before the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first code stream data, the method also includes:
- the video decoding device culls the first syntax element and the second syntax element in the sequence header, and the second syntax element is used to indicate a frame number N of a second image included in the second video segment.
- any second video segment includes an N-frame second image
- the video decoding device splices the M*T second video segments to obtain the source video, including:
- the video decoding device in the second image of the N*T frames in the T second video segments corresponding to each of the M first stream data, each T frame of the same image header
- the second images are stitched together to obtain M first video segments, each of the first video segments includes an N-frame first image, and the resolution of the first image is greater than the first image The resolution of the two images;
- the video decoding device splices the M first video segments to obtain the source video.
- an embodiment of the present invention provides a video encoding device, including:
- a first dividing unit configured to divide the source video into M first video segments, each of the M first video segments being composed of N frames of the first image, the N frames of the first image For consecutive frame images, the M and N are integers greater than one;
- a second dividing unit configured to divide each of the M first video segments into T second video segments to obtain M*T second video segments, where any of the foregoing
- the second video segment includes an N-frame second image, the resolution of the second image is less than a resolution of the first image, and the T is an integer greater than one;
- a coding unit configured to perform parallel coding on the T second video segments in each of the M first video segments to obtain M*T second code stream data
- an integration unit configured to integrate the M*T second code stream data to obtain a code stream of the source video.
- the second dividing unit is specifically configured to:
- the first video segment i is any one of the M first video segments.
- the coding unit is specifically configured to:
- the video encoding device further includes:
- a generating unit configured to generate a sequence header of the source video code stream according to the encoding configuration information, before performing parallel encoding on the T second video segments in each of the M first video segments .
- the integration unit comprises:
- a first integration subunit configured to integrate T second code stream data of each of the M first video segments to obtain M first code stream data, where Integrating T pieces of second stream data of the video segment to obtain a first stream data
- a second integration subunit configured to integrate the sequence header, the M first code stream data, and the sequence termination code into a code stream of the source video.
- any of the second code stream data includes a set of image headers and a set of image data
- the first integration unit is specifically configured to:
- each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;
- the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data
- the image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes
- the T second video segments corresponding to the stream data belong to the same first video segment.
- the video encoding device further includes:
- Adding a unit after generating a sequence header of the source video code stream according to the encoding configuration information, adding a first syntax element for indicating the preset resolution and indicating the location in the sequence header a second syntax element of the number N of frames of the first image included in the first video segment.
- an embodiment of the present invention provides:
- a first acquiring unit configured to acquire code stream data of the source video from a code stream of the source video, where the code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code;
- a dividing unit configured to divide the code stream data of the source video into M first code stream data, and expand each first code stream data of the M first code stream data into T second Code stream data to obtain M*T second code stream data;
- a decoding unit configured to perform parallel decoding on the T second code stream data corresponding to each of the M first code stream data to obtain M*T second video segments;
- an integration unit configured to integrate the M*T second video segments to obtain the source video.
- the video decoding device further includes:
- a second acquiring unit configured to acquire a sequence header in a code stream of the source video before the code stream data of the source video is equally divided into M first code stream data
- a third acquiring unit configured to acquire, according to a resolution of the source video and a preset resolution indicated by the first syntax element in the sequence header, the number of the first code stream data that can be expanded into the second code stream data T.
- each of the first code stream data includes a set of image headers and T sets of image data
- the dividing unit comprises:
- a copying subunit configured to copy a set of image headers of the first code stream data i of the M first code stream data to obtain a T group image header
- An extension subunit configured to expand, according to the T group image header and the T group image data of the first code stream data i, to obtain T second data code streams;
- a first acquiring sub-unit configured to acquire T second code stream data corresponding to each first code stream data of the M first code stream data, to obtain M*T second code stream data
- the second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
- the decoding unit is specifically configured to:
- T second Video clip Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip
- the first code stream data i is any one of the M first code stream data.
- the video decoding device further includes:
- a culling unit configured to cull the first one of the sequence headers before performing parallel decoding on the T second code stream data corresponding to each of the M first code stream data
- a second syntax element the second syntax element is used to indicate the number N of frames of the second image included in the second video segment.
- any second video segment includes an N-frame second image
- the splicing unit includes:
- a first splicing subunit configured to: in the second image of the N*T frames in the T second video segments corresponding to each of the M first code stream data, the image header is the same
- the second image is spliced together every T frame to obtain M first video segments, each of the M first video segments includes an N frame first image, and the resolution of the first image is greater than The resolution of the second image;
- a second splicing subunit configured to splicing the M first video segments to obtain the source video.
- an embodiment of the present invention provides a video encoding device, including:
- a processor coupled to the
- the processor invokes the executable program code stored in the memory to perform some or all of the steps as described in the first aspect of the embodiments of the present invention.
- an embodiment of the present invention provides a video decoding device, including:
- a processor coupled to the
- the processor invokes the executable program code stored in the memory to perform some or all of the steps as described in the second aspect of the embodiments of the present invention.
- the video encoding device divides the source video into M first video segments, and then divides each of the M first video segments into T first segments. Two video clips.
- the video encoding device performs parallel encoding on the T second video segments of each of the first video segments to obtain M*T second code stream data; and the video encoding device integrates the M*T second code streams data.
- the M first stream data is then integrated into the sequence of the source video, the M first stream data, and the sequence termination code into a stream of the source video.
- the video decoding device divides the code stream data of the source video into M first code stream data, and then expands each first code stream data of the M first code stream data into T second code stream data.
- the video decoding device performs parallel decoding on the T second code stream data of each of the first code stream data to obtain M*T second video segments, and then splices the M*T second video segments to obtain a source video.
- the present invention performs parallel encoding and decoding on multiple sub-video segments of a video segment, which improves the efficiency of video encoding and decoding; and after decoding multiple sub-videos of the video segment, the video can be directly displayed. Fragments that improve the user experience.
- FIG. 1 is a schematic diagram of a frame of a video codec according to an embodiment of the present invention
- FIG. 2 is a schematic flowchart of a video encoding method according to an embodiment of the present invention
- FIG. 3 is a schematic diagram of a first image division of a frame
- FIG. 4 is a schematic diagram of a format of a first code stream data corresponding to a first video segment according to an embodiment of the present disclosure
- FIG. 5 is a schematic diagram of a format of another first stream data corresponding to a first video segment according to an embodiment of the present disclosure
- FIG. 6 is a schematic flowchart diagram of a video encoding and decoding method according to an embodiment of the present disclosure
- FIG. 7 is a schematic diagram of another first frame division of one frame
- FIG. 8 is a schematic flowchart of a video encoding and decoding method according to an embodiment of the present disclosure
- FIG. 9 is a schematic structural diagram of a video encoding apparatus according to an embodiment of the present disclosure.
- FIG. 10 is a schematic structural diagram of a part of a video encoding apparatus according to an embodiment of the present disclosure.
- FIG. 11 is a schematic structural diagram of a video decoding device according to an embodiment of the present disclosure.
- FIG. 12 is a schematic structural diagram of a partial structure of a video decoding device according to an embodiment of the present disclosure.
- FIG. 13 is a schematic structural diagram of another video decoding device according to an embodiment of the present disclosure.
- FIG. 14 is a schematic structural diagram of another video encoding apparatus according to an embodiment of the present disclosure.
- FIG. 15 is a schematic structural diagram of another video decoding device according to an embodiment of the present invention.
- FIG. 1 is a schematic diagram of a frame of a video codec according to an embodiment of the present invention.
- the video codec architecture includes a video encoding device 101 and a video decoding device 102.
- the video encoding device 101 After acquiring the source video, the video encoding device 101 encodes the source video to obtain a code stream of the source video.
- the video encoding device 101 transmits the code stream of the source video to the video decoding device 102, and the video decoding device 102 decodes the code stream of the source video to obtain a source video, and outputs the source video.
- the above video encoding device and video decoding device may be integrated in the same device, and may be integrated into two different devices.
- the above two different devices can be produced by different manufacturers, or can be produced by the same manufacturer.
- FIG. 2 is a schematic flowchart diagram of a video encoding method according to an embodiment of the present invention. As shown in Figure 2, the method includes:
- the video encoding device divides the source video into M first video segments.
- Each of the M first video segments is composed of N frames of the first image, and the N frames of the first image are consecutive frame images, and the M and N are integers greater than 1.
- the above source video is composed of the first image of the M*N frame, and the resolution of the first image of the M*N frame is W*H.
- the resolution of the above source video can be regarded as W*H.
- the video encoding device divides each of the M first video segments into T second video segments to obtain M*T second video segments.
- any of the second video segments comprises an N-frame second image
- the resolution of the second image is less than a resolution of the first image
- the T is an integer greater than 1.
- the video encoding device divides each of the M first video segments into T second video segments, including:
- the video encoding device performs the following operations on the first video segment i of the M first video segments:
- the first video segment i is any one of the M first video segments.
- the video encoding device divides each frame of the first image of the N frames of the first video segment i into a second image of the T frame according to the same division order and preset resolution.
- the above preset resolution is w*h
- the above T ([W/w]+1)*([H/h]+1).
- the video encoding device numbers the second image of the T frame of the first image of each frame of the first video segment i according to the above-mentioned dividing order, so that the first image of each frame of the first image of the N frames of the first video segment i
- the encoding of the second image corresponding to the middle position is the same.
- the video encoding apparatus acquires the second image of the T frame obtained by dividing the first image of each frame of the first frame of the N frames of the first video segment i to obtain the second image of the N*T frame.
- the encoding device combines the second images of the N frames having the same number in the second image of the N*T frame to obtain T second video segments.
- the above W is greater than or equal to the above w
- the above H is greater than or equal to the above h.
- each second video segment of the T second video segments is composed of N frames of second images, and the resolution of the second image is less than or equal to the preset resolution.
- the preset resolution is a multiple of 4.
- the first video segment i includes five frames of the first image, and the resolution of the first image of each frame is 416*240, and the preset resolution is 128*128.
- the video encoding apparatus divides the first image of each frame of the first image with the resolution of 416*240 of the above five frames into 6 frames of the second image according to the preset resolution and the same division order, and the 6 frames
- the second image includes a second image with a resolution of 128*128 for 2 frames, a second image with a resolution of 128*112 for both frames, a second image with a resolution of 128*64 for 1 frame, and a resolution of 112 for 1 frame. *64 second image. Referring to FIG. 3, FIG. 3, FIG.
- FIG. 3 is a schematic diagram of a first image division of a frame.
- the video encoding apparatus divides a frame of the first image into a 6-frame second image from left to right and from top to bottom according to a preset resolution, and follows from left to right.
- the numbers are sequentially numbered from top to bottom; as shown in the figure b in FIG. 3, the video encoding device divides the first image of one frame into a second image of 6 frames from right to left and from top to bottom according to a preset resolution. And numbered from right to left and from top to bottom; as shown in c in FIG. 3, the above video encoding device takes a frame of the first image according to a preset resolution, from left to right, from bottom to top.
- the above video encoding device will first frame a frame according to a preset resolution, from the left To the right, the second image is divided into 6 frames from top to bottom, and is numbered sequentially from right to left and from bottom to top.
- the order of division shown in the a diagram, the b diagram, the c diagram and the d diagram in FIG. 3 is from left to right, from top to bottom; from right to left, from top to bottom; from left to right, From bottom to top; from left to right, from top to bottom.
- the above encoding apparatus may divide the first image of each frame of the above five frames of the first image into six frames of the second image according to the method shown in FIG. 3, and divide the first image of each frame into six according to the method shown in FIG.
- the second image of the frame is numbered to obtain 30 frames of the second image.
- the video encoding device combines the images of every 5 frames of the same number in the 30 frames of the second image to obtain 6 second video segments.
- the above six second video segments include two video segments with a resolution of 128*128, two video segments with a resolution of 128*112, one video segment with a resolution of 128*64, and one resolution of 112. *64 video clips.
- the video encoding device obtains T second video segments corresponding to each of the M first video segments according to the foregoing method, to obtain M*T second video segments.
- the video encoding device performs parallel coding on the T second video segments in each of the M first video segments to obtain M*T second code stream data.
- the method further includes:
- the video encoding device generates a sequence header of the source video code stream according to the encoding configuration information.
- the foregoing coding configuration information includes a path, a width, a height, a sampling precision, an output stream name, a motion search mode, a motion search range, a maximum number of reference frames, and a quantization parameter of the video sequence to be encoded. And information such as coding tools.
- the video encoding device performs parallel encoding on the T second video segments in each of the M first video segments, including:
- the video encoding device performs the following operations on the first video segment i:
- the video encoding apparatus determines, according to a division order in which the first image of each frame in the first video segment i is divided into the second image of the T frame, the coding priority of the second video segment composed of the second image of the N frames; The higher the division order of the N frames second image of any second video segment i, the higher the coding priority of the second video segment i.
- the first video segment i described above includes five frames of the first image.
- the video encoding device divides the first image of each frame of the first video segment i into 6 frames of the second image according to the method shown in FIG. 3, and 6 frames corresponding to the first image of each frame of the first video segment i
- the second image is numbered.
- the above video encoding apparatus combines five frames of images of the same number to obtain six second video segments.
- the encoding has the lowest priority.
- the video encoding device acquires the coding priority corresponding to the T second video segments of the first video segment i.
- the video encoding device After acquiring the coding priority corresponding to the T second video segments of the first video segment i, the video encoding device according to the coding priority corresponding to the T second video segments of the first video segment i Parallel encoding of T second video segments of the first video segment.
- the video segment encoding apparatus includes S sub-video segment encoding modules, and S is an integer greater than 1.
- S is greater than T, that is, the number S of the sub video coding modules is greater than the number T of the second video segments included in the first video segment i
- any T sub video coding devices in the S sub video coding modules are The T second video segments are coded in parallel to obtain T second code stream data without encoding according to the coding priorities of the T second video segments to obtain T second code stream data.
- the S is smaller than the T, that is, the number S of the sub video encoding modules of the video encoding device is smaller than the number T of the second video segments included in the first video segment i
- the S sub video encoding modules firstly parallel the video segments.
- the S second video segments with higher priority are encoded for parallel encoding.
- the sub-video encoding module encodes a second video with a higher priority among the sub-video segments that are not encoded in the T sub-video segments.
- the fragment is encoded.
- the S sub-video encoding devices complete encoding the first video segment i to obtain T second code stream data.
- the video encoding device encodes the T sub-video segments by using a preset encoding mode.
- the foregoing preset coding mode may be an All Intra (AI) mode, a Low Delay (LD) mode, a Random Access (RA) mode, or another coding mode.
- AI All Intra
- LD Low Delay
- RA Random Access
- the S sub-video encoding modules of the video encoding device may be S computers in a computer group; may also be S-core processors in a multi-core processor; or may be S threads in multiple threads; Any combination of the above computer clusters, multi-core processors, multi-threading, and other video encoding hardware modules.
- the video encoding device has six sub video encoding modules, and the video encoding device divides the first video segment i into ten second video segments, which are respectively the second video segments B1, B2, B3, B4, and B5. B6, B7, B8, B9, and B10, and the coding priorities of the 10 second video segments are sequentially lowered.
- the six sub video coding modules first perform parallel coding on the sub video segments B1, B2, B3, B4, B5, and B6, respectively.
- the sub video encoding module After the encoding of a first video segment is performed by any one of the six sub video encoding modules, the sub video encoding module compares the encoding priorities of the second video segments B7, B8, B9, and B10. The high second video segment is encoded. According to the above method, and so on, until the encoding of the above 10 second video segments is completed, to obtain 10 second code stream data.
- the video encoding device acquires second code stream data of T second video segments of each of the M first video segments to obtain M*T second code stream data.
- the video encoding device integrates the M*T second code stream data to obtain a code stream of the source video.
- the second code stream data includes a set of image headers and a set of image data; the video encoding device integrates the M*T code stream data to obtain a code stream of the source video, including :
- the video encoding device integrates T second code stream data of each of the M first video segments to obtain M first code stream data, where a first video segment is Integrating T pieces of second stream data to obtain a first stream data;
- the video encoding device integrates the sequence header, the M first code stream data, and a sequence termination code into the source The stream of video.
- any second code stream data includes a set of image headers and a set of image data
- the video encoding device sets T second of each of the M first video segments
- the code stream data is integrated to obtain M first code stream data, including:
- the video encoding device performs the following operations on the first video segment i:
- each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;
- the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data
- the image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes
- the T second video segments corresponding to the stream data belong to the same first video segment.
- the above set of image headers includes N image headers, and the set of image data includes N image data.
- the format of the first code stream data corresponding to the first video segment j may be:
- H 1 , H 2 , . . . , H N are respectively image headers of the first image of N frames in the first video segment j
- the D k1 D k2 D k3 ... D kT-1 D kT are respectively the first image
- the image data of the second image of the T frame corresponding to the first image of the kth frame in the video segment j, the above D 1k D 2k D 3k ... D N-1k D Nk are respectively the kth second video in the first video segment j Image data corresponding to the N image of the second image of the segment.
- the first video segment has three frames of the first image, respectively labeled 1, 2, and 3, and the first video segment is divided into two second video segments, which are I and II, respectively.
- the video encoding device encodes the first video segment to obtain image data corresponding to three image headers and six second images.
- the video encoding device integrates the image data corresponding to the three image headers and the six second images into one first code stream data.
- the format of the first code stream data is: H1(I1II1)H2(I2II2)H3(I3II3), as shown in FIG.
- the format of the first code stream data may also be: H1H2H3 (I1I2I3) (II1II2II3), as shown in FIG. 5.
- the H1, H2, and H3 are image headers of the first frame of the three frames, and the image data I1 and II1 are image data of two frames of the second image of the first frame of the first video segment, respectively.
- the image data I2 and II2 are image data of two frames of the second image of the first image of the second frame in the first video segment, and the image data I3 and II3 are respectively the first image of the third frame of the first video segment.
- an image header and an image data are obtained; and the video encoding device performs encoding on the second video segment to obtain a group of images.
- the video encoding device Since the image headers of the second image of the T frame belonging to the first image of the same frame are the same, the video encoding device retains only one set of image headers, and the code stream data corresponding to the first video segment includes a set of image headers and T Group image data.
- the video encoding device determines, according to the coding priority corresponding to the T second video segments of any of the first video segments i, the second code stream data corresponding to the T second video segments of the first video segment i. Integrating the image data in the order of integration, and integrating the image data in the second code stream data corresponding to the T second video segments of the first video segment i according to the integration sequence, to obtain the corresponding first video segment i Image data of the first code stream data; then, the first code corresponding to the first video segment i of any one of the second code stream data corresponding to the T second video segments of the first video segment The image data of the stream data is integrated to obtain the first stream data of the first video segment i;
- the video encoding device obtains the first code stream data obtained by integrating the second code stream data of each of the first video segments of the M first video segments according to the foregoing method, to obtain M first code stream data.
- the video encoding apparatus integrates the M first code stream data into the code stream data of the source video according to the division order of the M first video segments.
- the video encoding device integrates the code stream data, the sequence header and the sequence termination code of the source video into the code stream of the source video.
- the S1 is a sequence header of the source video
- the S2 is a sequence termination code of the source video
- the H 11 H 12 ... H 1N are respectively N frames in the first first video segment of the source video.
- the image header of the image, the above D m 11 D m 12 ... D m 1N are respectively the image data of the N image of the second image of the first first video segment of the source video, which is numbered m;
- the above H 21 H 22 ... H 2N is an image header of an N-frame first image in the second first video segment of the source video, and the D m 21 D m 22 ... D m 2N are respectively the second first video segment of the source video.
- the image data of the second image of the N frames of the number m; the H n1 H n2 ... H nN are the first image headers of the N frames of the nth video segment of the source video, respectively, the D m n1 D m n2 ... D m nN are respectively image data of an N-frame second image numbered m in the nth video segment of the source video; the above H M1 H M2 ... H MN are respectively the Mth video of the source video first image segment of the first image frame N, the above-described D m M1 D m M2 ...
- the method further includes:
- the video encoding apparatus adds, in the sequence header, a first syntax element for indicating the preset resolution and a number of frames N for indicating the first image included in the first video segment. Two syntax elements.
- the preset resolution is 64*64; when the value indicated by the first syntax element is 1, the preset resolution is 128*. 128; the first syntax element above When the value of the indication is 2, the above preset resolution is 256*256.
- first syntax element and the second syntax element are both bit data.
- the video encoding device divides the source video into M first video segments, and then divides each of the M first video segments into T segments.
- the video encoding device performs parallel encoding on the T second video segments of each of the first video segments to obtain M*T second code stream data; and the video encoding device integrates the M*T second code streams data.
- the M first stream data is then integrated into the sequence of the source video, the M first stream data, and the sequence termination code into a stream of the source video.
- the present invention performs parallel coding on multiple second video segments of one video segment, which improves the efficiency of video coding and improves the user experience.
- FIG. 6 is a schematic flowchart diagram of a video decoding method according to an embodiment of the present invention. As shown in FIG. 6, the method includes:
- the video decoding device acquires code stream data of the source video from a code stream of the source video.
- the code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code.
- the video decoding device divides the code stream data of the source video into M first code stream data, and expands each first code stream data of the M first code stream data into T The second code stream data is obtained to obtain M*T second code stream data.
- the method further includes: before the video decoding device divides the code stream data of the source video into the M first code stream data, the method further includes:
- the video decoding device acquires a sequence header from a code stream of the source video
- the video decoding device acquires the number T of the first code stream data that can be expanded into the second code stream data according to the resolution of the source video and the preset resolution indicated by the first syntax element in the sequence header.
- the resolution of the source video is W*H
- the preset resolution is w*h
- the above first syntax element is a number of bit data.
- Each of the first code stream data includes a set of image headers and T sets of image data, and the first code stream data of the M first code stream data is expanded to T seconds.
- Code stream data including:
- the video decoding device copies a set of image headers of the first code stream data i of the M first code stream data to obtain a T group image header;
- the video decoding device expands to obtain T second data code streams according to the T group image header and the T group image data of the first code stream data i;
- the video decoding device acquires T second code stream data corresponding to each first code stream data of the M first code stream data, to obtain M*T second code stream data,
- the second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
- the video decoding device divides the code stream data of the source video into M first code stream data.
- Each of the M first stream data includes a set of image headers and T sets of image data.
- the decoding device copies a set of image headers in any of the first code stream data i to obtain a T group image header, and then the T group image header and the T group image in the first code stream data i
- the data is expanded to obtain T second code stream data, and each second code stream data includes a set of image headers and a set of image data.
- the video decoding device acquires T second code stream data corresponding to each first code stream data of the M first code stream data to obtain M*T second code stream data.
- the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first code stream data to obtain M*T second video segments.
- the method further includes:
- the video decoding device culls the first syntax element and the second syntax element in the sequence header, and the second syntax element is used to indicate a frame number N of a second image included in the second video segment.
- the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data, including:
- the video encoding device performs the following operations on the first code stream data i of the M first code stream data:
- T second Video clip Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip
- the first code stream data i is any one of the M first code stream data.
- the video decoding device determines the corresponding decoding priority of the T second code stream data corresponding to the first code stream data i
- the video decoding device performs T seconds corresponding to the first code stream data i.
- the corresponding decoding priority of the code stream data performs parallel decoding on the T second code stream data corresponding to the first code stream data i.
- the video decoding device includes S sub-video decoding modules, and S is an integer greater than 0.
- the T sub video decoding devices of the S sub video decoding modules perform parallel decoding on the T second code stream data corresponding to the first video stream data i to obtain T second video segments.
- the S sub-video decoding module first performs parallel decoding on the S second code stream data corresponding to the first video stream data i, and decoding the S second code stream data with higher priority. Parallel decoding.
- the sub-video decoding module After the sub-video decoding module of the S sub-video decoding module completes decoding the second code stream data, the sub-video decoding module performs the second code stream data that is not decoded in the T second code stream data. And decoding a second code stream data with a higher priority for decoding. And so on, after the S sub-video decoding devices complete the T second code stream data corresponding to the first video stream data i, obtain T second video segments.
- the S sub-video decoding modules of the video decoding device may be S computers in a computer group; may also be S-core processors in a multi-core processor; or may be S threads in multiple threads; Any combination of the above computer clusters, multi-core processors, multi-threading, and video decoding hardware modules.
- the video decoding device acquires corresponding T second video segments of each of the M first code stream data to obtain M*T second video segments.
- the video decoding device splices the M*T second video segments to obtain the source video.
- the second video segment includes an N-frame second image
- the video decoding device splices the M*T second video segments to obtain the source video, including:
- the video decoding device in the second image of the N*T frames in the T second video segments corresponding to each of the M first stream data, each T frame of the same image header
- the second images are stitched together to obtain M first video segments, each of the first video segments includes an N-frame first image, and the resolution of the first image is greater than the first image The resolution of the two images;
- the video decoding device splices the M first video segments to obtain the source video.
- any of the second video segments includes an N-frame second image
- the T second video segments corresponding to any of the first code stream data include an N*T frame second image. Since the second image of the T frame belonging to the first image of the same frame has the same image header, the video decoding device splices the second image of the T frame with the same image header in the second image of the N*T frame to obtain a The first video clip.
- the first video segment includes an N frame of the first image, the first image resolution being greater than the resolution of the second image.
- the video decoding device acquires the first video segment obtained by splicing the T video segments corresponding to each of the first code stream data, to obtain M first video segments;
- the decoding device splices the M first video segments together according to the division order of the M first video segments to obtain the source video.
- the video decoding device obtains the code stream data of the source video from the code stream of the source video, and divides the code stream data of the source video into M first code stream data. And then expanding each of the first code stream data of the M first code stream data into T second code stream data.
- the video decoding device performs parallel decoding on the T second code stream data of each of the first code stream data to obtain M*T second video segments. The M*T second video segments are then spliced to obtain the source video.
- the present invention performs parallel decoding on multiple sub-video segments of a video segment, thereby improving the efficiency of video decoding; and after decoding multiple sub-videos of the video segment, the video segment can be directly displayed. Improve the user experience.
- the source video with a resolution of 416*240 includes 20 frames of the first image
- the video encoding device divides the source video into four first video segments, each of which includes 5 frames of the first image, and the 5 frames of the first image are consecutive frame images.
- the video encoding device divides each of the four first video segments into eight second video segments according to a preset resolution of 128*128 to obtain 32 second video segments.
- the video encoding device divides the first image of each frame into 8 frames of the second image. As shown in FIG.
- the video encoding device divides the first image with a resolution of 416*240 into a second image of 8 frames according to a preset resolution of 128*128, and the second image of the 8 frames includes 3 frames.
- the second image is 128*128, the second image with a frame resolution of 128*112, the second image with a frame resolution of 32*128, and the second image with a frame resolution of 32*112.
- the video encoding device numbers the second image of the 8 frames from left to right, and from top to bottom, A, B, C, D, E, F, G, I. For each of the 8 second video segments corresponding to each first video segment, each second video segment includes 5 frames of the second image with the same number.
- the video encoding device Before the parallel coding of the corresponding 8 second video segments of the first video segment, the video encoding device generates a sequence header according to the configuration information.
- any one of the above four first video segments is the first video segment A
- the video encoding device determines the coding priority of the eight second video segments of the first video segment A.
- the coding priority of the eight second video segments in the first video segment A is sequentially lowered from left to right and from top to bottom.
- the above video coding design The eight second videos in the first video segment A are encoded in parallel according to the coding priority. After the encoding is completed, 8 sets of image headers and 8 sets of image data are obtained, each set of image headers including 5 image headers, and each set of image data includes 5 image data.
- the video encoding apparatus Since the 8 frames of the second image belonging to the first image of the same frame have the same image header, the above video encoding apparatus retains only one set of image headers for the above-mentioned 8 sets of image headers.
- the video encoding apparatus integrates the set of image headers and the eight sets of image data into the first stream data of the first video clip A.
- the format of the first code stream data of the first frequency segment A is as follows:
- first code stream data format of the first video segment A is as follows:
- the above H1, H2, H3, H4, and H5 are image headers of the first frame of the five frames in the first video segment A, that is, the group of image headers, and the above-mentioned
- A1, B1, C1, D1, E1, F1, G1, and I1 are respectively corresponding image data of 8 frames of the second image of the first image of the first frame in the first frame of the above 5 frames
- A2, B2, C2, D2, E2, F2, G2, and I2 are respectively Corresponding image data of 8 frames of the second image of the first image of the second frame in the first frame of the 5 frames
- A3, B3, C3, D3, E3, F3, G3, and I3 are respectively in the first image of the above 5 frames.
- the video encoding device After the video encoding device performs encoding on the four first video segments of the source video, four first code stream data corresponding to the four first video segments are obtained.
- the video encoding device integrates the sequence header, the 44 first code stream data and the sequence termination code to obtain a code stream of the source video.
- the video encoding device adds a first syntax element for indicating the preset resolution 128*128 and the use in the sequence header. And a second syntax element indicating a second image frame number N in the second video segment.
- the video decoding device parses the sequence header and the sequence termination code from the code stream of the source video.
- the video decoding device acquires the number T of the second video segments in each of the first video segments according to the resolution 416*240 of the source video and the resolution 128*128 indicated by the first syntax element in the sequence header. .
- the above video decoding device copies the above sequence header to obtain 8 sequence headers.
- the video decoding device changes the resolution indicated by the first syntax element in the eight sequence headers to 128*128, 128*128, 128*128, 32*128, 128*112, 128*112, 128*, respectively. 112 and 112*32.
- the video decoding device divides the code stream data of the source video into four first code stream data according to the coding order, and then expands each first code stream data of the four first code stream data into eight second. Code stream data.
- the video decoding apparatus culls the first syntax element and the second syntax element in the sequence header before performing the decoding operation on the code stream data of the sub video clip.
- the video decoding device performs parallel decoding on the eight second code stream data in the first code stream data in the four first code stream data according to the eight sequence headers, to obtain four second video segment groups, each of which is configured.
- the two video clip groups include eight second video clips.
- the video decoding device splices together the second images of the 8 second video segments of the first video segment group of the four first video segment groups having the same image header to obtain four first video segments. And smoothing the first of the four video segments.
- the video decoding device splices the four first video segments together according to the division order of the first video segment to obtain the source video.
- FIG. 8 is a schematic flowchart diagram of a video encoding and decoding method according to an embodiment of the present invention. As shown in Figure 8, the method includes:
- the video encoding device divides the source video into M first video segments.
- the first video segment of the M first video segments includes an N frame first image, and the N frame first image is a continuous frame image.
- the video encoding device divides each of the M video segments into T second video segments to obtain M*T second video segments.
- the video encoding apparatus divides, according to a preset resolution, a first image of each frame of each of the M video segments into a second image of a T frame, and the second image of the T frame. Numbering to obtain a second image of the N*T frame; the video encoding apparatus combining the second images of each N frame of the same number in the second image of the N*T frame to obtain T second video segments; The video encoding acquires the second video segment obtained by dividing each of the first video segments of the M first video segments to obtain M*T second video segments.
- the second video segment of the M*T second video segment includes an N frame second image, and the resolution of the second image is smaller than the resolution of the first video segment.
- the video encoding device performs parallel coding on the T second video segments of the first video segment A1 to obtain T second code stream data.
- the first video segment A1 is any one of the M first video segments.
- the video encoding device Before the parallel coding of the T second video segments of each of the M video segments, the video encoding device generates a sequence header of the code stream of the source video according to the configuration information; A first syntax element for indicating a preset resolution and a second syntax element for indicating the number N of image subframes in each sub video segment are added to the sequence header.
- the video encoding device sends the sequence header to the video decoding device.
- the video encoding device integrates the T second code stream data corresponding to the first video segment into a first code stream data.
- the video encoding device sends the first code stream data corresponding to the first video segment A1 to the video decoding device.
- the video encoding device After the first code stream data corresponding to the first video segment A1 is sent to the video decoding device, the video encoding device performs parallel encoding on the T second video segments of the first video segment A2.
- the first video segment A1 and the first video segment A2 are adjacent in the dividing order, and the first video segment A1 is before the first video segment A2.
- the encoding device performs an encoding operation on the M first video segments, and transmits the encoded M first code streams to the video decoding device.
- the video decoding device expands the first code stream data corresponding to the first video segment A1 according to the sequence header, to obtain T second code stream data corresponding to the first video segment A1.
- the video decoding device performs parallel decoding on the T second code stream data corresponding to the first video segment A1 to obtain T second video segments.
- the video decoding device concatenates the T second video segments into a first video segment A1.
- the video display device may directly display the first video segment A1.
- the video decoding device After the T second video segments obtained by parallel decoding the T second code stream data corresponding to the first video segment A1 are spliced, the video decoding device corresponds to the T segments of the first video segment A2.
- the second code stream data is decoded in parallel, and so on, until the decoding of the T second code stream data corresponding to each of the first video segments of the M first video segments is completed, to obtain M first video segments.
- FIG. 9 is a schematic structural diagram of a video encoding apparatus according to an embodiment of the present invention. As shown in FIG. 9, the video encoding apparatus 900 includes:
- a first dividing unit 901 configured to divide the source video into M first video segments, where each of the M first video segments is composed of N frames of the first image, and the N frames are first
- the image is a continuous frame image, and both M and N are integers greater than one.
- a second dividing unit 902 configured to divide each of the M first video segments into T second video segments to obtain M*T second video segments, where any of the The second video segment includes an N-frame second image, the resolution of the second image being less than the resolution of the first image, and the T being an integer greater than one.
- the second dividing unit 902 is specifically configured to:
- the first video segment i is any one of the M first video segments.
- the encoding unit 903 is configured to perform parallel encoding on the T second video segments in each of the M first video segments to obtain M*T second code stream data.
- the coding unit 903 is specifically configured to:
- the video encoding device 900 further includes:
- a generating unit 905 configured to generate a sequence of the source video code stream according to the encoding configuration information, before performing parallel encoding on the T second video segments in each of the M first video segments head.
- the integration unit 904 is configured to integrate the M*T second code stream data to obtain a code stream of the source video.
- the second stream data includes a set of image headers and a set of image data; the integration unit 904 includes:
- a first integration sub-unit 9041 configured to integrate T second code stream data of each of the M first video segments to obtain M first code stream data, where Integrating T pieces of second stream data of a video segment to obtain a first stream data;
- the second integration subunit 9042 is configured to integrate the sequence header, the M first code stream data, and the sequence termination code into a code stream of the source video.
- Any one of the second stream data includes a set of image headers and a set of image data
- the first integration unit 9041 is specifically configured to:
- each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;
- the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data
- the image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes
- the T second video segments corresponding to the stream data belong to the same first video segment.
- the video encoding device 900 further includes:
- the adding unit 906 is configured to: after generating a sequence header of the source video code stream according to the encoding configuration information, adding a first syntax element for indicating the preset resolution to the sequence header and indicating the A second syntax element of the number N of frames of the first image included in the first video segment.
- each of the above units (the first dividing unit 901, the second dividing unit 902, the encoding unit 903, the integrating unit 904, the generating unit 905, and the adding unit 906) is used to perform the relevant steps of the above method.
- the video encoding apparatus 900 is presented in the form of a unit.
- a "unit” herein may refer to an application-specific integrated circuit (ASIC), a processor and memory that executes one or more software or firmware programs, integrated logic circuits, and/or other devices that provide the functionality described above.
- ASIC application-specific integrated circuit
- the above first dividing unit 901, second dividing unit 902, encoding unit 903, integrating unit 904, generating unit 905 and adding unit 906 can be realized by the processor 1401 of the video encoding apparatus 1400 shown in FIG.
- FIG. 11 is a schematic structural diagram of a video decoding device according to an embodiment of the present invention. As shown in FIG. 11, the video decoding device 1100 includes:
- a first acquiring unit 1101 configured to acquire code stream data of the source video from a code stream of the source video, where the code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code.
- the dividing unit 1102 is configured to divide the code stream data of the source video into M first code stream data, and expand each first code stream data of the M first code stream data into T pieces. Two streams of data are obtained to obtain M*T second stream data.
- the video decoding device 1100 further includes:
- a second obtaining unit 1105 configured to acquire a sequence header in a code stream of the source video before the code stream data of the source video is equally divided into M first code stream data;
- the third obtaining unit 1106 is configured to obtain, according to the resolution of the source video and the preset resolution indicated by the first syntax element in the sequence header, the first code stream data may be expanded into the second code stream data. Number T.
- Each of the first code stream data includes a set of image headers and T sets of image data
- the dividing unit 1102 includes:
- a copying subunit 11021 configured to copy a set of image headers of the first code stream data i of the M first code stream data to obtain a T group image header;
- the extension subunit 11022 is configured to expand, according to the T group image header and the T group image data of the first code stream data i, the T second data code streams;
- the obtaining sub-unit 11023 is configured to acquire T second code stream data corresponding to each first code stream data of the M first code stream data, to obtain M*T second code stream data;
- the second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
- Decoding unit 1103 configured to perform parallel decoding on T second code stream data corresponding to any first code stream data to obtain T second video segments; and acquire each of the M first code stream data T second video segments corresponding to T second code stream data of the first code stream data to obtain M*T second video segments.
- the video decoding device 1100 further includes:
- a culling unit 1107 configured to cull the first syntax element and the second syntax element in the sequence header before performing parallel decoding on the T second code stream data corresponding to any first code stream data
- the second syntax element is used to indicate the number N of frames of the second image included in the second video segment.
- the decoding unit 1103 is specifically configured to:
- T second Video clip Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip
- the first code stream data i is any one of the M first code stream data.
- the splicing unit 1104 is configured to splicing the M*T second video segments to obtain the source video.
- any second video segment includes an N-frame second image
- the splicing unit 1104 includes:
- the first splicing sub-unit 11041 is configured to: in the second image of the N*T frames in the T second video segments corresponding to each of the M first code stream data, the image header is the same
- the second image of each T frame is stitched together to obtain M first video segments, each of the first video segments includes N frames of the first image, and the resolution of the first image Greater than the resolution of the second image;
- the second splicing sub-unit 11042 is configured to splicing the M first video segments to obtain the source video.
- each of the foregoing units (the first obtaining unit 1101, the dividing unit 1102, the decoding unit 1103, the splicing unit 1104, the second obtaining unit 1105, the third obtaining unit 1106, and the culling unit 1107) is configured to perform the foregoing method. step.
- the video decoding device 1100 is presented in the form of a unit.
- a "unit” herein may refer to an application-specific integrated circuit (ASIC), a processor and memory that executes one or more software or firmware programs, integrated logic circuits, and/or other devices that provide the functionality described above.
- ASIC application-specific integrated circuit
- the above first obtaining unit 1101, dividing unit 1102, decoding unit 1103, splicing unit 1104, second obtaining unit 1105, third obtaining unit 1106, and culling unit 1107 may pass the processing by the video decoding apparatus 1500 shown in FIG.
- the device 1501 is implemented.
- video encoding apparatus 1400 can be implemented in the structure of FIG. 14, which includes at least one processor 1401, at least one memory 1402, and at least one communication interface 1403.
- the processor 1401, the memory 1402, and the communication interface 1403 are connected by the communication bus and complete communication with each other.
- the processor 1401 may be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program.
- CPU central processing unit
- ASIC application-specific integrated circuit
- the communication interface 1403 is configured to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), and the like.
- RAN Radio Access Network
- WLAN Wireless Local Area Networks
- the memory 1402 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type that can store information and instructions.
- the dynamic storage device can also be an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, and a disc storage device. (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be Any other media accessed, but not limited to this.
- the memory can exist independently and be connected to the processor via a bus.
- the memory can also be integrated with the processor.
- the memory 1402 is configured to store application code that executes the above solution, and is controlled by the processor 1401 for execution.
- the processor 1401 is configured to execute application code stored in the memory 1402.
- the code stored in the memory 1402 may perform the above-described one video encoding method performed by the video encoding apparatus provided above, such as the video encoding apparatus dividing the source video into M first video segments, each of the M first video segments
- the first video segment is composed of N frames of first images, the N frames of the first image are consecutive frame images, and the M and N are integers greater than 1;
- the video encoding device uses the M first video segments
- Each of the first video segments is divided into T second video segments to obtain M*T second video segments, wherein any of the second video segments includes an N-frame second image, the second image
- the resolution is smaller than the resolution of the first image, the T is an integer greater than 1;
- the video encoding device performs parallel encoding on the T second video segments in any of the first video segments to obtain T first Second stream data, and acquiring second code stream data obtained by encoding the second video segment of each of the M first video segments to obtain M*T second code stream data;
- the embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium can store a program, and the program includes some or all of the steps of any one of the video encoding methods described in the foregoing method embodiments.
- video decoding device 1500 can be implemented in the structure of FIG. 15, which includes at least one processor 1501, at least one memory 1502, and at least one communication interface 1503.
- the processor 1501, the memory 1502, and the communication interface 1503 are connected by the communication bus and complete communication with each other.
- the processor 1501 may be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program.
- CPU central processing unit
- ASIC application-specific integrated circuit
- the communication interface 1503 is configured to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), and the like.
- RAN Radio Access Network
- WLAN Wireless Local Area Networks
- the memory 1502 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type that can store information and instructions.
- the dynamic storage device can also be an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, and a disc storage device. (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be Any other media accessed, but not limited to this.
- the memory can exist independently and be connected to the processor via a bus.
- the memory can also be integrated with the processor.
- the memory 1502 is configured to store application code that executes the above solution, and is controlled by the processor 1701 for execution.
- the processor 1501 is configured to execute application code stored in the memory 1502.
- the code stored in the memory 1502 may perform the above-described video decoding method performed by the video decoding device provided by the video decoding device, for example, the video decoding device acquires the code stream data of the source video from the code stream of the source video, and the code stream of the original video.
- the data is a code stream of the original video that does not include a sequence header and a sequence termination code; the video decoding device divides the code stream data of the source video into M first code stream data, and the M Each first code stream data of the first code stream data is expanded into T second code stream data to obtain M*T second code stream data; the video decoding device corresponding to any first code stream data Performing parallel decoding on the T second code stream data to obtain T second video segments; and acquiring T second code stream data corresponding to each of the M first code stream data T second video segments to obtain M*T second video segments; the video decoding device splicing the M*T second video segments to obtain the source video.
- the embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium can store a program, and the program includes some or all of the steps of any one of the video decoding methods described in the foregoing method embodiments.
- the disclosed apparatus may be implemented in other ways.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division.
- there may be another division manner for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical or otherwise.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present invention may contribute to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a memory. A number of instructions are included to cause a computer device (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
- the foregoing memory includes: a U disk, a ROM, a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk, and the like, which can store program codes.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Theoretical Computer Science (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
Disclosed in the present invention is a video encoding and decoding method, comprising: dividing a source video into M first video segments and then dividing each first video segment into T second video segments; performing parallel encoding of the T second video segments of each first video segment to obtain M*T second code stream data; and integrating the M*T second code stream data into M first code stream data, and integrating the source video sequence header, M first code stream data, and sequence stop code into a source video code stream. Equally dividing the source video code stream into M first code stream data and expanding each first code stream data into T second code stream data; performing parallel decoding of the T second code stream data of each first code stream data to obtain M*T second video segments; and splicing the M*T second video segments to obtain the source video. Also disclosed in the present invention is a video encoding and decoding device. The present invention improves video encoding and decoding efficiency.
Description
本申请涉及视频编解码领域,特别涉及一种视频编解码方法及设备。The present application relates to the field of video coding and decoding, and in particular, to a video coding and decoding method and device.
目前,随着人们对视觉享受需求水平的提高,视频显示设备的分辨率越来越高,而且视频解编码标准实现的复杂度也在快速增高,使得尤其是大分辨率视频的编解码所需时间大大增加。At present, with the increasing demand for visual enjoyment, the resolution of video display devices is getting higher and higher, and the complexity of video decoding standard implementation is also increasing rapidly, which makes it necessary to encode and decode especially large-resolution video. The time has increased greatly.
为了提高视频编解码的效率,现有技术具体是对源视频的每一帧图像进行区块划分,得到多个图像区块,然后对一帧图像中的多个图像区块同时进行编解码。然而,现有技术的实现方式中,一帧图像的数据量大,视频编解码效率低,适用性差。In order to improve the efficiency of the video codec, the prior art specifically divides each frame of the source video into blocks, obtains multiple image blocks, and then simultaneously encodes and decodes multiple image blocks in one frame of image. However, in the implementation of the prior art, the data amount of one frame of image is large, the video encoding and decoding efficiency is low, and the applicability is poor.
发明内容Summary of the invention
本发明实施例公开了一种视频编解码方法及设备,提高了视频编解码的效率,适用性广。The embodiment of the invention discloses a video encoding and decoding method and device, which improves the efficiency of video encoding and decoding and has wide applicability.
第一方面,本发明实施例提供了一种视频编码方法,包括:In a first aspect, an embodiment of the present invention provides a video encoding method, including:
视频编码设备将源视频划分为M个第一视频片段,所述M个第一视频片段中的每个第一视频片段由N帧第一图像组成,所述N帧第一图像为连续帧图像,所述M和N均为大于1的整数;The video encoding device divides the source video into M first video segments, each of the M first video segments is composed of N frames of the first image, and the N frames of the first image are consecutive frame images. , wherein M and N are integers greater than one;
所述视频编码设备将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,以得到M*T个第二视频片段,其中,任一所述第二视频片段包括N帧第二图像,所述第二图像的分辨率小于所述第一图像的分辨率,所述T为大于1的整数;The video encoding device divides each of the M first video segments into T second video segments to obtain M*T second video segments, where any of the second videos The segment includes an N-frame second image, the resolution of the second image is less than a resolution of the first image, and the T is an integer greater than one;
所述视频编码设备对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码,以得到M*T个第二码流数据;The video encoding device performs parallel encoding on the T second video segments in each of the M first video segments to obtain M*T second code stream data;
所述视频编码设备对所述M*T个第二码流数据进行整合,以得到所述源视频的码流。The video encoding device integrates the M*T second code stream data to obtain a code stream of the source video.
在一种可行的实施例中,所述视频编码设备将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,包括:In a possible embodiment, the video encoding device divides each of the M first video segments into T second video segments, including:
所述视频编码设备对所述M个第一视频片段中的第一视频片段i进行以下操作:The video encoding device performs the following operations on the first video segment i of the M first video segments:
根据预设分辨率将所述第一视频片段i的N帧第一图像中的每一帧第一图像划分为T帧第二图像,并对所述T帧第二图像进行编号,以得到N*T帧第二图像,其中,任一第二图像的分辨率小于或者等于所述预设分辨率,所述第一视频片段i的N帧第一图像的各帧第一图像中位置相对应的第二图像的编号相同;Decoding a first image of each frame of the N frames of the first video segment i into a second image of the T frame according to a preset resolution, and numbering the second image of the T frame to obtain N *T frame second image, wherein the resolution of any second image is less than or equal to the preset resolution, and the position of the first image of each frame of the N image of the first video segment i corresponds to The second image has the same number;
将所述N*T帧第二图像中,编号相同的N帧第二图像进行组合,得到T个第二视频片段;Combining N frames of second images with the same number in the second image of the N*T frame to obtain T second video segments;
其中,所述第一视频片段i为所述M个第一视频片段中的任意一个。The first video segment i is any one of the M first video segments.
在一种可行的实施例中,所述视频编码设备对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码,包括:
In a possible embodiment, the video encoding device performs parallel encoding on the T second video segments in each of the M first video segments, including:
所述视频编码设备对所述第一视频片段i进行以下操作:The video encoding device performs the following operations on the first video segment i:
获取所述第一视频片段i的T个第二视频片段中每个第二视频片段对应的编码优先级;Obtaining an encoding priority corresponding to each of the T second video segments of the first video segment i;
根据上述第一视频片段i中的T个第二视频片段对应的编码优先级,对所述第一视频片段i的T个第二视频片段进行并行编码,以得到T个第二码流数据。And encoding, according to the coding priority corresponding to the T second video segments in the first video segment i, the T second video segments of the first video segment i to obtain T second code stream data.
在一种可行的实施例中,所述视频编码设备对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码之前,所述方法还包括:In a possible embodiment, before the video encoding device performs parallel encoding on the T second video segments in each of the M first video segments, the method further includes:
所述视频编码设备根据编码配置信息生成所述源视频的码流的序列头。The video encoding device generates a sequence header of a code stream of the source video according to the encoding configuration information.
在一种可行的实施例中,所述视频编码设备对所述M*T个码流数据进行整合,以得到所述源视频的码流,包括:In a possible embodiment, the video encoding device integrates the M*T code stream data to obtain a code stream of the source video, including:
所述视频编码设备将所述M个第一视频片段中的每个第一视频片段的T个第二码流数据进行整合以得到M个第一码流数据,其中,一个第一视频片段的T个第二码流数据整合得到一个第一码流数据;The video encoding device integrates T second code stream data of each of the M first video segments to obtain M first code stream data, where a first video segment is Integrating T pieces of second stream data to obtain a first stream data;
所述视频编码设备将所述序列头、所述M个第一码流数据和序列终止码整合成所述源视频的码流。The video encoding device integrates the sequence header, the M first code stream data, and a sequence termination code into a code stream of the source video.
在一种可行的实施例中,任一第二码流数据包括一组图像头和一组图像数据,所述视频编码设备将所述M个第一视频片段中的每个第一视频片段的T个第二码流数据进行整合以得到M个第一码流数据,包括:In a possible embodiment, any second code stream data includes a set of image headers and a set of image data, and the video encoding device will each of the first of the M first video segments The T second code stream data of the segment is integrated to obtain M first code stream data, including:
所述视频编码设备对所述第一视频片段i进行如下操作:The video encoding device performs the following operations on the first video segment i:
获取所述第一视频片段i的对应的T个第二码流数据中每个第二码流数据的编码优先级,所述第二码流数据的编码优先级与其对应的第二视频片段的编码优先级一致;Obtaining an encoding priority of each second code stream data of the corresponding T second code stream data of the first video segment i, the encoding priority of the second code stream data and the corresponding second video segment thereof The coding priority is consistent;
根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的编码优先级,确定所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序;其中,所述第二码流数据的编码优先级越高,所述第二码流数据的图像数据的整合顺序越靠前;Determining, according to an encoding priority of each second code stream data of the T second code stream data corresponding to the first video segment i, each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;
根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序将所述所述第一视频片段i对应的T个第二码流数据的图像数据整合为一个第一码流数据的图像数据,并将所述第一视频片段i对应的T个第二码流数据中任一第二码流数据的一组图像头和所述第一码流数据的图像数据整合一个所述第一码流数据,其中,每个所述第一码流数据包括一组所述图像头和T组图像数据,所述T个第二码流数据对应的T个第二视频片段属于同一个第一视频片段。And according to the integration order of the image data of each of the T second code stream data corresponding to the first video segment i, the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data The image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes The T second video segments corresponding to the stream data belong to the same first video segment.
在一种可行的实施例中,所述视频编码设备根据配置信息生成所述源视频的码流的序列头之后,所述方法还包括:In a possible embodiment, after the video encoding device generates a sequence header of the code stream of the source video according to the configuration information, the method further includes:
所述视频编码设备在所述序列头中添加用于指示所述预设分辨率的第一语法元素和用于指示所述第一视频片段中包括的所述第一图像的帧数N的第二语法元素。The video encoding apparatus adds, in the sequence header, a first syntax element for indicating the preset resolution and a number of frames N for indicating the first image included in the first video segment. Two syntax elements.
第二方面,本发明实施例还提供了一种视频解码方法,包括:In a second aspect, an embodiment of the present invention further provides a video decoding method, including:
视频解码设备从源视频的码流中获取所述源视频的码流数据,所述原始视频的码流数据为不包括序列头和序列终止码的所述原始视频的码流;The video decoding device acquires code stream data of the source video from a code stream of the source video, where the code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code;
所述视频解码设备将所述源视频的码流数据平均划分为M个第一码流数据,并将所述
M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,以得到M*T个第二码流数据;The video decoding device divides the code stream data of the source video into M first code stream data, and the
Each first code stream data of the M first code stream data is expanded into T second code stream data to obtain M*T second code stream data;
所述视频解码设备对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码,以得到M*T个第二视频片段;The video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data to obtain M*T second video segments;
所述视频解码设备对所述M*T个第二视频片段进行拼接,以得到所述源视频。The video decoding device splices the M*T second video segments to obtain the source video.
在一种可行的实施例中,所述视频解码设备将源视频的码流数据平均划分为M个第一码流数据之前,所述方法还包括:In a possible embodiment, before the video decoding device divides the code stream data of the source video into M pieces of the first code stream data, the method further includes:
所述视频解码设备从所述源视频的码流中获取序列头;The video decoding device acquires a sequence header from a code stream of the source video;
所述视频解码设备根据所述源视频的分辨率和所述序列头中的第一语法元素所指示的预设分辨率获取第一码流数据可扩展成第二码流数据的个数T。The video decoding device acquires the number T of the first code stream data that can be expanded into the second code stream data according to the resolution of the source video and the preset resolution indicated by the first syntax element in the sequence header.
在一种可行的实施例中,每个所述第一码流数据包括一组图像头和T组图像数据,所述将所述M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,包括:In a possible embodiment, each of the first code stream data includes a set of image headers and T sets of image data, and each of the first streams of the M first code stream data The data is expanded into T second stream data, including:
所述视频解码设备对所述M个第一码流数据中的第一码流数据i的一组图像头进行复制以得到T组图像头;The video decoding device copies a set of image headers of the first code stream data i of the M first code stream data to obtain a T group image header;
所述视频解码设备根据所述T组图像头和所述第一码流数据i的T组图像数据,扩展得到T个第二数据码流;The video decoding device expands to obtain T second data code streams according to the T group image header and the T group image data of the first code stream data i;
所述视频解码设备获取所述M个第一码流数据的每个第一码流数据对应的T个第二码流数据,以得到M*T个第二码流数据;The video decoding device acquires T second code stream data corresponding to each first code stream data of the M first code stream data to obtain M*T second code stream data;
其中,任一第二码流数据包括一组图像头和一组图像数据,所述第一码流数据i为所述M个第一码流数据中的任意一个。The second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
在一种可行的实施例中,所述视频解码设备对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码,包括:In a possible implementation, the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data, including:
所述视频编码设备对所述M个第一码流数据中的第一码流数据i进行以下操作:The video encoding device performs the following operations on the first code stream data i of the M first code stream data:
获取所述第一码流数据i的T个第二码流数据中每个第二码流数据对应的解码优先级;Obtaining a decoding priority corresponding to each second code stream data of the T second code stream data of the first code stream data i;
根据所述第一码流数据i的T个第二码流数据对应的解码优先级,对所述第一码流数据i的T个第二码流数据进行并行解码,以得到T个第二视频片段;Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip
其中,所述第一码流数据i为所述M个第一码流数据中的任意一个。The first code stream data i is any one of the M first code stream data.
在一种可行的实施例中,所述视频解码设备对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码之前,所述方法还包括:In a possible implementation, before the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first code stream data, the method Also includes:
所述视频解码设备剔除所述序列头中的所述第一语法元素和第二语法元素,所述第二语法元素用于指示所述第二视频片段中包括的第二图像的帧数N。The video decoding device culls the first syntax element and the second syntax element in the sequence header, and the second syntax element is used to indicate a frame number N of a second image included in the second video segment.
在一种可行的实施例中,任一第二视频片段包括N帧第二图像,所述视频解码设备对所述M*T个第二视频片段进行拼接,以得到所述源视频,包括:In a possible embodiment, any second video segment includes an N-frame second image, and the video decoding device splices the M*T second video segments to obtain the source video, including:
所述视频解码设备将所述M个第一码流数据中的每个第一码流数据对应的T个第二视频片段中的N*T帧第二图像中,图像头相同的每T帧第二图像拼接在一起,得到M个第一视频片段,所述M个第一视频片段中的每个第一视频片段包括N帧第一图像,所述第一图像的分辨率大于所述第二图像的分辨率;The video decoding device, in the second image of the N*T frames in the T second video segments corresponding to each of the M first stream data, each T frame of the same image header The second images are stitched together to obtain M first video segments, each of the first video segments includes an N-frame first image, and the resolution of the first image is greater than the first image The resolution of the two images;
所述视频解码设备对所述M个第一视频片段进行拼接,以得到所述源视频。
The video decoding device splices the M first video segments to obtain the source video.
第三方面,本发明实施例提供了一种视频编码设备,包括:In a third aspect, an embodiment of the present invention provides a video encoding device, including:
第一划分单元,用于将源视频划分为M个第一视频片段,所述M个第一视频片段中的每个第一视频片段由N帧第一图像组成,所述N帧第一图像为连续帧图像,所述M和N均为大于1的整数;a first dividing unit, configured to divide the source video into M first video segments, each of the M first video segments being composed of N frames of the first image, the N frames of the first image For consecutive frame images, the M and N are integers greater than one;
第二划分单元,用于将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,以得到M*T个第二视频片段,其中,任一所述第二视频片段包括N帧第二图像,所述第二图像的分辨率小于所述第一图像的分辨率,所述T为大于1的整数;a second dividing unit, configured to divide each of the M first video segments into T second video segments to obtain M*T second video segments, where any of the foregoing The second video segment includes an N-frame second image, the resolution of the second image is less than a resolution of the first image, and the T is an integer greater than one;
编码单元,用于对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码,以得到M*T个第二码流数据;a coding unit, configured to perform parallel coding on the T second video segments in each of the M first video segments to obtain M*T second code stream data;
整合单元,用于对所述M*T个第二码流数据进行整合,以得到所述源视频的码流。And an integration unit, configured to integrate the M*T second code stream data to obtain a code stream of the source video.
在一种可行的实施例中,所述第二划分单元具体用于:In a possible embodiment, the second dividing unit is specifically configured to:
对所述M个第一视频片段中的第一视频片段i进行以下操作:Performing the following operations on the first video segment i of the M first video segments:
根据预设分辨率将所述第一视频片段i的N帧第一图像中的每一帧第一图像划分为T帧第二图像,并对所述T帧第二图像进行编号,以得到N*T帧第二图像,其中,任一第二图像的分辨率小于或者等于所述预设分辨率,所述第一视频片段i的N帧第一图像的各帧第一图像中位置相对应的第二图像的编号相同;Decoding a first image of each frame of the N frames of the first video segment i into a second image of the T frame according to a preset resolution, and numbering the second image of the T frame to obtain N *T frame second image, wherein the resolution of any second image is less than or equal to the preset resolution, and the position of the first image of each frame of the N image of the first video segment i corresponds to The second image has the same number;
将所述N*T帧第二图像中,编号相同的N帧第二图像进行组合,得到T个第二视频片段;Combining N frames of second images with the same number in the second image of the N*T frame to obtain T second video segments;
其中,所述第一视频片段i为所述M个第一视频片段中的任意一个。The first video segment i is any one of the M first video segments.
在一种可行的实施例中,所述编码单元具体用于:In a possible embodiment, the coding unit is specifically configured to:
对所述第一视频片段i进行以下操作:Performing the following operations on the first video segment i:
获取所述第一视频片段i的T个第二视频片段中每个第二视频片段对应的编码优先级;Obtaining an encoding priority corresponding to each of the T second video segments of the first video segment i;
根据上述第一视频片段i中的T个第二视频片段对应的编码优先级,对所述第一视频片段i的T个第二视频片段进行并行编码,以得到T个第二码流数据。And encoding, according to the coding priority corresponding to the T second video segments in the first video segment i, the T second video segments of the first video segment i to obtain T second code stream data.
在一种可行的实施例中,所述视频编码设备还包括:In a possible embodiment, the video encoding device further includes:
生成单元,用于在对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码之前,根据编码配置信息生成所述源视频码流的序列头。a generating unit, configured to generate a sequence header of the source video code stream according to the encoding configuration information, before performing parallel encoding on the T second video segments in each of the M first video segments .
在一种可行的实施例中,所述整合单元包括:In a possible embodiment, the integration unit comprises:
第一整合子单元,用于将所述M个第一视频片段中的每个第一视频片段的T个第二码流数据进行整合以得到M个第一码流数据,其中,一个第一视频片段的T个第二码流数据整合得到一个第一码流数据;a first integration subunit, configured to integrate T second code stream data of each of the M first video segments to obtain M first code stream data, where Integrating T pieces of second stream data of the video segment to obtain a first stream data;
第二整合子单元,用于将所述序列头、所述M个第一码流数据和序列终止码整合成所述源视频的码流。And a second integration subunit, configured to integrate the sequence header, the M first code stream data, and the sequence termination code into a code stream of the source video.
在一种可行的实施例中,任一第二码流数据包括一组图像头和一组图像数据,所述第一整合单元具体用于:In a possible embodiment, any of the second code stream data includes a set of image headers and a set of image data, and the first integration unit is specifically configured to:
对所述第一视频片段i进行如下操作:Performing the following operations on the first video segment i:
获取所述第一视频片段i的对应的T个第二码流数据中每个第二码流数据的编码优先级,所述第二码流数据的编码优先级与其对应的第二视频片段的编码优先级一致;
Obtaining an encoding priority of each second code stream data of the corresponding T second code stream data of the first video segment i, the encoding priority of the second code stream data and the corresponding second video segment thereof The coding priority is consistent;
根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的编码优先级,确定所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序;其中,所述第二码流数据的编码优先级越高,所述第二码流数据的图像数据的整合顺序越靠前;Determining, according to an encoding priority of each second code stream data of the T second code stream data corresponding to the first video segment i, each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;
根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序将所述所述第一视频片段i对应的T个第二码流数据的图像数据整合为一个第一码流数据的图像数据,并将所述第一视频片段i对应的T个第二码流数据中任一第二码流数据的一组图像头和所述第一码流数据的图像数据整合一个所述第一码流数据,其中,每个所述第一码流数据包括一组所述图像头和T组图像数据,所述T个第二码流数据对应的T个第二视频片段属于同一个第一视频片段。And according to the integration order of the image data of each of the T second code stream data corresponding to the first video segment i, the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data The image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes The T second video segments corresponding to the stream data belong to the same first video segment.
在一种可行的实施例中,所述视频编码设备还包括:In a possible embodiment, the video encoding device further includes:
添加单元,用于在根据所述编码配置信息生成所述源视频码流的序列头之后,在所述序列头中添加用于指示所述预设分辨率的第一语法元素和用于指示所述第一视频片段中包括的所述第一图像的帧数N的第二语法元素。Adding a unit, after generating a sequence header of the source video code stream according to the encoding configuration information, adding a first syntax element for indicating the preset resolution and indicating the location in the sequence header a second syntax element of the number N of frames of the first image included in the first video segment.
第四方面,本发明实施例提供了一种,包括:In a fourth aspect, an embodiment of the present invention provides:
第一获取单元,用于从源视频的码流中获取所述源视频的码流数据,所述原始视频的码流数据为不包括序列头和序列终止码的所述原始视频的码流;a first acquiring unit, configured to acquire code stream data of the source video from a code stream of the source video, where the code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code;
划分单元,用于将所述源视频的码流数据平均划分为M个第一码流数据,并将所述M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,以得到M*T个第二码流数据;a dividing unit, configured to divide the code stream data of the source video into M first code stream data, and expand each first code stream data of the M first code stream data into T second Code stream data to obtain M*T second code stream data;
解码单元,用于对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码,以得到M*T个第二视频片段;a decoding unit, configured to perform parallel decoding on the T second code stream data corresponding to each of the M first code stream data to obtain M*T second video segments;
整合单元,用于对所述M*T个第二视频片段进行整合,得到所述源视频。And an integration unit, configured to integrate the M*T second video segments to obtain the source video.
在一种可行的实施例中,所述视频解码设备还包括:In a possible embodiment, the video decoding device further includes:
第二获取单元,用于在从将源视频的码流数据平均划分为M个第一码流数据之前,获取所述源视频的码流中获取序列头;a second acquiring unit, configured to acquire a sequence header in a code stream of the source video before the code stream data of the source video is equally divided into M first code stream data;
第三获取单元,用于根据所述源视频的分辨率和所述序列头中的第一语法元素所指示的预设分辨率获取第一码流数据可扩展成第二码流数据的个数T。a third acquiring unit, configured to acquire, according to a resolution of the source video and a preset resolution indicated by the first syntax element in the sequence header, the number of the first code stream data that can be expanded into the second code stream data T.
在一种可行的实施例中,每个所述第一码流数据包括一组图像头和T组图像数据,所述划分单元包括:In a possible embodiment, each of the first code stream data includes a set of image headers and T sets of image data, and the dividing unit comprises:
复制子单元,用于对所述M个第一码流数据中的第一码流数据i的一组图像头进行复制以得到T组图像头;a copying subunit, configured to copy a set of image headers of the first code stream data i of the M first code stream data to obtain a T group image header;
扩展子单元,用于根据所述T组图像头和所述第一码流数据i的T组图像数据,扩展得到T个第二数据码流;An extension subunit, configured to expand, according to the T group image header and the T group image data of the first code stream data i, to obtain T second data code streams;
第一获取子单元,用于获取所述M个第一码流数据的每个第一码流数据对应的T个第二码流数据,以得到M*T个第二码流数据;a first acquiring sub-unit, configured to acquire T second code stream data corresponding to each first code stream data of the M first code stream data, to obtain M*T second code stream data;
其中,任一第二码流数据包括一组图像头和一组图像数据,所述第一码流数据i为所述M个第一码流数据中的任意一个。
The second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
在一种可行的实施例中,所述解码单元具体用于:In a possible embodiment, the decoding unit is specifically configured to:
对所述M个第一码流数据中的第一码流数据i进行以下操作:Performing the following operations on the first code stream data i of the M first code stream data:
获取所述第一码流数据i的T个第二码流数据中每个第二码流数据对应的解码优先级;Obtaining a decoding priority corresponding to each second code stream data of the T second code stream data of the first code stream data i;
根据所述第一码流数据i的T个第二码流数据对应的解码优先级,对所述第一码流数据i的T个第二码流数据进行并行解码,以得到T个第二视频片段;Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip
其中,所述第一码流数据i为所述M个第一码流数据中的任意一个。The first code stream data i is any one of the M first code stream data.
在一种可行的实施例中,所述视频解码设备还包括:In a possible embodiment, the video decoding device further includes:
剔除单元,用于在对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码之前,剔除所述序列头中的所述第一语法元素和第二语法元素,所述第二语法元素用于指示所述第二视频片段中包括的第二图像的帧数N。a culling unit, configured to cull the first one of the sequence headers before performing parallel decoding on the T second code stream data corresponding to each of the M first code stream data And a second syntax element, the second syntax element is used to indicate the number N of frames of the second image included in the second video segment.
在一种可行的实施例中,任一第二视频片段包括N帧第二图像,所述拼接单元包括:In a possible embodiment, any second video segment includes an N-frame second image, and the splicing unit includes:
第一拼接子单元,用于将所述M个第一码流数据中的每个第一码流数据对应的T个第二视频片段中的N*T帧第二图像中,图像头相同的每T帧第二图像拼接在一起,得到M个第一视频片段,所述M个第一视频片段中的每个第一视频片段包括N帧第一图像,所述第一图像的分辨率大于所述第二图像的分辨率;a first splicing subunit, configured to: in the second image of the N*T frames in the T second video segments corresponding to each of the M first code stream data, the image header is the same The second image is spliced together every T frame to obtain M first video segments, each of the M first video segments includes an N frame first image, and the resolution of the first image is greater than The resolution of the second image;
第二拼接子单元,用于对所述M个第一视频片段进行拼接,以得到所述源视频。a second splicing subunit, configured to splicing the M first video segments to obtain the source video.
第五方面,本发明实施例提供一种视频编码设备,包括:In a fifth aspect, an embodiment of the present invention provides a video encoding device, including:
存储有可执行程序代码的存储器;a memory storing executable program code;
与所述耦合的处理器;a processor coupled to the;
所述处理器调用所述存储器中存储的所述可执行程序代码,执行如本发明实施例第一方面中所描述的部分或全部步骤。The processor invokes the executable program code stored in the memory to perform some or all of the steps as described in the first aspect of the embodiments of the present invention.
第六方面,本发明实施例提供一种视频解码设备,包括:In a sixth aspect, an embodiment of the present invention provides a video decoding device, including:
存储有可执行程序代码的存储器;a memory storing executable program code;
与所述耦合的处理器;a processor coupled to the;
所述处理器调用所述存储器中存储的所述可执行程序代码,执行如本发明实施例第二方面中所描述的部分或全部步骤。The processor invokes the executable program code stored in the memory to perform some or all of the steps as described in the second aspect of the embodiments of the present invention.
可以看出,在本发明实施例的方案中,视频编码设备将源视频划分为M个第一视频片段,然后将上述M个第一视频片段中的每个第一视频片段划分为T个第二视频片段。上述视频编码设备对上述每个第一视频片段的T个第二视频片段进行并行编码,得到M*T个第二码流数据;上述视频编码设备将上述M*T个第二码流数据整合成M个第一码流数据,然后将源视频的序列头、M个第一码流数据和序列终止码整合成源视频的码流。视频解码设备将源视频的码流数据平均划分为M个第一码流数据,然后将该M个第一码流数据的每个第一码流数据扩展为T个第二码流数据。上述视频解码设备对上述每个第一码流数据的T个第二码流数据进行并行解码,得到M*T个第二视频片段,然后将M*T个第二视频片段拼接得到源视频。与现有技术相比,本发明对一个视频片段的多个子视频片段进行并行编解码,提高了视频编解码的效率;并且在对该视频片段的多个子视频完成解码后,可以直接显示该视频片段,提高了用户体验。
It can be seen that, in the solution of the embodiment of the present invention, the video encoding device divides the source video into M first video segments, and then divides each of the M first video segments into T first segments. Two video clips. The video encoding device performs parallel encoding on the T second video segments of each of the first video segments to obtain M*T second code stream data; and the video encoding device integrates the M*T second code streams data. The M first stream data is then integrated into the sequence of the source video, the M first stream data, and the sequence termination code into a stream of the source video. The video decoding device divides the code stream data of the source video into M first code stream data, and then expands each first code stream data of the M first code stream data into T second code stream data. The video decoding device performs parallel decoding on the T second code stream data of each of the first code stream data to obtain M*T second video segments, and then splices the M*T second video segments to obtain a source video. Compared with the prior art, the present invention performs parallel encoding and decoding on multiple sub-video segments of a video segment, which improves the efficiency of video encoding and decoding; and after decoding multiple sub-videos of the video segment, the video can be directly displayed. Fragments that improve the user experience.
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any creative work.
图1为本发明实施例提供的一种视频编解码的框架示意图;1 is a schematic diagram of a frame of a video codec according to an embodiment of the present invention;
图2为本发明实施例提供的一种视频编码方法的流程示意图;2 is a schematic flowchart of a video encoding method according to an embodiment of the present invention;
图3为一种一帧第一图像划分示意图;3 is a schematic diagram of a first image division of a frame;
图4为本发明实施例提供的一种第一视频片段对应的第一码流数据的格式示意图;FIG. 4 is a schematic diagram of a format of a first code stream data corresponding to a first video segment according to an embodiment of the present disclosure;
图5为本发明实施例提供的另一种第一视频片段对应的第一码流数据的格式示意图;FIG. 5 is a schematic diagram of a format of another first stream data corresponding to a first video segment according to an embodiment of the present disclosure;
图6为本发明实施例提供的一种视频编解码方法的流程示意图;FIG. 6 is a schematic flowchart diagram of a video encoding and decoding method according to an embodiment of the present disclosure;
图7为另一种一帧第一图像划分示意图;7 is a schematic diagram of another first frame division of one frame;
图8为本发明实施例提供的一种视频编解码方法的流程示意图;FIG. 8 is a schematic flowchart of a video encoding and decoding method according to an embodiment of the present disclosure;
图9为本发明实施例提供的一种视频编码设备的结构示意图;FIG. 9 is a schematic structural diagram of a video encoding apparatus according to an embodiment of the present disclosure;
图10为本发明实施例提供的一种视频编码设备的局部结构示意图;FIG. 10 is a schematic structural diagram of a part of a video encoding apparatus according to an embodiment of the present disclosure;
图11为本发明实施例提供的一种视频解码设备的结构示意图;FIG. 11 is a schematic structural diagram of a video decoding device according to an embodiment of the present disclosure;
图12为本发明实施例提供的一种视频解码设备的局部结构示意图;FIG. 12 is a schematic structural diagram of a partial structure of a video decoding device according to an embodiment of the present disclosure;
图13为本发明实施例提供的另一种视频解码设备的局部结构示意图;FIG. 13 is a schematic structural diagram of another video decoding device according to an embodiment of the present disclosure;
图14为本发明实施例提供的另一种视频编码设备的结构示意图;FIG. 14 is a schematic structural diagram of another video encoding apparatus according to an embodiment of the present disclosure;
图15为本发明实施例提供的另一种视频解码设备的结构示意图。FIG. 15 is a schematic structural diagram of another video decoding device according to an embodiment of the present invention.
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present invention will be clearly and completely described in the following with reference to the accompanying drawings.
参见图1,图1为本发明实施例提供的一种视频编解码的框架示意图。如图1所示,该视频编解码的架构包括:视频编码设备101和视频解码设备102。Referring to FIG. 1, FIG. 1 is a schematic diagram of a frame of a video codec according to an embodiment of the present invention. As shown in FIG. 1, the video codec architecture includes a video encoding device 101 and a video decoding device 102.
上述视频编码设备101获取源视频后,对该源视频进行编码,得到该源视频的码流。上述视频编码设备101将上述源视频的码流传输至上述视频解码设备102,该视频解码设备102对上述源视频的码流进行解码,得到源视频,并将该源视频输出。After acquiring the source video, the video encoding device 101 encodes the source video to obtain a code stream of the source video. The video encoding device 101 transmits the code stream of the source video to the video decoding device 102, and the video decoding device 102 decodes the code stream of the source video to obtain a source video, and outputs the source video.
需要说明的是,上述视频编码设备和视频解码设备可集成在同一设备中,还可集成在两个不同的设备。其中,上述两个不同的设备可以是不同生产厂家生产的,还可以是同一生产厂家生产的。It should be noted that the above video encoding device and video decoding device may be integrated in the same device, and may be integrated into two different devices. Among them, the above two different devices can be produced by different manufacturers, or can be produced by the same manufacturer.
参见图2,图2为本发明实施例提供的一种视频编码方法的流程示意图。如图2所示,该方法包括:Referring to FIG. 2, FIG. 2 is a schematic flowchart diagram of a video encoding method according to an embodiment of the present invention. As shown in Figure 2, the method includes:
S201、视频编码设备将源视频划分为M个第一视频片段。S201. The video encoding device divides the source video into M first video segments.
其中,上述M个第一视频片段中的每个第一视频片段由N帧第一图像组成,所述N帧第一图像为连续帧图像,所述M和N均为大于1的整数。
Each of the M first video segments is composed of N frames of the first image, and the N frames of the first image are consecutive frame images, and the M and N are integers greater than 1.
需要指出的是,上述源视频由M*N帧第一图像组成,并且该M*N帧第一图像的分辨率均为W*H。上述源视频的分辨率可看成W*H。It should be noted that the above source video is composed of the first image of the M*N frame, and the resolution of the first image of the M*N frame is W*H. The resolution of the above source video can be regarded as W*H.
S202、所述视频编码设备将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,以得到M*T个第二视频片段。S202. The video encoding device divides each of the M first video segments into T second video segments to obtain M*T second video segments.
其中,任一所述第二视频片段包括N帧第二图像,所述第二图像的分辨率小于所述第一图像的分辨率,所述T为大于1的整数。Wherein any of the second video segments comprises an N-frame second image, the resolution of the second image is less than a resolution of the first image, and the T is an integer greater than 1.
其中,所述视频编码设备将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,包括:The video encoding device divides each of the M first video segments into T second video segments, including:
所述视频编码设备对所述M个第一视频片段中的第一视频片段i进行以下操作:The video encoding device performs the following operations on the first video segment i of the M first video segments:
根据预设分辨率将所述第一视频片段i的N帧第一图像中的每一帧第一图像划分为T帧第二图像,并对所述T帧第二图像进行编号,以得到N*T帧第二图像,其中,任一第二图像的分辨率小于或者等于所述预设分辨率,所述第一视频片段i的N帧第一图像的各帧第一图像中位置相对应的第二图像的编号相同;Decoding a first image of each frame of the N frames of the first video segment i into a second image of the T frame according to a preset resolution, and numbering the second image of the T frame to obtain N *T frame second image, wherein the resolution of any second image is less than or equal to the preset resolution, and the position of the first image of each frame of the N image of the first video segment i corresponds to The second image has the same number;
将所述N*T帧第二图像中,编号相同的N帧第二图像进行组合,得到T个第二视频片段;Combining N frames of second images with the same number in the second image of the N*T frame to obtain T second video segments;
其中,所述第一视频片段i为所述M个第一视频片段中的任意一个。The first video segment i is any one of the M first video segments.
具体地,上述视频编码设备按照相同的划分顺序和预设分辨率将上述第一视频片段i的N帧第一图像中的每一帧第一图像划分为T帧第二图像。当上述预设分辨率为w*h,则上述T=([W/w]+1)*([H/h]+1)。上述视频编码设备按照上述划分顺序对上述第一视频片段i的每一帧第一图像的T帧第二图像进行编号,使得上述第一视频片段i的N帧第一图像的各帧第一图像中位置相对应的第二图像的编码相同。上述视频编码设备获取上述第一视频片段i的N帧第一图像的每帧第一图像划分得到的T帧第二图像,以得到N*T帧第二图像。上述编码设备将该N*T帧第二图像中,编号相同的N帧第二图像进行组合得到T个第二视频片段。Specifically, the video encoding device divides each frame of the first image of the N frames of the first video segment i into a second image of the T frame according to the same division order and preset resolution. When the above preset resolution is w*h, the above T=([W/w]+1)*([H/h]+1). The video encoding device numbers the second image of the T frame of the first image of each frame of the first video segment i according to the above-mentioned dividing order, so that the first image of each frame of the first image of the N frames of the first video segment i The encoding of the second image corresponding to the middle position is the same. The video encoding apparatus acquires the second image of the T frame obtained by dividing the first image of each frame of the first frame of the N frames of the first video segment i to obtain the second image of the N*T frame. The encoding device combines the second images of the N frames having the same number in the second image of the N*T frame to obtain T second video segments.
其中,上述W大于或者等于上述w,上述H大于或者等于上述h。Wherein, the above W is greater than or equal to the above w, and the above H is greater than or equal to the above h.
需要说明的是,上述T个第二视频片段的每个第二视频片段由N帧第二图像组成,且上述第二图像的分辨率小于或者等于上述预设分辨率。It should be noted that each second video segment of the T second video segments is composed of N frames of second images, and the resolution of the second image is less than or equal to the preset resolution.
其中,上述预设分辨率为4的倍数。Wherein, the preset resolution is a multiple of 4.
举例说明,假设上述第一视频片段i包括5帧第一图像,每帧第一图像的分辨率为416*240,上述预设分辨率为128*128。上述视频编码设备根据按照预设分辨率和相同的划分顺序,将上述5帧分辨率均为416*240的第一图像的每帧第一图像均划分为6帧第二图像,该6帧第二图像包括2帧分辨率均为128*128的第二图像、2帧分辨率均为128*112的第二图像、1帧分辨率为128*64的第二图像和1帧分辨率为112*64的第二图像。参见图3,图3为一帧第一图像划分示意图。如图3中的a图所示,上述视频编码设备将一帧第一图像根据预设分辨率,从左到右,从上到下划分为6帧第二图像,并按照从左到右,从上到下依次编号;如图3中的b图所示,上述视频编码设备将一帧第一图像根据预设分辨率,从右到左,从上到下划分为6帧第二图像,并按照从右到左,从上到下依次编号;如图3中的c图所示,上述视频编码设备将一帧第一图像根据预设分辨率,从左到右,从下到上
划分为6帧第二图像,并按照从左到右,从下到上依次编号;如图3中的d图所示,上述视频编码设备将一帧第一图像根据预设分辨率,从左到右,从上到下划分为6帧第二图像,并按照从右到左,从下到上依次编号。For example, it is assumed that the first video segment i includes five frames of the first image, and the resolution of the first image of each frame is 416*240, and the preset resolution is 128*128. The video encoding apparatus divides the first image of each frame of the first image with the resolution of 416*240 of the above five frames into 6 frames of the second image according to the preset resolution and the same division order, and the 6 frames The second image includes a second image with a resolution of 128*128 for 2 frames, a second image with a resolution of 128*112 for both frames, a second image with a resolution of 128*64 for 1 frame, and a resolution of 112 for 1 frame. *64 second image. Referring to FIG. 3, FIG. 3 is a schematic diagram of a first image division of a frame. As shown in a diagram of FIG. 3, the video encoding apparatus divides a frame of the first image into a 6-frame second image from left to right and from top to bottom according to a preset resolution, and follows from left to right. The numbers are sequentially numbered from top to bottom; as shown in the figure b in FIG. 3, the video encoding device divides the first image of one frame into a second image of 6 frames from right to left and from top to bottom according to a preset resolution. And numbered from right to left and from top to bottom; as shown in c in FIG. 3, the above video encoding device takes a frame of the first image according to a preset resolution, from left to right, from bottom to top.
Divided into 6 frames of the second image, and numbered from left to right, from bottom to top; as shown in the figure d in Figure 3, the above video encoding device will first frame a frame according to a preset resolution, from the left To the right, the second image is divided into 6 frames from top to bottom, and is numbered sequentially from right to left and from bottom to top.
可以看出,图3中的a图、b图、c图和d图所示的划分顺序为从左到右,从上到下;从右到左,从上到下;从左到右,从下到上;从左到右,从上到下。It can be seen that the order of division shown in the a diagram, the b diagram, the c diagram and the d diagram in FIG. 3 is from left to right, from top to bottom; from right to left, from top to bottom; from left to right, From bottom to top; from left to right, from top to bottom.
上述编码设备可按照图3所示的方法将上述5帧第一图像的每帧第一图像划分为6帧第二图像,并且对按照图3所示的方法对每帧第一图像划分为6帧第二图像进行编号,得到30帧第二图像。上述视频编码设备对该30帧第二图像中,编号相同的每5帧图像进行组合,得到6个第二视频片段。The above encoding apparatus may divide the first image of each frame of the above five frames of the first image into six frames of the second image according to the method shown in FIG. 3, and divide the first image of each frame into six according to the method shown in FIG. The second image of the frame is numbered to obtain 30 frames of the second image. The video encoding device combines the images of every 5 frames of the same number in the 30 frames of the second image to obtain 6 second video segments.
上述6个第二视频片段包括2个分辨率为128*128的视频片段、2个分辨率为128*112的视频片段、1个分辨率为128*64的视频片段和1个分辨率为112*64的视频片段。The above six second video segments include two video segments with a resolution of 128*128, two video segments with a resolution of 128*112, one video segment with a resolution of 128*64, and one resolution of 112. *64 video clips.
上述视频编码设备按照上述方法获取上述M个第一视频片段中的每个第一视频片段对应的T个第二视频片段,以得到M*T个第二视频片段。The video encoding device obtains T second video segments corresponding to each of the M first video segments according to the foregoing method, to obtain M*T second video segments.
S203、所述视频编码设备对所述M个第一视频片段中每个第一视频片段中的T个第二视频片段进行并行编码,以得到M*T个第二码流数据。S203. The video encoding device performs parallel coding on the T second video segments in each of the M first video segments to obtain M*T second code stream data.
其中,所述视频编码设备对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码之前,所述方法还包括:Before the video encoding device performs parallel encoding on the T second video segments in each of the M first video segments, the method further includes:
所述视频编码设备根据编码配置信息生成所述源视频码流的序列头。The video encoding device generates a sequence header of the source video code stream according to the encoding configuration information.
具体的,上述编码配置信息包括待编码视频序列的路径、宽、高、采样精度、输出码流名称、运动搜索的方式、运动搜索的范围、最大可参考帧的数目、量化参数等一些通用配置及编码工具选择等信息。Specifically, the foregoing coding configuration information includes a path, a width, a height, a sampling precision, an output stream name, a motion search mode, a motion search range, a maximum number of reference frames, and a quantization parameter of the video sequence to be encoded. And information such as coding tools.
其中,所述视频编码设备对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码,包括:The video encoding device performs parallel encoding on the T second video segments in each of the M first video segments, including:
所述视频编码设备对所述第一视频片段i进行以下操作:The video encoding device performs the following operations on the first video segment i:
获取所述第一视频片段i的T个第二视频片段中每个第二视频片段对应的编码优先级。Obtaining an encoding priority corresponding to each of the T second video segments of the first video segment i.
根据上述第一视频片段i中的T个第二视频片段对应的编码优先级,对所述第一视频片段i的T个第二视频片段进行并行编码,以得到T个第二码流数据。And encoding, according to the coding priority corresponding to the T second video segments in the first video segment i, the T second video segments of the first video segment i to obtain T second code stream data.
具体地,上述视频编码设备根据将上述第一视频片段i中的每帧第一图像划分为T帧第二图像的划分顺序确定由N帧第二图像组成的第二视频片段的编码优先级;任一第二视频片段i的N帧第二图像的划分顺序越靠前,该第二视频片段i的编码优先级越高。Specifically, the video encoding apparatus determines, according to a division order in which the first image of each frame in the first video segment i is divided into the second image of the T frame, the coding priority of the second video segment composed of the second image of the N frames; The higher the division order of the N frames second image of any second video segment i, the higher the coding priority of the second video segment i.
举例说明,假设上述第一视频片段i包括5帧第一图像。上述视频编码设备按照图3所示的方法将上述第一视频片段i的每帧第一图像划分为6帧第二图像,并对上述第一视频片段i的每帧第一图像对应的6帧第二图像进行编号。上述视频编码设备将对编号相同的5帧图像进行组合,得到6个第二视频片段。该6个第二视频片段的编码优先级,由编号为1的5帧第二图像组成的第二视频片段的编码优先级最高;由编号为6的5帧第二图像组成的第二视频片段的编码优先级最低。For example, assume that the first video segment i described above includes five frames of the first image. The video encoding device divides the first image of each frame of the first video segment i into 6 frames of the second image according to the method shown in FIG. 3, and 6 frames corresponding to the first image of each frame of the first video segment i The second image is numbered. The above video encoding apparatus combines five frames of images of the same number to obtain six second video segments. The encoding priority of the 6 second video segments, the second video segment consisting of the 5 frames second image numbered 1 having the highest encoding priority; the second video segment consisting of the 5 frames second image numbered 6 The encoding has the lowest priority.
按照上述方法,上述视频编码设备获取上述第一视频片段i的T个第二视频片段对应的编码优先级。
According to the above method, the video encoding device acquires the coding priority corresponding to the T second video segments of the first video segment i.
进一步地,在获取上述第一视频片段i的T个第二视频片段对应的编码优先级后,上述视频编码设备根据上述第一视频片段i的T个第二视频片段对应的编码优先级对该第一视频片段的T个第二视频片段的并行编码。Further, after acquiring the coding priority corresponding to the T second video segments of the first video segment i, the video encoding device according to the coding priority corresponding to the T second video segments of the first video segment i Parallel encoding of T second video segments of the first video segment.
具体地,上述视频片段编码设备包括S个子视频片段编码模块,S为大于1的整数。当该S大于T时即上述子视频编码模块的数量S大于上述第一视频片段i包括的第二视频片段的个数T时,上述S个子视频编码模块中的任意T个子视频编码设备对上述T个第二视频片段进行并行编码,得到T个第二码流数据,而不用根据上述T个第二视频片段的编码优先级进行进行编码以得到T个第二码流数据。当上述S小于上述T即上述视频编码设备的子视频编码模块的数量S小于上述第一视频片段i包括的第二视频片段的个数T时,上述S个子视频编码模块首先并行对上述视频片段i的T个第二视频片段中,编码优先级较高的S个第二视频片段进行并行编码。当上述S个子视频编码模块的任意一个完成对第二视频片段编码后,该子视频编码模块对上述T个子视频片段中未被编码的子视频片段中,编码优先级较高的一个第二视频片段进行编码。以此类推,上述S个子视频编码设备完成对上述第一视频片段i的编码,得到T个第二码流数据。Specifically, the video segment encoding apparatus includes S sub-video segment encoding modules, and S is an integer greater than 1. When the S is greater than T, that is, the number S of the sub video coding modules is greater than the number T of the second video segments included in the first video segment i, any T sub video coding devices in the S sub video coding modules are The T second video segments are coded in parallel to obtain T second code stream data without encoding according to the coding priorities of the T second video segments to obtain T second code stream data. When the S is smaller than the T, that is, the number S of the sub video encoding modules of the video encoding device is smaller than the number T of the second video segments included in the first video segment i, the S sub video encoding modules firstly parallel the video segments. Among the T second video segments of i, the S second video segments with higher priority are encoded for parallel encoding. After the encoding of the second video segment is completed by any one of the S sub-video encoding modules, the sub-video encoding module encodes a second video with a higher priority among the sub-video segments that are not encoded in the T sub-video segments. The fragment is encoded. By analogy, the S sub-video encoding devices complete encoding the first video segment i to obtain T second code stream data.
其中,上述视频编码设备对上述T个子视频片段采用预设编码模式进行编码。The video encoding device encodes the T sub-video segments by using a preset encoding mode.
可选地,上述预设编码模式可为全I帧(All Intra,AI)模式、低时延(Low Delay,LD)模式、随机访问(Random Access,RA)模式或者其他编码模式。Optionally, the foregoing preset coding mode may be an All Intra (AI) mode, a Low Delay (LD) mode, a Random Access (RA) mode, or another coding mode.
其中,上述视频编码设备的S个子视频编码模块可以为一个计算机群中的S个计算机;还可为多核处理器中的S核处理器;还可以为多线程中的S个线程;还可为上述计算机群、多核处理器、多线程和其他视频编码硬件模块的任意组合。The S sub-video encoding modules of the video encoding device may be S computers in a computer group; may also be S-core processors in a multi-core processor; or may be S threads in multiple threads; Any combination of the above computer clusters, multi-core processors, multi-threading, and other video encoding hardware modules.
举例说明,假设上述视频编码设备有6个子视频编码模块,上述视频编码设备将第一视频片段i划分为10个第二视频片段,分别为第二视频片段B1、B2、B3、B4、B5、B6、B7、B8、B9和B10,并且该10个第二视频片段的编码优先级依次降低。根据这10个子视频片段的编码优先级,上述6个子视频编码模块首先分别针对上述子视频片段B1、B2、B3、B4、B5、B6进行并行编码。当上述6个子视频编码模块中的任意一个子视频编码模块完成对一个第一视频片段的编码后,该子视频编码模块对上述第二视频片段B7、B8、B9、和B10中编码优先级较高的第二视频片段进行编码。按照上述方法,以此类推,直至完成对上述10个第二视频片段的编码,以得到10个第二码流数据。For example, it is assumed that the video encoding device has six sub video encoding modules, and the video encoding device divides the first video segment i into ten second video segments, which are respectively the second video segments B1, B2, B3, B4, and B5. B6, B7, B8, B9, and B10, and the coding priorities of the 10 second video segments are sequentially lowered. Based on the coding priorities of the 10 sub video segments, the six sub video coding modules first perform parallel coding on the sub video segments B1, B2, B3, B4, B5, and B6, respectively. After the encoding of a first video segment is performed by any one of the six sub video encoding modules, the sub video encoding module compares the encoding priorities of the second video segments B7, B8, B9, and B10. The high second video segment is encoded. According to the above method, and so on, until the encoding of the above 10 second video segments is completed, to obtain 10 second code stream data.
按照上述方法,上述视频编码设备获取上述M个第一视频片段中每个第一视频片段的T个第二视频片段的第二码流数据,以得到M*T个第二码流数据。According to the above method, the video encoding device acquires second code stream data of T second video segments of each of the M first video segments to obtain M*T second code stream data.
S204、所述视频编码设备对所述M*T个第二码流数据进行整合,以得到所述源视频的码流S204. The video encoding device integrates the M*T second code stream data to obtain a code stream of the source video.
其中,任一第二码流数据包括一组图像头和一组图像数据;所述视频编码设备对所述M*T个码流数据进行整合,得到所述源视频的码流,包括:The second code stream data includes a set of image headers and a set of image data; the video encoding device integrates the M*T code stream data to obtain a code stream of the source video, including :
所述视频编码设备将所述M个第一视频片段中的每个第一视频片段的T个第二码流数据进行整合以得到M个第一码流数据,其中,一个第一视频片段的T个第二码流数据整合得到一个第一码流数据;The video encoding device integrates T second code stream data of each of the M first video segments to obtain M first code stream data, where a first video segment is Integrating T pieces of second stream data to obtain a first stream data;
所述视频编码设备将所述序列头、所述M个第一码流数据和序列终止码整合成所述源
视频的码流。The video encoding device integrates the sequence header, the M first code stream data, and a sequence termination code into the source
The stream of video.
进一步地,任一第二码流数据包括一组图像头和一组图像数据,所述视频编码设备将所述M个第一视频片段中的每个第一视频片段的T个第二码流数据进行整合以得到M个第一码流数据,包括:Further, any second code stream data includes a set of image headers and a set of image data, and the video encoding device sets T second of each of the M first video segments The code stream data is integrated to obtain M first code stream data, including:
所述视频编码设备对所述第一视频片段i进行如下操作:The video encoding device performs the following operations on the first video segment i:
获取所述第一视频片段i的对应的T个第二码流数据中每个第二码流数据的编码优先级,所述第二码流数据的编码优先级与其对应的第二视频片段的编码优先级一致;Obtaining an encoding priority of each second code stream data of the corresponding T second code stream data of the first video segment i, the encoding priority of the second code stream data and the corresponding second video segment thereof The coding priority is consistent;
根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的编码优先级,确定所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序;其中,所述第二码流数据的编码优先级越高,所述第二码流数据的图像数据的整合顺序越靠前;Determining, according to an encoding priority of each second code stream data of the T second code stream data corresponding to the first video segment i, each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;
根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序将所述所述第一视频片段i对应的T个第二码流数据的图像数据整合为一个第一码流数据的图像数据,并将所述第一视频片段i对应的T个第二码流数据中任一第二码流数据的一组图像头和所述第一码流数据的图像数据整合一个所述第一码流数据,其中,每个所述第一码流数据包括一组所述图像头和T组图像数据,所述T个第二码流数据对应的T个第二视频片段属于同一个第一视频片段。And according to the integration order of the image data of each of the T second code stream data corresponding to the first video segment i, the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data The image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes The T second video segments corresponding to the stream data belong to the same first video segment.
需要说明的是,上述一组图像头包括N个图像头,一组图像数据包括N个图像数据。It should be noted that the above set of image headers includes N image headers, and the set of image data includes N image data.
可选地,上述一个第一视频片段j对应的第一码流数据的格式可为:Optionally, the format of the first code stream data corresponding to the first video segment j may be:
H1(D11D12D13…D1T-1D1T)…Hk(Dk1Dk2Dk3…DkT-1DkT)…HN(DN1DN2DN3…DNT-1DNT)H 1 (D 11 D 12 D 13 ... D 1T-1 D 1T )...H k (D k1 D k2 D k3 ... D kT-1 D kT )...H N (D N1 D N2 D N3 ... D NT-1 D NT )
或者为:Or for:
H1H2…HN(D11D21D31…DN-11DN1)…(D1kD2kD3k…DN-1kDNk)…(D1TD2TD3T…DN-1TDNT)H 1 H 2 ... H N (D 11 D 21 D 31 ... D N-11 D N1 ) (D 1k D 2k D 3k ... D N-1k D Nk ) (D 1T D 2T D 3T ... D N- 1T D NT )
其中,上述H1,H2,…,HN分别为上述第一视频片段j中N帧第一图像的图像头,上述Dk1Dk2Dk3…DkT-1DkT分别为上述第一视频片段j中第k帧第一图像对应的T帧第二图像的图像数据,上述D1kD2kD3k…DN-1kDNk分别为上述第一视频片段j中第k个第二视频片段的N帧第二图像对应的图像数据。Wherein, H 1 , H 2 , . . . , H N are respectively image headers of the first image of N frames in the first video segment j, and the D k1 D k2 D k3 ... D kT-1 D kT are respectively the first image The image data of the second image of the T frame corresponding to the first image of the kth frame in the video segment j, the above D 1k D 2k D 3k ... D N-1k D Nk are respectively the kth second video in the first video segment j Image data corresponding to the N image of the second image of the segment.
举例说明,假设上述一个第一视频片段有3帧第一图像,分别标记1、2、3,且该第一视频片段被划分为2个第二视频片段,分别为I、II。上述视频编码设备对上述第一视频片段进行编码,得到3个图像头,6个第二图像对应的图像数据。上述视频编码设备将该3个图像头和6个第二图像对应的图像数据整合成一个第一码流数据。该第一码流数据的格式为:H1(I1II1)H2(I2II2)H3(I3II3),具体可参见图4。上述第一码流数据的格式还可为:H1H2H3(I1I2I3)(II1II2II3),具体可参见图5。其中,上述H1、H2、H3分别为上述3帧第一图像的图像头,上述图像数据I1、II1分别为上述第一视频片段中第一帧第一图像的两帧第二图像的图像数据,上述图像数据I2、II2分别为上述第一视频片段中第二帧第一图像的两帧第二图像的图像数据,上述图像数据I3、II3分别为上述第一视频片段中第三帧第一图像的两帧第二图像的图像数据。For example, it is assumed that the first video segment has three frames of the first image, respectively labeled 1, 2, and 3, and the first video segment is divided into two second video segments, which are I and II, respectively. The video encoding device encodes the first video segment to obtain image data corresponding to three image headers and six second images. The video encoding device integrates the image data corresponding to the three image headers and the six second images into one first code stream data. The format of the first code stream data is: H1(I1II1)H2(I2II2)H3(I3II3), as shown in FIG. The format of the first code stream data may also be: H1H2H3 (I1I2I3) (II1II2II3), as shown in FIG. 5. The H1, H2, and H3 are image headers of the first frame of the three frames, and the image data I1 and II1 are image data of two frames of the second image of the first frame of the first video segment, respectively. The image data I2 and II2 are image data of two frames of the second image of the first image of the second frame in the first video segment, and the image data I3 and II3 are respectively the first image of the third frame of the first video segment. The image data of the second image of the two frames.
需要说明的是,上述视频编码设备对上述一帧第二图像完成编码后,得到一个图像头和一个图像数据;上述视频编码设备对上述一个第二视频片段完成编码后,得到一组图像
头和一组图像数据,一组图像头包括N个图像头,一组图像数据包括N个图像数据。上述视频编码设备对一个第一视频片段完成编码后,得到T组图像头和T组图像数据。由于属于同一帧第一图像的T帧第二图像的图像头相同,因此上述视频编码设备只保留一组图像头,上述一个第一视频片段对应的码流数据包括一组图像头和T组图像数据。It should be noted that, after the video encoding device performs encoding on the second image of the foregoing frame, an image header and an image data are obtained; and the video encoding device performs encoding on the second video segment to obtain a group of images.
A header and a set of image data, a set of image headers comprising N image headers, and a set of image data comprising N image data. After the video encoding device finishes encoding a first video segment, the T group image header and the T group image data are obtained. Since the image headers of the second image of the T frame belonging to the first image of the same frame are the same, the video encoding device retains only one set of image headers, and the code stream data corresponding to the first video segment includes a set of image headers and T Group image data.
具体地,上述视频编码设备根据任一第一视频片段i的T个第二视频片段对应的编码优先级,确定上述第一视频片段i的T个第二视频片段对应的第二码流数据中图像数据的整合顺序,并根据该整合顺序,将上述第一视频片段i的T个第二视频片段对应的第二码流数据中的图像数据整合在一起,得到上述第一视频片段i对应的第一码流数据的图像数据;然后将上述第一视频片段的T个第二视频片段对应的第二码流数据中的任意一组图像头与上述第一视频片段i对应的第一码流数据的图像数据整合在一起,得到上述第一视频片段i的第一码流数据;Specifically, the video encoding device determines, according to the coding priority corresponding to the T second video segments of any of the first video segments i, the second code stream data corresponding to the T second video segments of the first video segment i. Integrating the image data in the order of integration, and integrating the image data in the second code stream data corresponding to the T second video segments of the first video segment i according to the integration sequence, to obtain the corresponding first video segment i Image data of the first code stream data; then, the first code corresponding to the first video segment i of any one of the second code stream data corresponding to the T second video segments of the first video segment The image data of the stream data is integrated to obtain the first stream data of the first video segment i;
上述视频编码设备按照上述方法获取上述M个第一视频片段的每个第一视频片段的第二码流数据整合得到的第一码流数据,以得到M个第一码流数据。上述视频编码设备根据上述M个第一视频片段的划分顺序,将M个第一码流数据整合成上述源视频的码流数据。上述视频编码设备将上述源视频的码流数据,序列头和序列终止码整合成上述源视频的码流。The video encoding device obtains the first code stream data obtained by integrating the second code stream data of each of the first video segments of the M first video segments according to the foregoing method, to obtain M first code stream data. The video encoding apparatus integrates the M first code stream data into the code stream data of the source video according to the division order of the M first video segments. The video encoding device integrates the code stream data, the sequence header and the sequence termination code of the source video into the code stream of the source video.
上述原始视频的码流格式如下:The code stream format of the above original video is as follows:
S1H11H12…H1N(D1
11D1
12…D1
1N)…(Dm
11Dm
12…Dm
1N)…(DT
11DT
12…DT
1N)H21H22…H2N(D1
21D1
22…D1
2N)…(Dm
21Dm
22…Dm
2N)…(DT
21DT
22…DT
2N)…Hn1Hn2…HnN(D1
n1D1
n2…D1
nN)…(Dm
n1Dm
n2…Dm
nN)…(DT
n1DT
n2…DT
nN)…HM1HM2…HMN(D1
M1D1
M2…D1
MN)…(Dm
M1Dm
M2…Dm
MN)…(DT
M1DT
M2…DT
MN)S2S1H 11 H 12 ... H 1N (D 1 11 D 1 12 ... D 1 1N ) (D m 11 D m 12 ... D m 1N ) (D T 11 D T 12 ... D T 1N ) H 21 H 22 ... H 2N (D 1 21 D 1 22 ... D 1 2N ) (D m 21 D m 22 ... D m 2N ) (D T 21 D T 22 ... D T 2N )...H n1 H n2 ... H nN (D 1 n1 D 1 n2 ... D 1 nN ) (D m n1 D m n2 ... D m nN ) (D T n1 D T n2 ... D T nN )...H M1 H M2 ... H MN (D 1 M1 D 1 M2 ... D 1 MN )...(D m M1 D m M2 ... D m MN )...(D T M1 D T M2 ... D T MN )S2
其中,上述S1为上述源视频的序列头,上述S2为上述源视频的序列终止码;上述H11H12…H1N分别为上述源视频的第1个第一视频片段中的N帧第一图像的图像头,上述Dm
11Dm
12…Dm
1N分别为上述源视频的第1个第一视频片段中的编号为m的N帧第二图像的图像数据;上述H21H22…H2N分别为上述源视频的第2个第一视频片段中的N帧第一图像的图像头,上述Dm
21Dm
22…Dm
2N分别为上述源视频的第2个第一视频片段中的编号为m的N帧第二图像的图像数据;上述Hn1Hn2…HnN分别为上述源视频的第n个视频片段中的N帧图像的第一图像头,上述Dm
n1Dm
n2…Dm
nN分别为上述源视频的第n个视频片段中的编号为m的N帧第二图像的图像数据;上述HM1HM2…HMN分别为上述源视频的第M个视频片段中的N帧第一图像的图像头,上述Dm
M1Dm
M2…Dm
MN分别为上述源视频的第M个视频片段中的编号为m的N帧第二图像的图像数据;上述m为大于0且小于或者等于T的整数,上述n为大于0且小于或者等于M的整数。The S1 is a sequence header of the source video, and the S2 is a sequence termination code of the source video; and the H 11 H 12 ... H 1N are respectively N frames in the first first video segment of the source video. The image header of the image, the above D m 11 D m 12 ... D m 1N are respectively the image data of the N image of the second image of the first first video segment of the source video, which is numbered m; the above H 21 H 22 ... H 2N is an image header of an N-frame first image in the second first video segment of the source video, and the D m 21 D m 22 ... D m 2N are respectively the second first video segment of the source video. The image data of the second image of the N frames of the number m; the H n1 H n2 ... H nN are the first image headers of the N frames of the nth video segment of the source video, respectively, the D m n1 D m n2 ... D m nN are respectively image data of an N-frame second image numbered m in the nth video segment of the source video; the above H M1 H M2 ... H MN are respectively the Mth video of the source video first image segment of the first image frame N, the above-described D m M1 D m M2 ... D m MN respectively above the m video source video The image data of the second image segment of N frames numbered m; m is greater than the above 0 and less than or equal to the integer T, the number n is greater than 0 and less than or equal to the integer M.
可选地,所述视频编码设备根据配置信息生成所述源视频码流的序列头之后,所述方法还包括:Optionally, after the video encoding device generates the sequence header of the source video code stream according to the configuration information, the method further includes:
所述视频编码设备在所述序列头中添加用于指示所述预设分辨率的第一语法元素和用于指示所述第一视频片段中包括的所述第一图像的帧数N的第二语法元素。The video encoding apparatus adds, in the sequence header, a first syntax element for indicating the preset resolution and a number of frames N for indicating the first image included in the first video segment. Two syntax elements.
举例说明,当上述第一语法元素所指示的值为0时,则上述预设分辨率为64*64;上述第一语法元素所指示的值为1时,则上述预设分辨率为128*128;上述第一语法元素所
指示的值为2时,则上述预设分辨率为256*256。For example, when the value indicated by the first syntax element is 0, the preset resolution is 64*64; when the value indicated by the first syntax element is 1, the preset resolution is 128*. 128; the first syntax element above
When the value of the indication is 2, the above preset resolution is 256*256.
需要说明的是,上述第一语法元素和上述第二语法元素均为若干比特位数据。It should be noted that the first syntax element and the second syntax element are both bit data.
可以看出,在本发明实施例的方案中,上述视频编码设备将源视频划分为M个第一视频片段,然后将上述M个第一视频片段中的每个第一视频片段划分为T个第二视频片段。上述视频编码设备对上述每个第一视频片段的T个第二视频片段进行并行编码,得到M*T个第二码流数据;上述视频编码设备将上述M*T个第二码流数据整合成M个第一码流数据,然后将源视频的序列头、M个第一码流数据和序列终止码整合成源视频的码流。与现有技术相比,本发明对一个视频片段的多个第二视频片段进行并行编码,提高了视频编码的效率,提高了用户体验。It can be seen that, in the solution of the embodiment of the present invention, the video encoding device divides the source video into M first video segments, and then divides each of the M first video segments into T segments. The second video clip. The video encoding device performs parallel encoding on the T second video segments of each of the first video segments to obtain M*T second code stream data; and the video encoding device integrates the M*T second code streams data. The M first stream data is then integrated into the sequence of the source video, the M first stream data, and the sequence termination code into a stream of the source video. Compared with the prior art, the present invention performs parallel coding on multiple second video segments of one video segment, which improves the efficiency of video coding and improves the user experience.
参见图6,图6为本发明实施例提供的一种视频解码方法的流程示意图。如图6所示,该方法包括:Referring to FIG. 6, FIG. 6 is a schematic flowchart diagram of a video decoding method according to an embodiment of the present invention. As shown in FIG. 6, the method includes:
S601、视频解码设备从源视频的码流中获取所述源视频的码流数据。S601. The video decoding device acquires code stream data of the source video from a code stream of the source video.
其中,所述原始视频的码流数据为不包括序列头和序列终止码的所述原始视频的码流。The code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code.
S602、所述视频解码设备将所述源视频的码流数据平均划分为M个第一码流数据,并将所述M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,以得到M*T个第二码流数据。S602. The video decoding device divides the code stream data of the source video into M first code stream data, and expands each first code stream data of the M first code stream data into T The second code stream data is obtained to obtain M*T second code stream data.
其中,所述视频解码设备将源视频的码流数据平均划分为M个第一码流数据之前,所述方法还包括:The method further includes: before the video decoding device divides the code stream data of the source video into the M first code stream data, the method further includes:
所述视频解码设备从所述源视频的码流中获取序列头;The video decoding device acquires a sequence header from a code stream of the source video;
所述视频解码设备根据所述源视频的分辨率和所述序列头中的第一语法元素所指示的预设分辨率获取第一码流数据可扩展成第二码流数据的个数T。The video decoding device acquires the number T of the first code stream data that can be expanded into the second code stream data according to the resolution of the source video and the preset resolution indicated by the first syntax element in the sequence header.
具体地,上述源视频的分辨率为W*H,上述预设分辨率为w*h,上述第一码流数据可扩展成第二码流数据的个数T=([W/w]+1)*([H/h]+1),其中,W大于或者等于w,H大于或者等于h。Specifically, the resolution of the source video is W*H, and the preset resolution is w*h, and the first code stream data can be expanded into the number of second code stream data T=([W/w]+ 1) *([H/h]+1), where W is greater than or equal to w, and H is greater than or equal to h.
需要指出的是,上述第一语法元素为若干比特位数据。It should be noted that the above first syntax element is a number of bit data.
其中,每个所述第一码流数据包括一组图像头和T组图像数据,所述将所述M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,包括:Each of the first code stream data includes a set of image headers and T sets of image data, and the first code stream data of the M first code stream data is expanded to T seconds. Code stream data, including:
所述视频解码设备对所述M个第一码流数据中的第一码流数据i的一组图像头进行复制以得到T组图像头;The video decoding device copies a set of image headers of the first code stream data i of the M first code stream data to obtain a T group image header;
所述视频解码设备根据所述T组图像头和所述第一码流数据i的T组图像数据,扩展得到T个第二数据码流;The video decoding device expands to obtain T second data code streams according to the T group image header and the T group image data of the first code stream data i;
所述视频解码设备获取所述M个第一码流数据的每个第一码流数据对应的T个第二码流数据,以得到M*T个第二码流数据,The video decoding device acquires T second code stream data corresponding to each first code stream data of the M first code stream data, to obtain M*T second code stream data,
其中,任一第二码流数据包括一组图像头和一组图像数据,所述第一码流数据i为所述M个第一码流数据中的任意一个。The second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
具体地,上述视频解码设备将上述源视频的码流数据平均划分为M个第一码流数据。上述M个第一码流数据中的每个第一码流数据包括一组图像头和T组图像数据。上述视频
解码设备将任一第一码流数据i中的一组图像头进行复制,得到T组图像头,然后将该T组图像头和上述第一码流数据i中的T组图像数据进行扩展,得到T个第二码流数据,每个第二码流数据包括一组图像头和一组图像数据。Specifically, the video decoding device divides the code stream data of the source video into M first code stream data. Each of the M first stream data includes a set of image headers and T sets of image data. Above video
The decoding device copies a set of image headers in any of the first code stream data i to obtain a T group image header, and then the T group image header and the T group image in the first code stream data i The data is expanded to obtain T second code stream data, and each second code stream data includes a set of image headers and a set of image data.
按照上述方法,上述视频解码设备获取上述M个第一码流数据中每个第一码流数据对应的T个第二码流数据,以得到M*T个第二码流数据。According to the above method, the video decoding device acquires T second code stream data corresponding to each first code stream data of the M first code stream data to obtain M*T second code stream data.
S603、所述视频解码设备对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码,以得到M*T个第二视频片段。S603. The video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first code stream data to obtain M*T second video segments.
其中,所述视频解码设备对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码之前,所述方法还包括:Before the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data, the method further includes:
所述视频解码设备剔除所述序列头中的所述第一语法元素和第二语法元素,所述第二语法元素用于指示所述第二视频片段中包括的第二图像的帧数N。The video decoding device culls the first syntax element and the second syntax element in the sequence header, and the second syntax element is used to indicate a frame number N of a second image included in the second video segment.
其中,所述视频解码设备对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码,包括:The video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data, including:
所述视频编码设备对所述M个第一码流数据中的第一码流数据i进行以下操作:The video encoding device performs the following operations on the first code stream data i of the M first code stream data:
获取所述第一码流数据i的T个第二码流数据中每个第二码流数据对应的解码优先级;Obtaining a decoding priority corresponding to each second code stream data of the T second code stream data of the first code stream data i;
根据所述第一码流数据i的T个第二码流数据对应的解码优先级,对所述第一码流数据i的T个第二码流数据进行并行解码,以得到T个第二视频片段;Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip
其中,所述第一码流数据i为所述M个第一码流数据中的任意一个。The first code stream data i is any one of the M first code stream data.
进一步地,上述视频解码设备确定上述第一码流数据i对应的T个第二码流数据的对应的解码优先级后,上述视频解码设备根据上述第一码流数据i对应的T个第二码流数据的对应的解码优先级对上述第一码流数据i对应的T个第二码流数据进行并行解码。Further, after the video decoding device determines the corresponding decoding priority of the T second code stream data corresponding to the first code stream data i, the video decoding device performs T seconds corresponding to the first code stream data i. The corresponding decoding priority of the code stream data performs parallel decoding on the T second code stream data corresponding to the first code stream data i.
具体地,上述视频解码设备包括S个子视频解码模块,S为大于0的整数。当该S大于T时,上述S个子视频解码模块中的T个子视频解码设备对上述第一视频码流数据i对应的T个第二码流数据进行并行解码,得到T个第二视频片段。当上述S小于上述T时,上述S个子视频解码模块首先并行对上述第一视频码流数据i对应的T个第二码流数据中,解码优先级较高的S个第二码流数据进行并行解码。当上述S个子视频解码模块的任意一个子视频解码模块完成对第二码流数据完成解码后,该子视频解码模块对上述T个第二码流数据中未被解码的第二码流数据中,解码优先级较高的一个第二码流数据进行解码。以此类推,上述S个子视频解码设备完成对上述第一视频码流数据i对应的T个第二码流数据后,得到T个第二视频片段。Specifically, the video decoding device includes S sub-video decoding modules, and S is an integer greater than 0. When the S is greater than T, the T sub video decoding devices of the S sub video decoding modules perform parallel decoding on the T second code stream data corresponding to the first video stream data i to obtain T second video segments. When the S is smaller than the T, the S sub-video decoding module first performs parallel decoding on the S second code stream data corresponding to the first video stream data i, and decoding the S second code stream data with higher priority. Parallel decoding. After the sub-video decoding module of the S sub-video decoding module completes decoding the second code stream data, the sub-video decoding module performs the second code stream data that is not decoded in the T second code stream data. And decoding a second code stream data with a higher priority for decoding. And so on, after the S sub-video decoding devices complete the T second code stream data corresponding to the first video stream data i, obtain T second video segments.
其中,上述视频解码设备的S个子视频解码模块可以为一个计算机群中的S个计算机;还可为多核处理器中的S核处理器;还可以为多线程中的S个线程;还可为上述计算机群、多核处理器、多线程和视频解码硬件模块的任意组合。The S sub-video decoding modules of the video decoding device may be S computers in a computer group; may also be S-core processors in a multi-core processor; or may be S threads in multiple threads; Any combination of the above computer clusters, multi-core processors, multi-threading, and video decoding hardware modules.
按照上述方法,上述视频解码设备获取上述M个第一码流数据中每个第一码流数据的对应的T个第二视频片段,以得到M*T个第二视频片段。According to the above method, the video decoding device acquires corresponding T second video segments of each of the M first code stream data to obtain M*T second video segments.
S604、所述视频解码设备对所述M*T个第二视频片段进行拼接,以得到所述源视频。S604. The video decoding device splices the M*T second video segments to obtain the source video.
其中,任一第二视频片段包括N帧第二图像,所述视频解码设备对所述M*T个第二视频片段进行拼接,以得到所述源视频,包括:
The second video segment includes an N-frame second image, and the video decoding device splices the M*T second video segments to obtain the source video, including:
所述视频解码设备将所述M个第一码流数据中的每个第一码流数据对应的T个第二视频片段中的N*T帧第二图像中,图像头相同的每T帧第二图像拼接在一起,得到M个第一视频片段,所述M个第一视频片段中的每个第一视频片段包括N帧第一图像,所述第一图像的分辨率大于所述第二图像的分辨率;The video decoding device, in the second image of the N*T frames in the T second video segments corresponding to each of the M first stream data, each T frame of the same image header The second images are stitched together to obtain M first video segments, each of the first video segments includes an N-frame first image, and the resolution of the first image is greater than the first image The resolution of the two images;
所述视频解码设备对所述M个第一视频片段进行拼接,以得到所述源视频。The video decoding device splices the M first video segments to obtain the source video.
具体地,上述任一第二视频片段包括N帧第二图像,上述任一第一码流数据对应的T个第二视频片段中包括N*T帧第二图像。由于属于同一帧第一图像的T帧第二图像具有相同的图像头,因此上述视频解码设备将上述N*T帧第二图像中,图像头相同的T帧第二图像拼接在一起,得到一个第一视频片段。该第一视频片段包括N帧第一图像,该第一图像分辨率大于上述第二图像的分辨率。Specifically, any of the second video segments includes an N-frame second image, and the T second video segments corresponding to any of the first code stream data include an N*T frame second image. Since the second image of the T frame belonging to the first image of the same frame has the same image header, the video decoding device splices the second image of the T frame with the same image header in the second image of the N*T frame to obtain a The first video clip. The first video segment includes an N frame of the first image, the first image resolution being greater than the resolution of the second image.
按照上述方法,上述视频解码设备获取上述M个第一码流数据中每个第一码流数据对应的T个视频片段拼接得到的第一视频片段,以得到M个第一视频片段;上述视频解码设备根据M个第一视频片段的划分顺序,将M个第一视频片段拼接在一起,得到上述源视频。According to the above method, the video decoding device acquires the first video segment obtained by splicing the T video segments corresponding to each of the first code stream data, to obtain M first video segments; The decoding device splices the M first video segments together according to the division order of the M first video segments to obtain the source video.
可以看出,在本发明实施例的方案中,上述视频解码设备从源视频的码流中获取源视频的码流数据,并将源视频的码流数据平均划分为M个第一码流数据,然后将该M个第一码流数据的每个第一码流数据扩展为T个第二码流数据。上述视频解码设备对上述每个第一码流数据的T个第二码流数据进行并行解码,得到M*T个第二视频片段。然后将M*T个第二视频片段拼接得到源视频。与现有技术相比,本发明对一个视频片段的多个子视频片段进行并行解码,提高了视频解码的效率;并且在对该视频片段的多个子视频完成解码后,可以直接显示该视频片段,提高了用户体验。It can be seen that, in the solution of the embodiment of the present invention, the video decoding device obtains the code stream data of the source video from the code stream of the source video, and divides the code stream data of the source video into M first code stream data. And then expanding each of the first code stream data of the M first code stream data into T second code stream data. The video decoding device performs parallel decoding on the T second code stream data of each of the first code stream data to obtain M*T second video segments. The M*T second video segments are then spliced to obtain the source video. Compared with the prior art, the present invention performs parallel decoding on multiple sub-video segments of a video segment, thereby improving the efficiency of video decoding; and after decoding multiple sub-videos of the video segment, the video segment can be directly displayed. Improve the user experience.
在一个具体的应用场景中,假设分辨率为416*240的源视频包括20帧第一图像,视频编码设备将该源视频划分为4个的第一视频片段,每个第一视频片段中包括5帧第一图像,且该5帧第一图像是连续帧图像。上述视频编码设备按照预设分辨率128*128将上述4个第一视频片段中的每个第一视频片段划分为8个第二视频片段,以得到32个第二视频片段。对上述源视频的20帧第一图像来说,上述视频编码设备将每帧第一图像划分为8帧第二图像。如图所示图7所示,上述视频编码设备按照预设分辨率128*128将分辨率为416*240的第一图像划分为8帧第二图像,该8帧第二图像包括3帧分辨率为128*128的第二图像,3帧分辨率为128*112的第二图像、1帧分辨率为32*128的第二图像和一帧分辨率为32*112的第二图像。上述视频编码设备对该8帧第二图像从左到右,从上到下依次编号为A,B,C,D,E,F,G,I。对于每个第一视频片段对应的8个第二视频片段,每个第二视频片段包括编号相同的5帧第二图像。In a specific application scenario, it is assumed that the source video with a resolution of 416*240 includes 20 frames of the first image, and the video encoding device divides the source video into four first video segments, each of which includes 5 frames of the first image, and the 5 frames of the first image are consecutive frame images. The video encoding device divides each of the four first video segments into eight second video segments according to a preset resolution of 128*128 to obtain 32 second video segments. For the 20 frames of the first image of the source video, the video encoding device divides the first image of each frame into 8 frames of the second image. As shown in FIG. 7, the video encoding device divides the first image with a resolution of 416*240 into a second image of 8 frames according to a preset resolution of 128*128, and the second image of the 8 frames includes 3 frames. The second image is 128*128, the second image with a frame resolution of 128*112, the second image with a frame resolution of 32*128, and the second image with a frame resolution of 32*112. The video encoding device numbers the second image of the 8 frames from left to right, and from top to bottom, A, B, C, D, E, F, G, I. For each of the 8 second video segments corresponding to each first video segment, each second video segment includes 5 frames of the second image with the same number.
在对上述第一视频片段的对应的8个第二视频片段进行并行编码之前,上述视频编码设备根据配置信息生成序列头。Before the parallel coding of the corresponding 8 second video segments of the first video segment, the video encoding device generates a sequence header according to the configuration information.
假设上述4个第一视频片段中的任意一个为第一视频片段A,上述视频编码设备确定该第一视频片段A的8个第二视频片段的编码优先级。如图所示图7所示,第一视频片段A中的8个第二视频片段的编码优先级从左到右,从上到下,依次降低。上述视频编码设
备根据编码优先级对第一视频片段A中的8个第二视频进行并行编码。在完成编码后,得到8组图像头和8组图像数据,每组图像头包括5个图像头,每组图像数据包括5个图像数据。由于属于同一帧第一图像的8帧第二图像具有相同的图像头,因此上述视频编码设备对于上述8组图像头,只保留一组图像头。上述视频编码设备将该一组图像头和8组图像数据整合成第一视频片段A的第一码流数据。该视第一频片段A的第一码流数据的格式如下:It is assumed that any one of the above four first video segments is the first video segment A, and the video encoding device determines the coding priority of the eight second video segments of the first video segment A. As shown in FIG. 7, the coding priority of the eight second video segments in the first video segment A is sequentially lowered from left to right and from top to bottom. The above video coding design
The eight second videos in the first video segment A are encoded in parallel according to the coding priority. After the encoding is completed, 8 sets of image headers and 8 sets of image data are obtained, each set of image headers including 5 image headers, and each set of image data includes 5 image data. Since the 8 frames of the second image belonging to the first image of the same frame have the same image header, the above video encoding apparatus retains only one set of image headers for the above-mentioned 8 sets of image headers. The video encoding apparatus integrates the set of image headers and the eight sets of image data into the first stream data of the first video clip A. The format of the first code stream data of the first frequency segment A is as follows:
H1(A1B1C1D1E1F1G1I1)H2(A2B2C2D2E2F2G2I2)…H5(A5B5C5D5E5F5G5I5),H1(A1B1C1D1E1F1G1I1)H2(A2B2C2D2E2F2G2I2)...H5(A5B5C5D5E5F5G5I5),
或者上述第一视频片段A的第一码流数据格式如下:Or the first code stream data format of the first video segment A is as follows:
H1H2H3H4H5(A1A2A3A4A5)(B1B2B3B4B5)…(I1I2I3I4I5),H1H2H3H4H5(A1A2A3A4A5)(B1B2B3B4B5)...(I1I2I3I4I5),
其中,上述H1,H2,H3,H4,H5分别为上述第一视频片段A中的5帧第一图像的图像头,即上述一组图像头,上述A1,B1,C1,D1,E1,F1,G1,I1分别为上述5帧第一图像中的第一帧第一图像的8帧第二图像的对应的图像数据;A2,B2,C2,D2,E2,F2,G2,I2分别为上述5帧第一图像中的第二帧第一图像的8帧第二图像的对应的图像数据;A3,B3,C3,D3,E3,F3,G3,I3分别为上述5帧第一图像中的第三帧第一图像的8帧第二图像的对应的图像数据;A4,B4,C4,D4,E4,F4,G4,I4分别为上述5帧第一图像中的第四帧第一图像的8帧第二图像的对应的图像数据;A5,B5,C5,D5,E5,F5,G5,I5分别为上述5帧第一图像中的第五帧第一图像的8帧第二图像的对应的图像数据。The above H1, H2, H3, H4, and H5 are image headers of the first frame of the five frames in the first video segment A, that is, the group of image headers, and the above-mentioned A1, B1, C1, D1, E1, F1, G1, and I1 are respectively corresponding image data of 8 frames of the second image of the first image of the first frame in the first frame of the above 5 frames; A2, B2, C2, D2, E2, F2, G2, and I2 are respectively Corresponding image data of 8 frames of the second image of the first image of the second frame in the first frame of the 5 frames; A3, B3, C3, D3, E3, F3, G3, and I3 are respectively in the first image of the above 5 frames. Corresponding image data of 8 frames of the second image of the first frame of the third frame; A4, B4, C4, D4, E4, F4, G4, and I4 are the first image of the fourth frame in the first image of the above 5 frames, respectively Corresponding image data of the 8 frames of the second image; A5, B5, C5, D5, E5, F5, G5, I5 are respectively the 8 frames of the first image of the fifth frame of the 5 frames of the first image Corresponding image data.
按照上述方法,上述视频编码设备对上述源视频的4个第一视频片段完成编码后,得到4个第一视频片段对应的4个第一码流数据。上述视频编码设备将上述序列头,44个第一码流数据和序列终止码整合在一起,得到上述源视频的码流。According to the above method, after the video encoding device performs encoding on the four first video segments of the source video, four first code stream data corresponding to the four first video segments are obtained. The video encoding device integrates the sequence header, the 44 first code stream data and the sequence termination code to obtain a code stream of the source video.
在将上述序列头,4个第一码流数据和序列终止码整合在一起之前,上述视频编码设备在上述序列头中添加用于指示上述预设分辨率128*128的第一语法元素和用于指示上述第二视频片段中第二图像帧数N的第二语法元素。Before the foregoing sequence header, the four first code stream data and the sequence termination code are integrated, the video encoding device adds a first syntax element for indicating the preset resolution 128*128 and the use in the sequence header. And a second syntax element indicating a second image frame number N in the second video segment.
在获取上述源视频的码流后,视频解码设备从该源视频的码流中解析出序列头和序列终止码。上述视频解码设备根据上述源视频的分辨率416*240和上述序列头中的第一语法元素所指示的分辨率128*128,获取每个第一视频片段中子第二视频片段的个数T。上述视频解码设备复制上述序列头,得到8个序列头。上述视频解码设备将该8个序列头中第一语法元素所指示的分辨率修分别改为128*128、128*128、128*128、32*128、128*112、128*112、128*112和112*32。上述视频解码设备将上述源视频的码流数据按照编码顺序平均划分为4个第一码流数据,接着将上述4个第一码流数据的每个第一码流数据扩展为8个第二码流数据。After acquiring the code stream of the source video, the video decoding device parses the sequence header and the sequence termination code from the code stream of the source video. The video decoding device acquires the number T of the second video segments in each of the first video segments according to the resolution 416*240 of the source video and the resolution 128*128 indicated by the first syntax element in the sequence header. . The above video decoding device copies the above sequence header to obtain 8 sequence headers. The video decoding device changes the resolution indicated by the first syntax element in the eight sequence headers to 128*128, 128*128, 128*128, 32*128, 128*112, 128*112, 128*, respectively. 112 and 112*32. The video decoding device divides the code stream data of the source video into four first code stream data according to the coding order, and then expands each first code stream data of the four first code stream data into eight second. Code stream data.
在对子视频片段的码流数据进行解码操作之前,上述视频解码设备将序列头中的第一语法元素和第二语法元素剔除。The video decoding apparatus culls the first syntax element and the second syntax element in the sequence header before performing the decoding operation on the code stream data of the sub video clip.
上述视频解码设备根据上述8个序列头,对上述4个第一码流数据中第一码流数据中的8个第二码流数据并行解码,得到4个第二视频片段组,每个第二视频片段组包括8个第二视频片段。上述视频解码设备将上述4个第一视频片段组中的每个第一视频片段组的8个第二视频片段的具有相同图像头的第二图像拼接在一起,得到4个第一视频片段,并对4个视频片段中的第一图像进行平滑滤波。
The video decoding device performs parallel decoding on the eight second code stream data in the first code stream data in the four first code stream data according to the eight sequence headers, to obtain four second video segment groups, each of which is configured. The two video clip groups include eight second video clips. The video decoding device splices together the second images of the 8 second video segments of the first video segment group of the four first video segment groups having the same image header to obtain four first video segments. And smoothing the first of the four video segments.
上述视频解码设备按照第一视频片段的划分顺序,将上述4个第一视频片段拼接在一起,得到上述源视频。The video decoding device splices the four first video segments together according to the division order of the first video segment to obtain the source video.
参见图8,图8为本发明实施例提供的一种视频编解码方法的流程示意图。如图8所示,该方法包括:Referring to FIG. 8, FIG. 8 is a schematic flowchart diagram of a video encoding and decoding method according to an embodiment of the present invention. As shown in Figure 8, the method includes:
S801、视频编码设备将源视频划分为M个第一视频片段。S801. The video encoding device divides the source video into M first video segments.
其中,上述M个第一视频片段的每个第一视频片段包括N帧第一图像,该N帧第一图像为连续帧图像。The first video segment of the M first video segments includes an N frame first image, and the N frame first image is a continuous frame image.
S802、视频编码设备将M个视频片段中的每个第一视频片段划分为T个第二视频片段,以得到M*T个第二视频片段。S802. The video encoding device divides each of the M video segments into T second video segments to obtain M*T second video segments.
具体地,上述视频编码设备根据预设分辨率将所述M个视频片段中的每个第一视频片段中的每帧第一图像划分为T帧第二图像,并对该T帧第二图像进行编号,以得到N*T帧第二图像;上述视频编码设备对上述N*T帧第二图像中,编号相同的每N帧第二图像进行组合,以得到T个第二视频片段;上述视频编码获取上述M个第一视频片段的每个第一视频片段划分得到的第二视频片段,以得到M*T个第二视频片段。Specifically, the video encoding apparatus divides, according to a preset resolution, a first image of each frame of each of the M video segments into a second image of a T frame, and the second image of the T frame. Numbering to obtain a second image of the N*T frame; the video encoding apparatus combining the second images of each N frame of the same number in the second image of the N*T frame to obtain T second video segments; The video encoding acquires the second video segment obtained by dividing each of the first video segments of the M first video segments to obtain M*T second video segments.
其中,上述M*T第二视频片段的每个第二视频片段包括N帧第二图像,该第二图像的分辨率小于上述第一视频片段的分辨率。The second video segment of the M*T second video segment includes an N frame second image, and the resolution of the second image is smaller than the resolution of the first video segment.
S803、视频编码设备对第一视频片段A1的T个第二视频片段进行并行编码,以得到T个第二码流数据。S803. The video encoding device performs parallel coding on the T second video segments of the first video segment A1 to obtain T second code stream data.
其中,上述第一视频片段A1为上述M个第一视频片段中的任意一个。The first video segment A1 is any one of the M first video segments.
其中,在对上述M个视频片段中的每个第一视频片段的T个第二视频片段进行并行编码之前,上述视频编码设备根据配置信息生成上述源视频的码流的序列头;并在该序列头中添加用于指示预设分辨率的第一语法元素和用于指示每个子视频片段中图像子帧的数量N的第二语法元素。Before the parallel coding of the T second video segments of each of the M video segments, the video encoding device generates a sequence header of the code stream of the source video according to the configuration information; A first syntax element for indicating a preset resolution and a second syntax element for indicating the number N of image subframes in each sub video segment are added to the sequence header.
进一步地,上述视频编码设备将上述序列头发送至视频解码设备。Further, the video encoding device sends the sequence header to the video decoding device.
S804、视频编码设备将第一视频片段对应的T个第二码流数据整合成一个第一码流数据。S804. The video encoding device integrates the T second code stream data corresponding to the first video segment into a first code stream data.
S805、视频编码设备将第一视频片段A1对应的第一码流数据发送至视频解码设备。S805. The video encoding device sends the first code stream data corresponding to the first video segment A1 to the video decoding device.
其中,在将上述第一视频片段A1对应的第一码流数据发送至视频解码设备后,上述视频编码设备对第一视频片段A2的T个第二视频片段进行并行编码。After the first code stream data corresponding to the first video segment A1 is sent to the video decoding device, the video encoding device performs parallel encoding on the T second video segments of the first video segment A2.
上述第一视频片段A1与上述第一视频片段A2在划分顺序上是相邻的,且上述第一视频片段A1在上述第一视频片段A2之前。The first video segment A1 and the first video segment A2 are adjacent in the dividing order, and the first video segment A1 is before the first video segment A2.
按照上述方法,上述编码设备完成对上述M个第一视频片段的编码操作,并将编码得到M个第一码流数据发送至上述视频解码设备。According to the above method, the encoding device performs an encoding operation on the M first video segments, and transmits the encoded M first code streams to the video decoding device.
S806、视频解码设备根据序列头对第一视频片段A1对应的第一码流数据进行扩展,得到第一视频片段A1对应的T个第二码流数据。S806. The video decoding device expands the first code stream data corresponding to the first video segment A1 according to the sequence header, to obtain T second code stream data corresponding to the first video segment A1.
S807、视频解码设备对第一视频片段A1对应的T个第二码流数据进行并行解码,以得到T个第二视频片段。
S807. The video decoding device performs parallel decoding on the T second code stream data corresponding to the first video segment A1 to obtain T second video segments.
S808、视频解码设备将T个第二视频片段拼接成一个第一视频片段A1。S808. The video decoding device concatenates the T second video segments into a first video segment A1.
进一步地,上述视频编码设备在将上述T个第二视频片段拼接成一个第一视频片段A1后,视频显示设备可以直接显示上述第一视频片段A1。Further, after the video encoding device splices the T second video segments into one first video segment A1, the video display device may directly display the first video segment A1.
其中,在完成对上述第一视频片段A1对应的T个第二码流数据进行并行解码得到的T个第二视频片段拼接后,上述视频解码设备对上述第一视频片段A2对应的T个第二码流数据进行并行解码,依次类推,直至完成对上述M个第一视频片段的每个第一视频片段对应的T个第二码流数据的解码,得到M个第一视频片段。After the T second video segments obtained by parallel decoding the T second code stream data corresponding to the first video segment A1 are spliced, the video decoding device corresponds to the T segments of the first video segment A2. The second code stream data is decoded in parallel, and so on, until the decoding of the T second code stream data corresponding to each of the first video segments of the M first video segments is completed, to obtain M first video segments.
在此需要说明的是,上述步骤S801-S807的详细过程可参见上述图2和图6所示方法实施例的具体过程,在此不再叙述。It should be noted that the detailed process of the foregoing steps S801-S807 can be referred to the specific process of the method embodiment shown in FIG. 2 and FIG. 6, and will not be described herein.
图9为本发明实施例提供的一种视频编码设备的结构示意图。如图9所示,该视频编码设备900包括:FIG. 9 is a schematic structural diagram of a video encoding apparatus according to an embodiment of the present invention. As shown in FIG. 9, the video encoding apparatus 900 includes:
第一划分单元901,用于将源视频划分为M个第一视频片段,所述M个第一视频片段中的每个第一视频片段由N帧第一图像组成,所述N帧第一图像为连续帧图像,所述M和N均为大于1的整数。a first dividing unit 901, configured to divide the source video into M first video segments, where each of the M first video segments is composed of N frames of the first image, and the N frames are first The image is a continuous frame image, and both M and N are integers greater than one.
第二划分单元902,用于将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,以得到M*T个第二视频片段,其中,任一所述第二视频片段包括N帧第二图像,所述第二图像的分辨率小于所述第一图像的分辨率,所述T为大于1的整数。a second dividing unit 902, configured to divide each of the M first video segments into T second video segments to obtain M*T second video segments, where any of the The second video segment includes an N-frame second image, the resolution of the second image being less than the resolution of the first image, and the T being an integer greater than one.
其中,所述第二划分单元902具体用于:The second dividing unit 902 is specifically configured to:
对所述M个第一视频片段中的第一视频片段i进行以下操作:Performing the following operations on the first video segment i of the M first video segments:
根据预设分辨率将所述第一视频片段i的N帧第一图像中的每一帧第一图像划分为T帧第二图像,并对所述T帧第二图像进行编号,以得到N*T帧第二图像,其中,任一第二图像的分辨率小于或者等于所述预设分辨率,所述第一视频片段i的N帧第一图像的各帧第一图像中位置相对应的第二图像的编号相同;Decoding a first image of each frame of the N frames of the first video segment i into a second image of the T frame according to a preset resolution, and numbering the second image of the T frame to obtain N *T frame second image, wherein the resolution of any second image is less than or equal to the preset resolution, and the position of the first image of each frame of the N image of the first video segment i corresponds to The second image has the same number;
将所述N*T帧第二图像中,编号相同的每N帧第二图像进行组合,得到T个第二视频片段;Combining the second images of each N frame with the same number in the second image of the N*T frame to obtain T second video segments;
其中,所述第一视频片段i为所述M个第一视频片段中的任意一个。The first video segment i is any one of the M first video segments.
编码单元903,用于对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码,以得到M*T个第二码流数据。The encoding unit 903 is configured to perform parallel encoding on the T second video segments in each of the M first video segments to obtain M*T second code stream data.
其中,所述编码单元903具体用于:The coding unit 903 is specifically configured to:
对所述第一视频片段i进行以下操作:Performing the following operations on the first video segment i:
获取所述第一视频片段i的T个第二视频片段中每个第二视频片段对应的编码优先级;Obtaining an encoding priority corresponding to each of the T second video segments of the first video segment i;
根据上述第一视频片段i中的T个第二视频片段对应的编码优先级,对所述第一视频片段i的T个第二视频片段进行并行编码,以得到T个第二码流数据。And encoding, according to the coding priority corresponding to the T second video segments in the first video segment i, the T second video segments of the first video segment i to obtain T second code stream data.
其中,所述视频编码设备900还包括:The video encoding device 900 further includes:
生成单元905,用于在对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码之前,根据编码配置信息生成所述源视频码流的序列头。a generating unit 905, configured to generate a sequence of the source video code stream according to the encoding configuration information, before performing parallel encoding on the T second video segments in each of the M first video segments head.
整合单元904,用于对所述M*T个第二码流数据进行整合,以得到所述源视频的码流。
The integration unit 904 is configured to integrate the M*T second code stream data to obtain a code stream of the source video.
其中,任一第二码流数据包括一组图像头和一组图像数据;所述整合单元904包括:The second stream data includes a set of image headers and a set of image data; the integration unit 904 includes:
第一整合子单元9041,用于将所述M个第一视频片段中的每个第一视频片段的T个第二码流数据进行整合以得到M个第一码流数据,其中,一个第一视频片段的T个第二码流数据整合得到一个第一码流数据;a first integration sub-unit 9041, configured to integrate T second code stream data of each of the M first video segments to obtain M first code stream data, where Integrating T pieces of second stream data of a video segment to obtain a first stream data;
第二整合子单元9042,用于将所述序列头、所述M个第一码流数据和序列终止码整合成所述源视频的码流。The second integration subunit 9042 is configured to integrate the sequence header, the M first code stream data, and the sequence termination code into a code stream of the source video.
其中,任一第二码流数据包括一组图像头和一组图像数据,所述第一整合单元9041具体用于:Any one of the second stream data includes a set of image headers and a set of image data, and the first integration unit 9041 is specifically configured to:
对所述第一视频片段i进行如下操作:Performing the following operations on the first video segment i:
获取所述第一视频片段i的对应的T个第二码流数据中每个第二码流数据的编码优先级,所述第二码流数据的编码优先级与其对应的第二视频片段的编码优先级一致;Obtaining an encoding priority of each second code stream data of the corresponding T second code stream data of the first video segment i, the encoding priority of the second code stream data and the corresponding second video segment thereof The coding priority is consistent;
根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的编码优先级,确定所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序;其中,所述第二码流数据的编码优先级越高,所述第二码流数据的图像数据的整合顺序越靠前;Determining, according to an encoding priority of each second code stream data of the T second code stream data corresponding to the first video segment i, each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;
根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序将所述所述第一视频片段i对应的T个第二码流数据的图像数据整合为一个第一码流数据的图像数据,并将所述第一视频片段i对应的T个第二码流数据中任一第二码流数据的一组图像头和所述第一码流数据的图像数据整合一个所述第一码流数据,其中,每个所述第一码流数据包括一组所述图像头和T组图像数据,所述T个第二码流数据对应的T个第二视频片段属于同一个第一视频片段。And according to the integration order of the image data of each of the T second code stream data corresponding to the first video segment i, the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data The image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes The T second video segments corresponding to the stream data belong to the same first video segment.
其中,所述视频编码设备900还包括:The video encoding device 900 further includes:
添加单元906,用于在根据编码配置信息生成所述源视频码流的序列头之后,在所述序列头中添加用于指示所述预设分辨率的第一语法元素和用于指示所述第一视频片段中包括的所述第一图像的帧数N的第二语法元素。The adding unit 906 is configured to: after generating a sequence header of the source video code stream according to the encoding configuration information, adding a first syntax element for indicating the preset resolution to the sequence header and indicating the A second syntax element of the number N of frames of the first image included in the first video segment.
需要说明的是,上述各单元(第一划分单元901,第二划分单元902,编码单元903,整合单元904,生成单元905和添加单元906)用于执行上述方法的相关步骤。It should be noted that each of the above units (the first dividing unit 901, the second dividing unit 902, the encoding unit 903, the integrating unit 904, the generating unit 905, and the adding unit 906) is used to perform the relevant steps of the above method.
在本实施例中,视频编码设备900是以单元的形式来呈现。这里的“单元”可以指特定应用集成电路(application-specific integrated circuit,ASIC),执行一个或多个软件或固件程序的处理器和存储器,集成逻辑电路,和/或其他可以提供上述功能的器件。此外,以上第一划分单元901,第二划分单元902,编码单元903,整合单元904,生成单元905和添加单元906可通过图14所示的视频编码设备1400的处理器1401来实现。In the present embodiment, the video encoding apparatus 900 is presented in the form of a unit. A "unit" herein may refer to an application-specific integrated circuit (ASIC), a processor and memory that executes one or more software or firmware programs, integrated logic circuits, and/or other devices that provide the functionality described above. . Further, the above first dividing unit 901, second dividing unit 902, encoding unit 903, integrating unit 904, generating unit 905 and adding unit 906 can be realized by the processor 1401 of the video encoding apparatus 1400 shown in FIG.
图11为本发明实施例提供的一种视频解码设备的结构示意图。如图11所示,该视频解码设备1100包括:FIG. 11 is a schematic structural diagram of a video decoding device according to an embodiment of the present invention. As shown in FIG. 11, the video decoding device 1100 includes:
第一获取单元1101,用于从源视频的码流中获取所述源视频的码流数据,所述原始视频的码流数据为不包括序列头和序列终止码的所述原始视频的码流。
a first acquiring unit 1101, configured to acquire code stream data of the source video from a code stream of the source video, where the code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code. .
划分单元1102,用于将所述源视频的码流数据平均划分为M个第一码流数据,并将所述M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,以得到M*T个第二码流数据。The dividing unit 1102 is configured to divide the code stream data of the source video into M first code stream data, and expand each first code stream data of the M first code stream data into T pieces. Two streams of data are obtained to obtain M*T second stream data.
其中,所述视频解码设备1100还包括:The video decoding device 1100 further includes:
第二获取单元1105,用于在从将源视频的码流数据平均划分为M个第一码流数据之前,获取所述源视频的码流中获取序列头;a second obtaining unit 1105, configured to acquire a sequence header in a code stream of the source video before the code stream data of the source video is equally divided into M first code stream data;
第三获取单元1106,用于根据所述源视频的分辨率和所述序列头中的第一语法元素所指示的预设分辨率获取第一码流数据可扩展成第二码流数据的个数T。The third obtaining unit 1106 is configured to obtain, according to the resolution of the source video and the preset resolution indicated by the first syntax element in the sequence header, the first code stream data may be expanded into the second code stream data. Number T.
其中,每个所述第一码流数据包括一组图像头和T组图像数据,所述划分单元1102包括:Each of the first code stream data includes a set of image headers and T sets of image data, and the dividing unit 1102 includes:
复制子单元11021,用于对所述M个第一码流数据中的第一码流数据i的一组图像头进行复制以得到T组图像头;a copying subunit 11021, configured to copy a set of image headers of the first code stream data i of the M first code stream data to obtain a T group image header;
扩展子单元11022,用于根据所述T组图像头和所述第一码流数据i的T组图像数据,扩展得到T个第二数据码流;The extension subunit 11022 is configured to expand, according to the T group image header and the T group image data of the first code stream data i, the T second data code streams;
获取子单元11023,用于获取所述M个第一码流数据的每个第一码流数据对应的T个第二码流数据,以得到M*T个第二码流数据;The obtaining sub-unit 11023 is configured to acquire T second code stream data corresponding to each first code stream data of the M first code stream data, to obtain M*T second code stream data;
其中,任一第二码流数据包括一组图像头和一组图像数据,所述第一码流数据i为所述M个第一码流数据中的任意一个。The second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
解码单元1103,用于对任一第一码流数据对应的T个第二码流数据进行并行解码,以得到T个第二视频片段;并获取所述M个第一码流数据中的每个第一码流数据的T个第二码流数据对应的T个第二视频片段,以得到M*T个第二视频片段。 Decoding unit 1103, configured to perform parallel decoding on T second code stream data corresponding to any first code stream data to obtain T second video segments; and acquire each of the M first code stream data T second video segments corresponding to T second code stream data of the first code stream data to obtain M*T second video segments.
其中,所述视频解码设备1100还包括:The video decoding device 1100 further includes:
剔除单元1107,用于在对任一第一码流数据对应的T个第二码流数据进行并行解码之前,剔除所述序列头中的所述第一语法元素和第二语法元素,所述第二语法元素用于指示所述第二视频片段中包括的第二图像的帧数N。a culling unit 1107, configured to cull the first syntax element and the second syntax element in the sequence header before performing parallel decoding on the T second code stream data corresponding to any first code stream data, The second syntax element is used to indicate the number N of frames of the second image included in the second video segment.
其中,所述解码单元1103具体用于:The decoding unit 1103 is specifically configured to:
对所述M个第一码流数据中的第一码流数据i进行以下操作:Performing the following operations on the first code stream data i of the M first code stream data:
获取所述第一码流数据i的T个第二码流数据中每个第二码流数据对应的解码优先级;Obtaining a decoding priority corresponding to each second code stream data of the T second code stream data of the first code stream data i;
根据所述第一码流数据i的T个第二码流数据对应的解码优先级,对所述第一码流数据i的T个第二码流数据进行并行解码,以得到T个第二视频片段;Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip
其中,所述第一码流数据i为所述M个第一码流数据中的任意一个。The first code stream data i is any one of the M first code stream data.
拼接单元1104,用于对所述M*T个第二视频片段进行拼接,以得到所述源视频。The splicing unit 1104 is configured to splicing the M*T second video segments to obtain the source video.
其中,任一第二视频片段包括N帧第二图像,所述拼接单元1104包括:Wherein, any second video segment includes an N-frame second image, and the splicing unit 1104 includes:
第一拼接子单元11041,用于将所述M个第一码流数据中的每个第一码流数据对应的T个第二视频片段中的N*T帧第二图像中,图像头相同的每T帧第二图像拼接在一起,得到M个第一视频片段,所述M个第一视频片段中的每个第一视频片段包括N帧第一图像,所述第一图像的分辨率大于所述第二图像的分辨率;The first splicing sub-unit 11041 is configured to: in the second image of the N*T frames in the T second video segments corresponding to each of the M first code stream data, the image header is the same The second image of each T frame is stitched together to obtain M first video segments, each of the first video segments includes N frames of the first image, and the resolution of the first image Greater than the resolution of the second image;
第二拼接子单元11042,用于对所述M个第一视频片段进行拼接,以得到所述源视频。
The second splicing sub-unit 11042 is configured to splicing the M first video segments to obtain the source video.
需要说明的是,上述各单元(第一获取单元1101,划分单元1102,解码单元1103,拼接单元1104,第二获取单元1105,第三获取单元1106和剔除单元1107)用于执行上述方法的相关步骤。It should be noted that each of the foregoing units (the first obtaining unit 1101, the dividing unit 1102, the decoding unit 1103, the splicing unit 1104, the second obtaining unit 1105, the third obtaining unit 1106, and the culling unit 1107) is configured to perform the foregoing method. step.
在本实施例中,视频解码设备1100是以单元的形式来呈现。这里的“单元”可以指特定应用集成电路(application-specific integrated circuit,ASIC),执行一个或多个软件或固件程序的处理器和存储器,集成逻辑电路,和/或其他可以提供上述功能的器件。此外,以上第一获取单元1101,划分单元1102,解码单元1103,拼接单元1104,第二获取单元1105,第三获取单元1106和剔除单元1107可通过通过图15所示的视频解码设备1500的处理器1501来实现。In the present embodiment, the video decoding device 1100 is presented in the form of a unit. A "unit" herein may refer to an application-specific integrated circuit (ASIC), a processor and memory that executes one or more software or firmware programs, integrated logic circuits, and/or other devices that provide the functionality described above. . Further, the above first obtaining unit 1101, dividing unit 1102, decoding unit 1103, splicing unit 1104, second obtaining unit 1105, third obtaining unit 1106, and culling unit 1107 may pass the processing by the video decoding apparatus 1500 shown in FIG. The device 1501 is implemented.
如图14所示,视频编码设备1400可以以图14中的结构来实现,该视频编码设备1400包括至少一个处理器1401,至少一个存储器1402以及至少一个通信接口1403。所述处理器1401、所述存储器1402和所述通信接口1403通过所述通信总线连接并完成相互间的通信。As shown in FIG. 14, video encoding apparatus 1400 can be implemented in the structure of FIG. 14, which includes at least one processor 1401, at least one memory 1402, and at least one communication interface 1403. The processor 1401, the memory 1402, and the communication interface 1403 are connected by the communication bus and complete communication with each other.
处理器1401可以是通用中央处理器(CPU),微处理器,特定应用集成电路(application-specific integrated circuit,ASIC),或一个或多个用于控制以上方案程序执行的集成电路。The processor 1401 may be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program.
通信接口1403,用于与其他设备或通信网络通信,如以太网,无线接入网(RAN),无线局域网(Wireless Local Area Networks,WLAN)等。The communication interface 1403 is configured to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), and the like.
存储器1402可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过总线与处理器相连接。存储器也可以和处理器集成在一起。The memory 1402 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type that can store information and instructions. The dynamic storage device can also be an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, and a disc storage device. (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be Any other media accessed, but not limited to this. The memory can exist independently and be connected to the processor via a bus. The memory can also be integrated with the processor.
其中,所述存储器1402用于存储执行以上方案的应用程序代码,并由处理器1401来控制执行。所述处理器1401用于执行所述存储器1402中存储的应用程序代码。The memory 1402 is configured to store application code that executes the above solution, and is controlled by the processor 1401 for execution. The processor 1401 is configured to execute application code stored in the memory 1402.
存储器1402存储的代码可执行以上提供的视频编码设备执行的上述一种视频编码方法,比如视频编码设备将源视频划分为M个第一视频片段,所述M个第一视频片段中的每个第一视频片段由N帧第一图像组成,所述N帧第一图像为连续帧图像,所述M和N均为大于1的整数;所述视频编码设备将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,以得到M*T个第二视频片段,其中,任一所述第二视频片段包括N帧第二图像,所述第二图像的分辨率小于所述第一图像的分辨率,所述T为大于1的整数;所述视频编码设备对任一第一视频片段中的T个第二视频片段进行并行编码,以得到T个第二码流数据,并获取所述M个第一视频片段中每个第一视频片段的第二视频片段编码得到的第二码流数据以得到M*T个第二码流数据;所述视频编码设备对所述M*T个第二码
流数据进行整合,以得到所述源视频的码流。The code stored in the memory 1402 may perform the above-described one video encoding method performed by the video encoding apparatus provided above, such as the video encoding apparatus dividing the source video into M first video segments, each of the M first video segments The first video segment is composed of N frames of first images, the N frames of the first image are consecutive frame images, and the M and N are integers greater than 1; the video encoding device uses the M first video segments Each of the first video segments is divided into T second video segments to obtain M*T second video segments, wherein any of the second video segments includes an N-frame second image, the second image The resolution is smaller than the resolution of the first image, the T is an integer greater than 1; the video encoding device performs parallel encoding on the T second video segments in any of the first video segments to obtain T first Second stream data, and acquiring second code stream data obtained by encoding the second video segment of each of the M first video segments to obtain M*T second code stream data; Encoding device pair of said M*T second codes
The stream data is integrated to obtain a code stream of the source video.
本发明实施例还提供一种计算机存储介质,其中,该计算机存储介质可存储有程序,该程序执行时包括上述方法实施例中记载的任何一种视频编码方法的部分或全部步骤。The embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium can store a program, and the program includes some or all of the steps of any one of the video encoding methods described in the foregoing method embodiments.
如图15所示,视频解码设备1500可以以图15中的结构来实现,该视频解码设备1500包括至少一个处理器1501,至少一个存储器1502以及至少一个通信接口1503。所述处理器1501、所述存储器1502和所述通信接口1503通过所述通信总线连接并完成相互间的通信。As shown in FIG. 15, video decoding device 1500 can be implemented in the structure of FIG. 15, which includes at least one processor 1501, at least one memory 1502, and at least one communication interface 1503. The processor 1501, the memory 1502, and the communication interface 1503 are connected by the communication bus and complete communication with each other.
处理器1501可以是通用中央处理器(CPU),微处理器,特定应用集成电路(application-specific integrated circuit,ASIC),或一个或多个用于控制以上方案程序执行的集成电路。The processor 1501 may be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program.
通信接口1503,用于与其他设备或通信网络通信,如以太网,无线接入网(RAN),无线局域网(Wireless Local Area Networks,WLAN)等。The communication interface 1503 is configured to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), and the like.
存储器1502可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过总线与处理器相连接。存储器也可以和处理器集成在一起。The memory 1502 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type that can store information and instructions. The dynamic storage device can also be an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, and a disc storage device. (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be Any other media accessed, but not limited to this. The memory can exist independently and be connected to the processor via a bus. The memory can also be integrated with the processor.
其中,所述存储器1502用于存储执行以上方案的应用程序代码,并由处理器1701来控制执行。所述处理器1501用于执行所述存储器1502中存储的应用程序代码。The memory 1502 is configured to store application code that executes the above solution, and is controlled by the processor 1701 for execution. The processor 1501 is configured to execute application code stored in the memory 1502.
存储器1502存储的代码可执行以上提供的视频解码设备执行的上述一种视频解码方法,比如视频解码设备从源视频的码流中获取所述源视频的码流数据,所述原始视频的码流数据为不包括序列头和序列终止码的所述原始视频的码流;所述视频解码设备将所述源视频的码流数据平均划分为M个第一码流数据,并将所述M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,以得到M*T个第二码流数据;所述视频解码设备对任一第一码流数据对应的T个第二码流数据进行并行解码,以得到T个第二视频片段;并获取所述M个第一码流数据中的每个第一码流数据的T个第二码流数据对应的T个第二视频片段,以得到M*T个第二视频片段;所述视频解码设备对所述M*T个第二视频片段进行拼接,以得到所述源视频。The code stored in the memory 1502 may perform the above-described video decoding method performed by the video decoding device provided by the video decoding device, for example, the video decoding device acquires the code stream data of the source video from the code stream of the source video, and the code stream of the original video. The data is a code stream of the original video that does not include a sequence header and a sequence termination code; the video decoding device divides the code stream data of the source video into M first code stream data, and the M Each first code stream data of the first code stream data is expanded into T second code stream data to obtain M*T second code stream data; the video decoding device corresponding to any first code stream data Performing parallel decoding on the T second code stream data to obtain T second video segments; and acquiring T second code stream data corresponding to each of the M first code stream data T second video segments to obtain M*T second video segments; the video decoding device splicing the M*T second video segments to obtain the source video.
本发明实施例还提供一种计算机存储介质,其中,该计算机存储介质可存储有程序,该程序执行时包括上述方法实施例中记载的任何一种视频解码方法的部分或全部步骤。The embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium can store a program, and the program includes some or all of the steps of any one of the video decoding methods described in the foregoing method embodiments.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知
悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should understand that the present invention is not limited by the described action sequence. Because certain steps may be performed in other sequences or concurrently in accordance with the present invention. Secondly, those skilled in the art should also know
It is to be understood that the embodiments described in the specification are all preferred embodiments and that the acts and modules involved are not necessarily essential to the invention.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above embodiments, the descriptions of the various embodiments are different, and the details that are not detailed in a certain embodiment can be referred to the related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided herein, it should be understood that the disclosed apparatus may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical or otherwise.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储器包括:U盘、ROM、随机存取存储器(Random Access Memory,RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present invention may contribute to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a memory. A number of instructions are included to cause a computer device (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing memory includes: a U disk, a ROM, a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk, and the like, which can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、ROM、RAM、磁盘或光盘等。A person skilled in the art can understand that all or part of the steps of the foregoing embodiments can be completed by a program to instruct related hardware, and the program can be stored in a computer readable memory, and the memory can include: a flash drive , ROM, RAM, disk or CD.
以上对本发明实施例进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上上述,本说明书内容不应理解为对本发明的限制。
The embodiments of the present invention have been described in detail above, and the principles and implementations of the present invention are described in detail herein. The description of the above embodiments is only for helping to understand the method of the present invention and its core ideas; The present invention is not limited by the scope of the present invention, and the present invention is not limited by the scope of the present invention.
Claims (26)
- 一种视频编码方法,其特征在于,包括:A video encoding method, comprising:视频编码设备将源视频划分为M个第一视频片段,所述M个第一视频片段中的每个第一视频片段由N帧第一图像组成,所述N帧第一图像为连续帧图像,所述M和N均为大于1的整数;The video encoding device divides the source video into M first video segments, each of the M first video segments is composed of N frames of the first image, and the N frames of the first image are consecutive frame images. , wherein M and N are integers greater than one;所述视频编码设备将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,以得到M*T个第二视频片段,其中,任一所述第二视频片段包括N帧第二图像,所述第二图像的分辨率小于所述第一图像的分辨率,所述T为大于1的整数;The video encoding device divides each of the M first video segments into T second video segments to obtain M*T second video segments, where any of the second videos The segment includes an N-frame second image, the resolution of the second image is less than a resolution of the first image, and the T is an integer greater than one;所述视频编码设备对所述M个第一视频片段中的每个第一视频片段的T个第二视频片段进行并行编码,以得到M*T个第二码流数据;The video encoding device performs parallel encoding on the T second video segments of each of the M first video segments to obtain M*T second code stream data;所述视频编码设备对所述M*T个第二码流数据进行整合,以得到所述源视频的码流。The video encoding device integrates the M*T second code stream data to obtain a code stream of the source video.
- 根据权利要求1所述的方法,其特征在于,所述视频编码设备将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,包括:The method according to claim 1, wherein the video encoding device divides each of the M first video segments into T second video segments, including:所述视频编码设备对所述M个第一视频片段中的第一视频片段i进行以下操作:The video encoding device performs the following operations on the first video segment i of the M first video segments:根据预设分辨率将所述第一视频片段i的N帧第一图像中的每一帧第一图像划分为T帧第二图像,并对所述T帧第二图像进行编号,以得到N*T帧第二图像,其中,任一第二图像的分辨率小于或者等于所述预设分辨率,所述第一视频片段i的N帧第一图像的各帧第一图像中位置相对应的第二图像的编号相同;Decoding a first image of each frame of the N frames of the first video segment i into a second image of the T frame according to a preset resolution, and numbering the second image of the T frame to obtain N *T frame second image, wherein the resolution of any second image is less than or equal to the preset resolution, and the position of the first image of each frame of the N image of the first video segment i corresponds to The second image has the same number;将所述N*T帧第二图像中,编号相同的N帧第二图像进行组合,得到T个第二视频片段;Combining N frames of second images with the same number in the second image of the N*T frame to obtain T second video segments;其中,所述第一视频片段i为所述M个第一视频片段中的任意一个。The first video segment i is any one of the M first video segments.
- 根据权利要求2所述的方法,其特征在于,所述视频编码设备对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码,包括:The method according to claim 2, wherein the video encoding device performs parallel encoding on the T second video segments in each of the M first video segments, including:所述视频编码设备对所述第一视频片段i进行以下操作:The video encoding device performs the following operations on the first video segment i:获取所述第一视频片段i的T个第二视频片段中每个第二视频片段对应的编码优先级;Obtaining an encoding priority corresponding to each of the T second video segments of the first video segment i;根据所述第一视频片段i中的T个第二视频片段对应的编码优先级,对所述第一视频片段i的T个第二视频片段进行并行编码,以得到T个第二码流数据。And encoding, according to the coding priority corresponding to the T second video segments in the first video segment i, the T second video segments of the first video segment i to obtain T second code stream data .
- 根据权利要求3所述的方法,其特征在于,所述视频编码设备对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码之前,所述方法还包括:The method according to claim 3, wherein said video encoding device performs parallel encoding on T second video segments of each of said M first video segments before said The method also includes:所述视频编码设备根据编码配置信息生成所述源视频的码流的序列头。The video encoding device generates a sequence header of a code stream of the source video according to the encoding configuration information.
- 根据权利要求4所述的方法,其特征在于,所述视频编码设备对所述M*T个第二码流数据进行整合,得到所述源视频的码流,包括:The method according to claim 4, wherein the video encoding device integrates the M*T second code stream data to obtain a code stream of the source video, including:所述视频编码设备将所述M个第一视频片段中的每个第一视频片段的T个第二码流数据进行整合以得到M个第一码流数据,其中,一个第一视频片段的T个第二码流数据整合得到一个第一码流数据;The video encoding device integrates T second code stream data of each of the M first video segments to obtain M first code stream data, where a first video segment is Integrating T pieces of second stream data to obtain a first stream data;所述视频编码设备将所述序列头、所述M个第一码流数据和序列终止码整合成所述源视频的码流。 The video encoding device integrates the sequence header, the M first code stream data, and a sequence termination code into a code stream of the source video.
- 根据权利要求5所述的方法,其特征在于,任一第二码流数据包括一组图像头和一组图像数据,所述视频编码设备将所述M个第一视频片段中的每个第一视频片段的T个第二码流数据进行整合以得到M个第一码流数据,包括:The method of claim 5 wherein any of the second code stream data comprises a set of image headers and a set of image data, said video encoding device for each of said M first video segments The T second code stream data of the first video segment are integrated to obtain M first code stream data, including:所述视频编码设备对所述第一视频片段i进行如下操作:The video encoding device performs the following operations on the first video segment i:获取所述第一视频片段i的对应的T个第二码流数据中每个第二码流数据的编码优先级,所述第二码流数据的编码优先级与其对应的第二视频片段的编码优先级一致;Obtaining an encoding priority of each second code stream data of the corresponding T second code stream data of the first video segment i, the encoding priority of the second code stream data and the corresponding second video segment thereof The coding priority is consistent;根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的编码优先级,确定所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序;其中,所述第二码流数据的编码优先级越高,所述第二码流数据的图像数据的整合顺序越靠前;Determining, according to an encoding priority of each second code stream data of the T second code stream data corresponding to the first video segment i, each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序将所述所述第一视频片段i对应的T个第二码流数据的图像数据整合为一个第一码流数据的图像数据,并将所述第一视频片段i对应的T个第二码流数据中任一第二码流数据的一组图像头和所述第一码流数据的图像数据整合一个所述第一码流数据,其中,每个所述第一码流数据包括一组所述图像头和T组图像数据,所述T个第二码流数据对应的T个第二视频片段属于同一个第一视频片段。And according to the integration order of the image data of each of the T second code stream data corresponding to the first video segment i, the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data The image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes The T second video segments corresponding to the stream data belong to the same first video segment.
- 根据权利要求4所述的方法,其特征在于,所述视频编码设备根据编码配置信息生成所述源视频的码流的序列头之后,所述方法还包括:The method according to claim 4, wherein after the video encoding device generates a sequence header of the code stream of the source video according to the encoding configuration information, the method further includes:所述视频编码设备在所述序列头中添加用于指示所述预设分辨率的第一语法元素和用于指示所述第一视频片段中包括的所述第一图像的帧数N的第二语法元素。The video encoding apparatus adds, in the sequence header, a first syntax element for indicating the preset resolution and a number of frames N for indicating the first image included in the first video segment. Two syntax elements.
- 一种视频解码方法,其特征在于,包括:A video decoding method, comprising:视频解码设备从源视频的码流中获取所述源视频的码流数据,所述原始视频的码流数据为不包括序列头和序列终止码的所述原始视频的码流;The video decoding device acquires code stream data of the source video from a code stream of the source video, where the code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code;所述视频解码设备将所述源视频的码流数据平均划分为M个第一码流数据,并将所述M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,以得到M*T个第二码流数据;The video decoding device divides the code stream data of the source video into M first code stream data, and expands each first code stream data of the M first code stream data into T second Code stream data to obtain M*T second code stream data;所述视频解码设备对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码,以得到M*T个第二视频片段;The video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data to obtain M*T second video segments;所述视频解码设备对所述M*T个第二视频片段进行拼接,以得到所述源视频。The video decoding device splices the M*T second video segments to obtain the source video.
- 根据权利要求8所述的方法,其特征在于,所述视频解码设备将源视频的码流数据平均划分为M个第一码流数据之前,所述方法还包括:The method according to claim 8, wherein before the video decoding device divides the code stream data of the source video into M pieces of the first code stream data, the method further includes:所述视频解码设备从所述源视频的码流中获取序列头;The video decoding device acquires a sequence header from a code stream of the source video;所述视频解码设备根据所述源视频的分辨率和所述序列头中的第一语法元素所指示的预设分辨率获取第一码流数据可扩展成第二码流数据的个数T。The video decoding device acquires the number T of the first code stream data that can be expanded into the second code stream data according to the resolution of the source video and the preset resolution indicated by the first syntax element in the sequence header.
- 根据权利要求9所述的方法,其特征在于,每个所述第一码流数据包括一组图像头和T组图像数据,所述将所述M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,包括:The method of claim 9 wherein each of said first code stream data comprises a set of image headers and T sets of image data, said each of said M first code stream data The first code stream data is expanded into T second code stream data, including:所述视频解码设备对所述M个第一码流数据中的第一码流数据i的一组图像头进行复 制以得到T组图像头;The video decoding device complexes a set of image headers of the first code stream data i of the M first code stream data System to obtain a T group image header;所述视频解码设备根据所述T组图像头和所述第一码流数据i的T组图像数据,扩展得到T个第二数据码流;The video decoding device expands to obtain T second data code streams according to the T group image header and the T group image data of the first code stream data i;所述视频解码设备获取所述M个第一码流数据的每个第一码流数据对应的T个第二码流数据,以得到M*T个第二码流数据;The video decoding device acquires T second code stream data corresponding to each first code stream data of the M first code stream data to obtain M*T second code stream data;其中,任一第二码流数据包括一组图像头和一组图像数据,所述第一码流数据i为所述M个第一码流数据中的任意一个。The second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
- 根据权利要求8所述的方法,其特征在于,所述视频解码设备对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码,包括:The method according to claim 8, wherein the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data. include:所述视频编码设备对所述M个第一码流数据中的第一码流数据i进行以下操作:The video encoding device performs the following operations on the first code stream data i of the M first code stream data:获取所述第一码流数据i的T个第二码流数据中每个第二码流数据对应的解码优先级;Obtaining a decoding priority corresponding to each second code stream data of the T second code stream data of the first code stream data i;根据所述第一码流数据i的T个第二码流数据对应的解码优先级,对所述第一码流数据i的T个第二码流数据进行并行解码,以得到T个第二视频片段;Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip其中,所述第一码流数据i为所述M个第一码流数据中的任意一个。The first code stream data i is any one of the M first code stream data.
- 根据权利要求11所述的方法,其特征在于,所述视频解码设备对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码之前,所述方法还包括:The method according to claim 11, wherein the video decoding device performs parallel decoding on the T second code stream data corresponding to each of the M first stream data. The method further includes:所述视频解码设备剔除所述序列头中的所述第一语法元素和第二语法元素,所述第二语法元素用于指示所述第二视频片段中包括的第二图像的帧数N。The video decoding device culls the first syntax element and the second syntax element in the sequence header, and the second syntax element is used to indicate a frame number N of a second image included in the second video segment.
- 根据权利要求12所述的方法,其特征在于,任一第二视频片段包括N帧第二图像,所述视频解码设备对所述M*T个第二视频片段进行拼接,以得到所述源视频,包括:The method according to claim 12, wherein any second video segment comprises an N-frame second image, and the video decoding device splices the M*T second video segments to obtain the source Video, including:所述视频解码设备将所述M个第一码流数据中的每个第一码流数据对应的T个第二视频片段中的N*T帧第二图像中,图像头相同的每T帧第二图像拼接在一起,得到M个第一视频片段,所述M个第一视频片段中的每个第一视频片段包括N帧第一图像,所述第一图像的分辨率大于所述第二图像的分辨率;The video decoding device, in the second image of the N*T frames in the T second video segments corresponding to each of the M first stream data, each T frame of the same image header The second images are stitched together to obtain M first video segments, each of the first video segments includes an N-frame first image, and the resolution of the first image is greater than the first image The resolution of the two images;所述视频解码设备对所述M个第一视频片段进行拼接,以得到所述源视频。The video decoding device splices the M first video segments to obtain the source video.
- 一种视频编码设备,其特征在于,包括:A video encoding device, comprising:第一划分单元,用于将源视频划分为M个第一视频片段,所述M个第一视频片段中的每个第一视频片段由N帧第一图像组成,所述N帧第一图像为连续帧图像,所述M和N均为大于1的整数;a first dividing unit, configured to divide the source video into M first video segments, each of the M first video segments being composed of N frames of the first image, the N frames of the first image For consecutive frame images, the M and N are integers greater than one;第二划分单元,用于将所述M个第一视频片段中每个第一视频片段划分为T个第二视频片段,以得到M*T个第二视频片段,其中,任一所述第二视频片段包括N帧第二图像,所述第二图像的分辨率小于所述第一图像的分辨率,所述T为大于1的整数;a second dividing unit, configured to divide each of the M first video segments into T second video segments to obtain M*T second video segments, where any of the foregoing The second video segment includes an N-frame second image, the resolution of the second image is less than a resolution of the first image, and the T is an integer greater than one;编码单元,用于对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码,以得到M*T个第二码流数据;a coding unit, configured to perform parallel coding on the T second video segments in each of the M first video segments to obtain M*T second code stream data;整合单元,用于对所述M*T个第二码流数据进行整合,以得到所述源视频的码流。And an integration unit, configured to integrate the M*T second code stream data to obtain a code stream of the source video.
- 根据权利要求14所述的设备,其特征在于,所述第二划分单元具体用于:The device according to claim 14, wherein the second dividing unit is specifically configured to:对所述M个第一视频片段中的第一视频片段i进行以下操作: Performing the following operations on the first video segment i of the M first video segments:根据预设分辨率将所述第一视频片段i的N帧第一图像中的每一帧第一图像划分为T帧第二图像,并对所述T帧第二图像进行编号,以得到N*T帧第二图像,其中,任一第二图像的分辨率小于或者等于所述预设分辨率,所述第一视频片段i的N帧第一图像的各帧第一图像中位置相对应的第二图像的编号相同;Decoding a first image of each frame of the N frames of the first video segment i into a second image of the T frame according to a preset resolution, and numbering the second image of the T frame to obtain N *T frame second image, wherein the resolution of any second image is less than or equal to the preset resolution, and the position of the first image of each frame of the N image of the first video segment i corresponds to The second image has the same number;将所述N*T帧第二图像中,编号相同的N帧第二图像进行组合,得到T个第二视频片段;Combining N frames of second images with the same number in the second image of the N*T frame to obtain T second video segments;其中,所述第一视频片段i为所述M个第一视频片段中的任意一个。The first video segment i is any one of the M first video segments.
- 根据权利要求15所述的设备,其特征在于,所述编码单元具体用于:The device according to claim 15, wherein the coding unit is specifically configured to:对所述第一视频片段i进行以下操作:Performing the following operations on the first video segment i:获取所述第一视频片段i的T个第二视频片段中每个第二视频片段对应的编码优先级;Obtaining an encoding priority corresponding to each of the T second video segments of the first video segment i;根据上述第一视频片段i中的T个第二视频片段对应的编码优先级,对所述第一视频片段i的T个第二视频片段进行并行编码,以得到T个第二码流数据。And encoding, according to the coding priority corresponding to the T second video segments in the first video segment i, the T second video segments of the first video segment i to obtain T second code stream data.
- 根据权利要求16所述的设备,其特征在于,所述视频编码设备还包括:The device according to claim 16, wherein the video encoding device further comprises:生成单元,用于在对所述M个第一视频片段中的每个第一视频片段中的T个第二视频片段进行并行编码之前,根据编码配置信息生成所述源视频的码流的序列头。a generating unit, configured to generate a sequence of the code stream of the source video according to the encoding configuration information, before performing parallel encoding on the T second video segments in each of the M first video segments head.
- 根据权利要求17所述的设备,其特征在于,所述整合单元包括:The device according to claim 17, wherein the integration unit comprises:第一整合子单元,用于将所述M个第一视频片段中的每个第一视频片段的T个第二码流数据进行整合以得到M个第一码流数据,其中,一个第一视频片段的T个第二码流数据整合得到一个第一码流数据;a first integration subunit, configured to integrate T second code stream data of each of the M first video segments to obtain M first code stream data, where Integrating T pieces of second stream data of the video segment to obtain a first stream data;第二整合子单元,用于将所述序列头、所述M个第一码流数据和序列终止码整合成所述源视频的码流。And a second integration subunit, configured to integrate the sequence header, the M first code stream data, and the sequence termination code into a code stream of the source video.
- 根据权利要求18所述的设备,其特征在于,任一第二码流数据包括一组图像头和一组图像数据,所述第一整合单元具体用于:The device according to claim 18, wherein any of the second code stream data comprises a set of image headers and a set of image data, and the first integration unit is specifically configured to:对所述第一视频片段i进行如下操作:Performing the following operations on the first video segment i:获取所述第一视频片段i的对应的T个第二码流数据中每个第二码流数据的编码优先级,所述第二码流数据的编码优先级与其对应的第二视频片段的编码优先级一致;Obtaining an encoding priority of each second code stream data of the corresponding T second code stream data of the first video segment i, the encoding priority of the second code stream data and the corresponding second video segment thereof The coding priority is consistent;根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的编码优先级,确定所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序;其中,所述第二码流数据的编码优先级越高,所述第二码流数据的图像数据的整合顺序越靠前;Determining, according to an encoding priority of each second code stream data of the T second code stream data corresponding to the first video segment i, each of the T second code stream data corresponding to the first video segment i An order of integration of image data of the second code stream data; wherein, the higher the coding priority of the second code stream data, the higher the integration order of the image data of the second code stream data;根据所述第一视频片段i对应的T个第二码流数据中每个第二码流数据的图像数据的整合顺序将所述所述第一视频片段i对应的T个第二码流数据的图像数据整合为一个第一码流数据的图像数据,并将所述第一视频片段i对应的T个第二码流数据中任一第二码流数据的一组图像头和所述第一码流数据的图像数据整合一个所述第一码流数据,其中,每个所述第一码流数据包括一组所述图像头和T组图像数据,所述T个第二码流数据对应的T个第二视频片段属于同一个第一视频片段。And according to the integration order of the image data of each of the T second code stream data corresponding to the first video segment i, the T second code stream data corresponding to the first video segment i Image data is integrated into image data of a first code stream data, and a set of image headers of any of the second code stream data corresponding to the first video segment i and the second video stream data The image data of the first code stream data integrates one of the first code stream data, wherein each of the first code stream data includes a set of the image header and T group image data, and the T second codes The T second video segments corresponding to the stream data belong to the same first video segment.
- 根据权利要求17所述的设备,其特征在于,所述视频编码设备还包括:The device according to claim 17, wherein the video encoding device further comprises:添加单元,用于在根据所述编码配置信息生成所述源视频码流的序列头之后,在所述 序列头中添加用于指示所述预设分辨率的第一语法元素和用于指示所述第一视频片段中包括的所述第一图像的帧数N的第二语法元素。An adding unit, after generating a sequence header of the source video code stream according to the encoding configuration information, in the A first syntax element for indicating the preset resolution and a second syntax element for indicating a frame number N of the first image included in the first video segment are added to the sequence header.
- 一种视频解码设备,其特征在于,包括:A video decoding device, comprising:第一获取单元,用于从源视频的码流中获取所述源视频的码流数据,所述原始视频的码流数据为不包括序列头和序列终止码的所述原始视频的码流;a first acquiring unit, configured to acquire code stream data of the source video from a code stream of the source video, where the code stream data of the original video is a code stream of the original video that does not include a sequence header and a sequence termination code;划分单元,用于将所述源视频的码流数据平均划分为M个第一码流数据,并将所述M个第一码流数据的每个第一码流数据扩展为T个第二码流数据,以得到M*T个第二码流数据;a dividing unit, configured to divide the code stream data of the source video into M first code stream data, and expand each first code stream data of the M first code stream data into T second Code stream data to obtain M*T second code stream data;解码单元,用于对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码,以得到M*T个第二视频片段;a decoding unit, configured to perform parallel decoding on the T second code stream data corresponding to each of the M first code stream data to obtain M*T second video segments;拼接单元,用于对所述M*T个第二视频片段进行拼接,以得到所述源视频。a splicing unit, configured to splicing the M*T second video segments to obtain the source video.
- 根据权利要求21所述的设备,其特征在于,所述视频解码设备还包括:The device according to claim 21, wherein the video decoding device further comprises:第二获取单元,用于在从将源视频的码流数据平均划分为M个第一码流数据之前,获取所述源视频的码流中获取序列头;a second acquiring unit, configured to acquire a sequence header in a code stream of the source video before the code stream data of the source video is equally divided into M first code stream data;第三获取单元,用于根据所述源视频的分辨率和所述序列头中的第一语法元素所指示的预设分辨率获取第一码流数据可扩展成第二码流数据的个数T。a third acquiring unit, configured to acquire, according to a resolution of the source video and a preset resolution indicated by the first syntax element in the sequence header, the number of the first code stream data that can be expanded into the second code stream data T.
- 根据权利要求22所述的设备,其特征在于,每个所述第一码流数据包括一组图像头和T组图像数据,所述划分单元包括:The device according to claim 22, wherein each of said first code stream data comprises a set of image headers and T sets of image data, said dividing unit comprising:复制子单元,用于对所述M个第一码流数据中的第一码流数据i的一组图像头进行复制以得到T组图像头;a copying subunit, configured to copy a set of image headers of the first code stream data i of the M first code stream data to obtain a T group image header;扩展子单元,用于根据所述T组图像头和所述第一码流数据i的T组图像数据,扩展得到T个第二数据码流;An extension subunit, configured to expand, according to the T group image header and the T group image data of the first code stream data i, to obtain T second data code streams;第一获取子单元,用于获取所述M个第一码流数据的每个第一码流数据对应的T个第二码流数据,以得到M*T个第二码流数据;a first acquiring sub-unit, configured to acquire T second code stream data corresponding to each first code stream data of the M first code stream data, to obtain M*T second code stream data;其中,任一第二码流数据包括一组图像头和一组图像数据,所述第一码流数据i为所述M个第一码流数据中的任意一个。The second code stream data includes a set of image headers and a set of image data, and the first code stream data i is any one of the M first code stream data.
- 根据权利要求21所述的设备,其特征在于,所述解码单元具体用于:The device according to claim 21, wherein the decoding unit is specifically configured to:对所述M个第一码流数据中的第一码流数据i进行以下操作:Performing the following operations on the first code stream data i of the M first code stream data:获取所述第一码流数据i的T个第二码流数据中每个第二码流数据对应的解码优先级;Obtaining a decoding priority corresponding to each second code stream data of the T second code stream data of the first code stream data i;根据所述第一码流数据i的T个第二码流数据对应的解码优先级,对所述第一码流数据i的T个第二码流数据进行并行解码,以得到T个第二视频片段;Decoding the T second code stream data of the first code stream data i in parallel according to a decoding priority corresponding to the T second code stream data of the first code stream data i, to obtain T second Video clip其中,所述第一码流数据i为所述M个第一码流数据中的任意一个。The first code stream data i is any one of the M first code stream data.
- 根据权利要求24所述的设备,其特征在于,所述视频解码设备还包括:The device according to claim 24, wherein the video decoding device further comprises:剔除单元,用于在对所述M个第一码流数据中的每个第一码流数据对应的T个第二码流数据进行并行解码之前,剔除所述序列头中的所述第一语法元素和第二语法元素,所述第二语法元素用于指示所述第二视频片段中包括的第二图像的帧数N。a culling unit, configured to cull the first one of the sequence headers before performing parallel decoding on the T second code stream data corresponding to each of the M first code stream data And a second syntax element, the second syntax element is used to indicate the number N of frames of the second image included in the second video segment.
- 根据权利要求25所述的设备,其特征在于,任一第二视频片段包括N帧第二图像,所述拼接单元包括: The device according to claim 25, wherein any of the second video segments comprises an N-frame second image, and the splicing unit comprises:第一拼接子单元,用于将所述M个第一码流数据中的每个第一码流数据对应的T个第二视频片段中的N*T帧第二图像中,图像头相同的每T帧第二图像拼接在一起,得到M个第一视频片段,所述M个第一视频片段中的每个第一视频片段包括N帧第一图像,所述第一图像的分辨率大于所述第二图像的分辨率;a first splicing subunit, configured to: in the second image of the N*T frames in the T second video segments corresponding to each of the M first code stream data, the image header is the same The second image is spliced together every T frame to obtain M first video segments, each of the M first video segments includes an N frame first image, and the resolution of the first image is greater than The resolution of the second image;第二拼接子单元,用于对所述M个第一视频片段进行拼接,以得到所述源视频。 a second splicing subunit, configured to splicing the M first video segments to obtain the source video.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2017/108159 WO2019080136A1 (en) | 2017-10-28 | 2017-10-28 | Video encoding and decoding method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2017/108159 WO2019080136A1 (en) | 2017-10-28 | 2017-10-28 | Video encoding and decoding method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2019080136A1 true WO2019080136A1 (en) | 2019-05-02 |
Family
ID=66246153
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/108159 WO2019080136A1 (en) | 2017-10-28 | 2017-10-28 | Video encoding and decoding method and device |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2019080136A1 (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101389021A (en) * | 2007-09-14 | 2009-03-18 | 华为技术有限公司 | Video encoding/decoding method and apparatus |
CN101583041A (en) * | 2009-06-18 | 2009-11-18 | 中兴通讯股份有限公司 | Image filtering method of multi-core image encoding processing equipment and equipment |
US20100296575A1 (en) * | 2009-05-21 | 2010-11-25 | Microsoft Corporation | Optimized allocation of multi-core computation for video encoding |
CN105245897A (en) * | 2014-03-20 | 2016-01-13 | 南京云岩信息科技有限公司 | Efficient software for transcoding to hevc on multi-core processors |
-
2017
- 2017-10-28 WO PCT/CN2017/108159 patent/WO2019080136A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101389021A (en) * | 2007-09-14 | 2009-03-18 | 华为技术有限公司 | Video encoding/decoding method and apparatus |
US20100296575A1 (en) * | 2009-05-21 | 2010-11-25 | Microsoft Corporation | Optimized allocation of multi-core computation for video encoding |
CN101583041A (en) * | 2009-06-18 | 2009-11-18 | 中兴通讯股份有限公司 | Image filtering method of multi-core image encoding processing equipment and equipment |
CN105245897A (en) * | 2014-03-20 | 2016-01-13 | 南京云岩信息科技有限公司 | Efficient software for transcoding to hevc on multi-core processors |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7216351B2 (en) | Point cloud coding structure | |
JP7359153B2 (en) | Image processing device and method | |
US8180061B2 (en) | Concept for bridging the gap between parametric multi-channel audio coding and matrixed-surround multi-channel coding | |
US9853660B1 (en) | Techniques for parallel data compression | |
RU2007141934A (en) | ADAPTIVE GROUPING OF PARAMETERS FOR IMPROVED ENCODING EFFICIENCY | |
EP2916543A1 (en) | Method for coding/decoding depth image and coding/decoding device | |
US20220159288A1 (en) | Encoding device, decoding device, streaming system, and streaming method | |
US20170163992A1 (en) | Video compressing and playing method and device | |
JP2013219727A (en) | Image coding apparatus, image coding method and program, image decoding apparatus, image decoding method and program | |
US20190037219A1 (en) | Effective intra encoding for screen data | |
ES2709274T3 (en) | Coding and decoding of audio signals | |
JP6396452B2 (en) | Audio encoder and decoder | |
JP7358986B2 (en) | Decoding device, method, and program | |
CN103763556B (en) | Video image encoding and decoding devices and methods therefor, Transmission system and its method | |
WO2022262858A1 (en) | Image transmission method, image display and processing device, and image transmission system | |
JP2023533680A (en) | Decryption Tile Hash SEI Message for V3C/V-PCC | |
WO2021093882A1 (en) | Video meeting method, meeting terminal, server, and storage medium | |
CN109963185B (en) | Video data sending method, video display method, device, system and equipment | |
JP6545794B2 (en) | Apparatus for generating video output data stream, video source, video system, and method for generating video output data stream and video source data stream | |
CN109246433B (en) | Video encoding method and device, decoding method and device and video transmission system | |
KR101700752B1 (en) | Methods and devices for coding and decoding depth information, and video processing and playing device | |
WO2019080136A1 (en) | Video encoding and decoding method and device | |
WO2016003130A1 (en) | Method and apparatus for performing arithmetic coding by limited carry operation | |
KR102296987B1 (en) | Apparatus, method and system for hevc decoding image based on distributed system and machine learning model using block chain network | |
US20190141352A1 (en) | Tile-based 360 vr video encoding method and tile-based 360 vr video decoding method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17929548 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 17929548 Country of ref document: EP Kind code of ref document: A1 |