WO2017107446A1 - 转码的方法和装置 - Google Patents

转码的方法和装置 Download PDF

Info

Publication number
WO2017107446A1
WO2017107446A1 PCT/CN2016/088688 CN2016088688W WO2017107446A1 WO 2017107446 A1 WO2017107446 A1 WO 2017107446A1 CN 2016088688 W CN2016088688 W CN 2016088688W WO 2017107446 A1 WO2017107446 A1 WO 2017107446A1
Authority
WO
WIPO (PCT)
Prior art keywords
mode
ctu
video
macroblocks
macroblock
Prior art date
Application number
PCT/CN2016/088688
Other languages
English (en)
French (fr)
Inventor
蔡砚刚
白茂生
祁海
杨帆
刘阳
魏伟
Original Assignee
乐视控股(北京)有限公司
乐视云计算有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 乐视控股(北京)有限公司, 乐视云计算有限公司 filed Critical 乐视控股(北京)有限公司
Priority to US15/246,415 priority Critical patent/US20170188035A1/en
Publication of WO2017107446A1 publication Critical patent/WO2017107446A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods 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/17Methods 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/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/40Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video transcoding, i.e. partial or full decoding of a coded input stream followed by re-encoding of the decoded output stream

Definitions

  • the invention belongs to the technical field of computer network communication, and in particular relates to a method and device for transcoding.
  • H.264 also known as AVC (Advanced Video Coding)
  • H.265 also known as HEVCH (High Efficiency Video Coding)
  • H.265 Due to the efficient compression efficiency of H.265, In the foreseeable future, it will have a wide range of application scenarios, and it will shine in the industry. To this end, how to quickly transcode H.264 to H.265 is currently of concern.
  • a commonly used transcoding method is to decode an H.264 video block into an original video block and encode the original video block into an H.265 video block.
  • the existing transcoding method is a full solution and takes a long time.
  • the present invention discloses a method for transcoding, the method comprising:
  • 16 H.264 video macroblocks are transcoded into one H.265 tree according to a preset intra-frame transcoding correspondence.
  • Coding unit CTU
  • 16 H.264 video macroblocks are transcoded into one of the H according to a preset inter-frame transcoding correspondence. 265 CTU.
  • the present invention also discloses a device for transcoding, the device comprising: an obtaining module, configured to acquire 16 H.264 video macroblocks;
  • a determining module configured to determine a coding type of the 16 H.264 video macroblocks
  • a first transcoding module configured to: if the coding type of the 16 H.264 video macroblocks is intra-coded, convert the 16 H.264 video macroblocks according to a preset intra-frame transcoding correspondence
  • the code is 1 H.265 tree coding unit CTU;
  • a second transcoding module configured to: if the coding type of the 16 H.264 video macroblocks is inter-coded, convert the 16 H.264 video macroblocks according to a preset inter-frame transcoding correspondence
  • the code is one of the H.265 CTUs.
  • the invention also discloses a transcoding device, comprising: a memory, a processor, wherein
  • the memory is configured to store one or more instructions, wherein the one or more instructions are for execution by the processor;
  • the processor is configured to acquire 16 H.264 video macroblocks; determine an encoding type of 16 H.264 video macroblocks; if the encoding type of 16 H.264 video macroblocks is intraframe, follow the pre According to the intra-frame transcoding correspondence, 16 H.264 video macroblocks are transcoded into one H.265 tree coding unit CTU; if the coding type of 16 H.264 video macroblocks is inter-frame coding, according to the pre-pre The inter-frame transcoding correspondence is used to transcode 16 H.264 video macroblocks into one H.265 CTU.
  • the present invention can obtain the following technical effects:
  • 16 H.264 video macroblocks are transcoded into one H.265 tree coding unit CTU according to the preset intraframe transcoding correspondence. If the coding type of the 16 H.264 video macroblocks is inter-frame coding, 16 H.264 video macroblocks are transcoded into one H.265 tree coding unit CTU according to the preset inter-frame transcoding correspondence. It is not necessary to decode the H.264 video macroblock into original video data, which can speed up the transcoding process and save time.
  • FIG. 1 is a flowchart of a method for transcoding according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a first method for transcoding when an encoding mode is intraframe according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a first method for transcoding when an encoding mode is inter-frame according to an embodiment of the present invention
  • FIG. 4 is a flowchart of a method for transcoding when an encoding method is intraframe according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram of transcoding when an encoding mode is intra-frame according to an embodiment of the present invention.
  • FIG. 6 is a flowchart of a third method for transcoding when an encoding method is intraframe according to an embodiment of the present invention.
  • FIG. 7 is a flowchart of a fourth method for transcoding when an encoding mode is intraframe according to an embodiment of the present disclosure
  • FIG. 8 is a flowchart of a method for transcoding when the coding mode is inter-frame according to an embodiment of the present disclosure
  • FIG. 9 is a schematic diagram of transcoding when an encoding mode is inter-frame according to an embodiment of the present invention.
  • FIG. 10 is a flow chart of a third method for transcoding when the coding mode is inter-frame according to an embodiment of the present invention.
  • FIG. 11 is a flowchart of a fourth method for transcoding when an encoding mode is inter-frame according to an embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of a device for transcoding according to an embodiment of the present invention.
  • FIG. 13 is a schematic structural diagram of a device for transcoding according to an embodiment of the present invention.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media includes both permanent and non-persistent, removable and non-removable media.
  • Information storage can be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
  • computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
  • first device if a first device is coupled to a second device, the first device can be directly electrically coupled to the second device, or electrically coupled indirectly through other devices or coupling means. Connected to the second device.
  • FIG. 1 is a method for transcoding according to an embodiment of the present invention, including the following steps:
  • the size of the H.264 video macroblock is 16 ⁇ 16, and the H.265 adopts a fixed CTU (coding tree blocks) format, and the CTU size is 64 ⁇ 64, thereby 16 H.264 video macroblocks.
  • the CTU size is 64 ⁇ 64, thereby 16 H.264 video macroblocks.
  • 1 H.265 tree coding unit CTU corresponds to 1 H.265 tree coding unit CTU.
  • the coding types include intra coding and inter coding.
  • 16 H.264 video macroblocks are transcoded into one H according to the preset intraframe transcoding correspondence.
  • 265 tree coding unit CTU including:
  • S103a If the coding type of the 16 H.264 video macroblocks is intra-coded, the CU (Coding Unit) is determined according to a preset intra-frame, and the CU of the H.265 CTU is determined;
  • S103b determining, according to the determined CU of the H.265 CTU, the PU of the H.265 CTU according to the preset intra prediction unit PU determining the relationship;
  • S103c Determine, according to the determined CU of the H.265 CTU, the TU (Transform Unit) of the H.265 CTU according to the preset transform unit TU.
  • 16 H.264 video macroblocks are transcoded into one H according to the preset inter-frame transcoding correspondence.
  • 265 tree coding unit CTU including:
  • S104a If the coding type of the 16 H.264 video macroblocks is inter-frame coding, determining the relationship according to the preset inter-frame coding unit CU, determining the CU of the H.265 CTU;
  • S104b determining, according to the determined CU of the H.265 CTU, the PU of the H.265 CTU according to the preset inter-frame PU determining relationship;
  • S104c Determine, according to the determined CU of the H.265 CTU, the TU of the H.265 CTU according to the preset transform unit TU.
  • the CUs of the H.265 CTUs are determined according to the preset intra-frame coding unit CU, including:
  • each H.264 video macroblock 16 ⁇ 16
  • a 16 ⁇ 16 division mode in which a 16 ⁇ 16 subblock is composed of macroblocks, or 16 ⁇ 4 ⁇
  • the 4 sub-blocks constitute a 4 ⁇ 4 division mode of the macroblock.
  • 16 H.264 video macroblocks (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
  • 10 and 15 are 4 ⁇ 4 division modes
  • the corresponding CU of 15 is determined to be an 8x8 mode.
  • S203 The 16 H.264 video macroblocks are divided into four groups of video macroblocks, and each group of video macroblocks includes four H.264 video macroblocks, and each group of the video macroblock group has a shape of a square.
  • 16 H.264 video macroblocks (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) are divided.
  • the four sets of video macroblocks are: ⁇ 0,1,4,5 ⁇ , ⁇ 2,3,6,7 ⁇ , ⁇ 8,9,12,13 ⁇ , ⁇ 10,11,14,15 ⁇ .
  • the H.265 CTU corresponds to a video macroblock other than the first video macroblock in a certain group of video macroblocks.
  • the CU is determined to be in the 16x16 mode.
  • the remaining video macroblocks are all 16 ⁇ 16 division modes, and when a certain group of video macroblocks includes four 16 ⁇ 16 division mode video macroblocks, some The group video macroblock group will have 4 prediction directions ⁇ 0, 1, 2, 3 ⁇ . If the prediction direction of a group of video macroblock groups is different, the H.265 CTU and 4 16 ⁇ 16 partition mode video macros
  • the CU corresponding to the block is determined to be a 16 ⁇ 16 mode. For example, referring to FIG. 5, the CU corresponding to the video macroblock of the third group ⁇ 8, 9, 12, 13 ⁇ is determined to be a 16x16 mode.
  • each group of video macroblocks in the N sets of video macroblock groups includes four video macroblocks of 16 ⁇ 16 partition mode, and four 16 ⁇ 16 in each group of video macroblocks in the N sets of video macroblock groups.
  • the prediction direction of the video macroblock of the split mode is the same, when N is less than 4, the CU corresponding to each video macroblock in the N sets of video macroblocks of the H.265 CTU is determined to be 32 ⁇ 32 mode, when N is equal to 4
  • the CU corresponding to each video macroblock in the N sets of video macroblock groups of the H.265 CTU is determined to be a 64 ⁇ 64 mode.
  • each group of video macroblocks in all four groups of video macroblocks includes four video macroblocks of 16 ⁇ 16 partition mode, and four of each group of video macroblocks in the four groups of video macroblocks 16 ⁇ 16
  • the prediction direction of the video macroblock of the divided mode is the same, and the CU corresponding to each video macroblock in the four groups of video macroblocks of the H.265 CTU is determined to be 64 ⁇ 64 mode. If none of the four groups satisfies the above conditions, the video macroblock group containing the four 16 ⁇ 16 partition modes is satisfied, and four 16 ⁇ 16 partition modes in each group of video macroblocks in the video macroblock group are satisfied.
  • the CU corresponding to each video macroblock in the video macroblock group in which the prediction direction of the video macroblock is the same is determined to be 32 ⁇ 32 mode.
  • the CU corresponding to each video macroblock in the first group ⁇ 0, 1, 4, 5 ⁇ , the second group ⁇ 2, 3, 6, 7 ⁇ is determined to be a 32x32 mode.
  • S103b determines, according to the determined CU of the H.265 CTU, the PU of the H.265 CTU according to the preset intra prediction unit PU, including:
  • the intra prediction direction of the 264 video macroblock is mode H.264 2, and the PU prediction direction of the H.265 CTU is the best one selected from the mode H.265 0 and the mode H.265 1 if the H.264 video macro
  • the intra prediction direction of the block is mode H.264 3
  • the PU prediction direction of the H.265 CTU is the optimal one from the mode H.265 31, the mode H.265 32, and the mode H.265 33, if H.
  • the intra prediction direction of the 264 video macroblock is mode H.264 4, and the PU prediction direction of the H.265 CTU is the best one selected from the modes H.265 17, the mode H.265 18, and the mode H.265 19.
  • the intra prediction direction of the H.264 video macroblock is mode H.264 5
  • the PU prediction direction of the H.265 CTU is selected from the mode H.265 22, the mode H.265 23, and the mode H.265 24.
  • One, such as The intra prediction direction of the H.264 video macroblock is mode H.264 6, and the PU prediction direction of the H.265 CTU is selected from the mode H.265 12, the mode H.265 13 and the mode H.265 14
  • the intra prediction direction of the H.264 video macroblock is mode H.264 7, the PU prediction direction of the H.265 CTU is selected from the modes H.265 28, mode H.265 29, and mode H.265 30.
  • the PU prediction direction of the H.265 CTU is the slave mode H.265 3, mode H.265 4, mode H.265 5 and select the best one of the modes H.265 6.
  • intra prediction direction modes which can be represented as H.264 0, H.264 1, H.264 2, and H.264 3, respectively.
  • H.264 4 H.264 5, H.264 6, H.264 7, H.264 8.
  • the prediction mode of the intra prediction of the luma coding block is further extended to 35 types, including 0 (Planar mode), 1 (DC mode), and 33 directional modes (2-34).
  • selecting the optimal one from the mode H.265 0 and the mode H.265 1 may be implemented in any feasible manner, which is limited, for example, by calculating a rate distortion cost of the prediction direction mode. Compare choices. Other places where the best choices are similar are not repeated.
  • determining a PU (Predict Unit) of the H.265 CTU is a 2N ⁇ 2N mode, and if H.
  • the intra prediction direction of the 264 video macroblock is mode H.264 0
  • the PU prediction direction of the H.265 CTU is mode H.265 26
  • the intra prediction direction of the H.264 video macroblock is mode H.264 1
  • the PU prediction direction of the H.265 CTU is mode H.265 10.
  • the PU prediction direction of the H.265 CTU is the mode H.265 0
  • the intra prediction direction of the H.264 video macroblock is mode H.264 3
  • the PU prediction direction of the H.265 CTU is mode H.265 1.
  • intra prediction direction modes for the 16 ⁇ 16 partition mode of the H.264 video macroblock, there are four intra prediction direction modes, which can be represented as H.264 0, H.264 1, H.264 2, and H.264 3, respectively.
  • S103c determines, according to the determined TU of the H.265 CTU, the TU of the H.265 CTU according to the preset TU, including:
  • S104a if the coding type of the 16 H.264 video macroblocks is inter-frame coding, determining the CU of the H.265 CTU according to the preset inter-frame coding unit CU, including:
  • the 16 H.264 video macroblocks are divided into four groups of video macroblocks, and each group of the video macroblocks includes four H.264s.
  • a video macroblock, the shape of each set of video macroblocks is a square.
  • an inter-coded H.264 video macroblock it has multiple partition modes: one 16 ⁇ 16 sub-block, two 16 ⁇ 8 sub-blocks, two 8 ⁇ 16 sub-blocks, or four eight ⁇ 8 sub-blocks.
  • For each 8x8 sub-block it can be further divided into: an 8x8 sub-block, two 8x4 sub-blocks, two 4x8 sub-blocks, or four 4x4 sub-blocks.
  • 16 H.264 video macroblocks (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) are divided into The four sets of video macroblocks are: ⁇ 0,1,4,5 ⁇ , ⁇ 2,3,6,7 ⁇ , ⁇ 8,9,12,13 ⁇ , ⁇ 10,11,14,15 ⁇ .
  • S502 Determine a division mode of each video macroblock in the 16 H.264 video macroblocks.
  • the H.265 CTU corresponds to a video macroblock in a group of video macroblock groups.
  • the CU is determined to be in the 8x8 mode.
  • the CU corresponding to the video macroblock in the fourth group ⁇ 10, 11, 14, 15 ⁇ is determined to be an 8 ⁇ 8 mode.
  • the preset motion vector phase difference range threshold is set to (-2, 2).
  • the CU corresponding to the video macroblock in the third group ⁇ 8, 9, 12, 13 ⁇ is determined to be a 16 ⁇ 16 mode.
  • each group of video macroblocks in the N sets of video macroblock groups includes four video macroblocks of 16 ⁇ 16 partition mode, and four 16 ⁇ 16 in each group of video macroblocks in the N sets of video macroblock groups.
  • the prediction direction of the video macroblock of the partition mode is the same, when N is less than 4, and the difference between the motion vectors MV of the four video macroblocks of each group of the video macroblocks in the N sets of video macroblock groups is less than or equal to the preset motion vector difference
  • the CU corresponding to each video macroblock in the N sets of video macroblock groups of the H.265 CTU is determined to be a 32 ⁇ 32 mode, and when N is equal to 4, each of the H.265 CTU and the N sets of video macroblock groups
  • the CU corresponding to each video macroblock is determined to be a 64 ⁇ 64 mode.
  • each of the four groups of video macroblocks includes four 16 ⁇ 16 partition mode video macroblocks, and four 16 ⁇ 16 partitions in each of the four video macroblock groups
  • the prediction direction of the mode video macroblock is the same, and the CU corresponding to each video macroblock in the four groups of video macroblocks of the H.265 CTU is determined to be 64 ⁇ 64 mode.
  • S104b determines, according to the determined CU of the H.265 CTU, the PU of the H.265 CTU according to the preset inter-PU PU, including:
  • the inter prediction of H.265 supports 8 prediction modes: PART_2N ⁇ 2N, PART_2N ⁇ N, PART_N ⁇ 2N, PART_2N ⁇ nU, PART_2N ⁇ nD, PART_nL ⁇ 2N, PART_nR ⁇ 2N, PART_N ⁇ N.
  • the CB In the PART_2N ⁇ N, PART_N ⁇ 2N mode, the CB is divided into two PB blocks of the same size in the horizontal or vertical direction.
  • the use condition of the PART_N ⁇ N mode between frames is the same as the use condition of the intra PART_N ⁇ N mode.
  • the intermediate value of the MV may be selected as the reference MV.
  • the lower middle one may be selected as the reference MV by using the downward selection method.
  • a new MV is searched within a preset window range (for example, under a 2 x 2 window).
  • S104c determines, according to the determined TU of the H.265 CTU, the TU of the H.265 CTU according to the preset TU, including:
  • the coding type of the 16 H.264 video macroblocks is intra-frame coding
  • 16 H.264 video macroblocks are rotated according to the preset intra-frame transcoding correspondence relationship.
  • the code is 1 H.265 tree coding unit CTU
  • the coding type of 16 H.264 video macroblocks is frame Inter-coding
  • transcoding 16 H.264 video macroblocks into one H.265 tree coding unit CTU according to the preset inter-frame transcoding correspondence without decoding the H.264 video macroblock into original video data Can speed up the transcoding process and save time.
  • Determining the relationship between the CUs in the preset intraframe determining the CU of the H.265 CTU, determining the relationship according to the preset intra prediction unit PU, determining the PU of the H.265 CTU, determining the relationship according to the preset transform unit TU, and determining the TU of the H.265 CTU.
  • the H.264 video macroblock is transcoded into the H.265 tree coding unit CTU.
  • Determining the relationship between the CUs of the preset inter-frame determining the CU of the H.265 CTU, determining the relationship according to the preset inter-prediction unit PU, determining the PU of the H.265 CTU, determining the relationship according to the preset transform unit TU, and determining the TU of the H.265 CTU.
  • the H.264 video macroblock is transcoded into the H.265 tree coding unit CTU.
  • FIG. 12 is a device for transcoding according to an embodiment of the present invention, where the device includes:
  • a determining module 802 configured to determine a coding type of 16 H.264 video macroblocks
  • the first transcoding module 803 is configured to transcode 16 H.264 video macroblocks into 1 according to a preset intra-frame transcoding correspondence if the coding type of the 16 H.264 video macroblocks is intra-coded.
  • the second transcoding module 804 is configured to transcode 16 H.264 video macroblocks into 1 according to a preset inter-frame transcoding correspondence if the coding type of the 16 H.264 video macroblocks is inter-frame coding. H.265CTU.
  • the first transcoding module 803 includes:
  • a first CU determining unit configured to determine, if the coding type of the 16 H.264 video macroblocks is intra-coded, determine the CU of the H.265 CTU according to the preset intra-frame coding unit CU;
  • a first PU determining unit configured to determine a PU of the H.265 CTU according to the determined CU of the H.265 CTU according to the preset intra prediction unit PU;
  • the first TU determining unit is configured to determine, according to the determined CU of the H.265 CTU, the TU of the H.265 CTU according to the preset transform unit TU.
  • the first CU determining unit comprises:
  • a first split mode determining subunit configured to determine a split mode of each of the 16 H.264 video macroblocks if the coding type of the 16 H.264 video macroblocks is intra coded
  • a first 8 ⁇ 8 mode CU determining subunit configured to determine, when the partition mode of a certain first video macroblock is 4 ⁇ 4, the CU corresponding to the certain first video macroblock of the H.265 CTU is determined to be 8 ⁇ 8 mode;
  • a first dividing subunit configured to divide 16 H.264 video macroblocks into four groups of video macroblocks, each set of the video macroblock group including four H.264 video macroblocks, each group of the video
  • the shape of the macroblock group is a square
  • a first 16 ⁇ 16 mode CU determining subunit configured to: when a certain group of video macroblocks includes a first video macroblock of a 4 ⁇ 4 partitioning mode, and the H.265 CTU is separated from the certain group of video macroblocks
  • the CU corresponding to the other video macroblocks other than the first video macroblock is determined to be a 16 ⁇ 16 mode;
  • a second 16 ⁇ 16 mode CU determining subunit configured to: when a video macroblock of four 16 ⁇ 16 partition modes is included in the group of video macroblocks, if four video macroblocks of a 16 ⁇ 16 partition mode The prediction direction is different, and the CU corresponding to the video macroblocks of the four 16 ⁇ 16 partition modes of the H.265 CTU is determined to be a 16 ⁇ 16 mode;
  • each group of video macroblocks in the N sets of video macroblock groups includes four 16 ⁇ 16 partition mode video macroblocks, and each of the N sets of video macroblock groups
  • the prediction direction of the four 16 ⁇ 16 partition mode video macroblocks in the video macroblock group is the same, and when N is less than 4, the H.265 CTU corresponds to each video macroblock in the N sets of video macroblock groups.
  • the CU is determined to be a 32x32 mode, and when N is equal to 4, the CU of the H.265 CTU corresponding to each video macroblock in the N sets of video macroblocks is determined to be a 64x64 mode.
  • the first PU determining unit comprises:
  • a first PU determining subunit configured to determine that a PU of the H.265 CTU is in an N ⁇ N mode when the CU of the H.265 CTU is in an 8 ⁇ 8 mode, and if the intra prediction direction of the H.264 video macroblock is a mode H.264 0, the PU prediction direction of the H.265 CTU is mode H.265 26, and if the intra prediction direction of the H.264 video macroblock is mode H.264 1, the PU prediction direction of the H.265 CTU is mode H.
  • the PU prediction direction of the H.265 CTU is the best one selected from the mode H.265 0 and the mode H.265 1
  • the intra prediction direction of the H.264 video macroblock is mode H.264 3
  • the PU of the H.265 CTU The prediction direction is the optimal one selected from the modes H.265 31, mode H.265 32, and mode H.265 33.
  • the intra prediction direction of the H.264 video macroblock is mode H.264 4, then H.
  • the PU prediction direction of the 265 CTU is the best one selected from the mode H.265 17, the mode H.265 18, and the mode H.265 19.
  • the PU prediction direction of the H.265 CTU is the optimal one from the mode H.265 22, the mode H.265 23, and the mode H.265 24, if the intra prediction direction of the H.264 video macroblock is the mode H. 264 6.
  • the PU prediction direction of the H.265 CTU is the best one selected from the mode H.265 12, the mode H.265 13 and the mode H.265 14, if the intra prediction direction of the H.264 video macroblock is Mode H.264 7, the PU prediction direction of H.265 CTU is the best one selected from mode H.265 28, mode H.265 29 and mode H.265 30, if intraframe of H.264 video macroblock
  • the prediction direction is mode H.264 8
  • the PU prediction direction of the H.265 CTU is the best one selected from the mode H.265 3, the mode H.265 4, the mode H.265 5, and the mode H.265 6;
  • a second PU determining subunit configured to determine that the PU of the H.265 CTU is a 2N ⁇ 2N mode when the CU of the H.265 CTU is a 16 ⁇ 16 mode, a 32 ⁇ 32 mode, or a 64 ⁇ 64 mode, and if H.
  • the intra prediction direction of the 264 video macroblock is mode H.264 0
  • the PU prediction direction of the H.265 CTU is mode H.265 26
  • the intra prediction direction of the H.264 video macroblock is mode H.264 1
  • the PU prediction direction of the H.265 CTU is mode H.265 10.
  • the PU prediction direction of the H.265 CTU is the mode H.265 0
  • the intra prediction direction of the H.264 video macroblock is mode H.264 3
  • the PU prediction direction of the H.265 CTU is mode H.265 1.
  • the first TU determining unit comprises:
  • a first 32 ⁇ 32 mode TU determining subunit configured to: when the CU of the H.265 CTU is a 64 ⁇ 64 mode, select a TU of the H.265 CTU to be four 32 ⁇ 32 modes;
  • a second 32 ⁇ 32 mode TU determining subunit configured to: when the CU of the H.265 CTU is in a 32 ⁇ 32 mode, select a TU of the H.265 CTU to be a 32 ⁇ 32 mode;
  • a first 16 ⁇ 16 mode TU determining subunit configured to: when the CU of the H.265 CTU is in a 16 ⁇ 16 mode, select a TU of the H.265 CTU to be a 16 ⁇ 16 mode;
  • the first 8 ⁇ 8 mode TU determining subunit is used when the CU of the H.265 CTU is in the 8 ⁇ 8 mode, Then select the TU of H.265 CTU to be 8 ⁇ 8 mode.
  • the second transcoding module 804 includes:
  • a second CU determining unit configured to determine a CU of the H.265 CTU according to a preset inter-frame coding unit CU if the coding type of the 16 H.264 video macroblocks is inter-coded;
  • a second PU determining unit configured to determine, according to the determined CU of the H.265 CTU, the PU of the H.265 CTU according to the preset inter-PU PU;
  • a second TU determining unit configured to determine a TU of the H.265 CTU according to the determined CU of the H.265 CTU according to the determined transform unit TU.
  • the second CU determining unit comprises:
  • a second dividing subunit configured to divide 16 H.264 video macroblocks into four groups of video macroblocks, each group of the video macroblocks, if the encoding type of the 16 H.264 video macroblocks is inter encoding
  • the group includes four H.264 video macroblocks, and each group of the video macroblock group has a shape of a square;
  • a second split mode determining subunit configured to determine a partition mode of each of the 16 H.264 video macroblocks
  • a second 8 ⁇ 8 mode CU determining subunit configured to: when a video macroblock group of a certain group of video macroblocks includes a video macroblock of 8 ⁇ 8, 8 ⁇ 4, 4 ⁇ 8 or 4 ⁇ 4 partition mode, H.265 CTU and The CU corresponding to the video macroblock in the certain group of video macroblocks is determined to be an 8 ⁇ 8 mode;
  • a third 16 ⁇ 16 mode CU determining subunit configured to: when the certain group of video macroblocks does not include a video macroblock of a 16 ⁇ 16 partitioning mode, or four video macros of the certain group of video macroblocks When the difference of the motion vector MV of the block is greater than the preset motion vector phase difference range threshold, the CU corresponding to the video macroblock in the certain group of video macroblocks of the H.265 CTU is determined to be a 16 ⁇ 16 mode;
  • a second 32 and 64 mode determining subunit configured to: when each of the N sets of the video macroblock groups, the video macroblock group includes four 16 ⁇ 16 partition mode video macroblocks, and the N sets of the video macroblock group The prediction direction of the four 16 ⁇ 16 partition mode video macroblocks in each group of video macroblocks is the same, then when N is less than 4, and N sets of 4 video macroblock groups in the video macroblock group of N groups
  • the difference of the motion vector MV of the video macroblock is less than or equal to the preset motion vector phase difference range threshold
  • the CU corresponding to each video macroblock in the N group of the video macroblock groups of the H.265 CTU is determined to be a 32 ⁇ 32 mode.
  • the CU of the H.265 CTU corresponding to each of the video macroblocks of the N sets of the video macroblocks is determined to be a 64x64 mode.
  • the second PU determining unit comprises:
  • a third PU determining subunit configured to: when the CU of the H.265 CTU is in the 8 ⁇ 8 mode, if the H.264 video macroblock corresponding to the CU of the H.265 CTU is in the 8 ⁇ 4 partition mode, determine the PU of the H.265 CTU In the 2N ⁇ N mode, if the H.264 video macroblock corresponding to the CU of the H.265 CTU is in the 4 ⁇ 8 partition mode, it is determined that the PU of the H.265 CTU is in the N ⁇ 2N mode, and if the CU of the H.265 CTU corresponds to the H.
  • the 264 video macroblock is in a 4 ⁇ 4 partition mode, and the PU of the H.265 CTU is determined to be an N ⁇ N mode;
  • a fourth PU determining subunit configured to: when the CU of the H.265 CTU is in the 16 ⁇ 16 mode, if the H.264 video macroblock corresponding to the CU of the H.265 CTU is in the 16 ⁇ 16 partition mode, determine the PU of the H.265 CTU For the 2N ⁇ 2N mode, if the H.264 video macroblock corresponding to the CU of the H.265 CTU is a 16 ⁇ 8 partition mode, it is determined that the PU of the H.265 CTU is 2N ⁇ N mode, and if the H.265 CTU CU corresponds to H.
  • the 264 video macroblock is in a 64 ⁇ 64 partition mode, and the PU of the H.265 CTU is determined to be an N ⁇ 2N mode;
  • a fifth PU determining subunit configured to determine that the PU of the H.265 CTU is a 2N ⁇ 2N mode when the CU of the H.265 CTU is in a 32 ⁇ 32 or 64 ⁇ 64 mode;
  • a first MV determining subunit configured to: when the MV of the H.264 video macroblock corresponding to the CU of the H.265 CTU is the same, select the MV of the H.264 CTU of the H.264 CTU as the MV of the H.264 CTU;
  • a second MV determining subunit configured to: when the MVs of the H.264 video macroblocks corresponding to the CUs of the H.265 CTU are different, select a reference MV, and re-search for the new MV according to the reference MV, and use the new MV as H.265 CTU PU MV.
  • the second TU determining unit comprises:
  • a third 32 ⁇ 32 mode TU determining subunit configured to: when the CU of the H.265 CTU is a 64 ⁇ 64 mode, select a TU of the H.265 CTU to be four 32 ⁇ 32 modes;
  • a fourth 32 ⁇ 32 mode TU determining subunit configured to: when the CU of the H.265 CTU is a 32 ⁇ 32 mode, select a TU of the H.265 CTU to be a 32 ⁇ 32 mode;
  • a second 16 ⁇ 16 mode TU determining subunit configured to: when the CU of the H.265 CTU is in a 16 ⁇ 16 mode, select a TU of the H.265 CTU to be a 16 ⁇ 16 mode;
  • the second 8 ⁇ 8 mode TU determining subunit is configured to select the TU of the H.265 CTU to be the 8 ⁇ 8 mode when the CU of the H.265 CTU is the 8 ⁇ 8 mode.
  • the coding type of the 16 H.264 video macroblocks is intra-frame coding
  • 16 H.264 video macroblocks are rotated according to the preset intra-frame transcoding correspondence.
  • the code is a H.265 tree coding unit CTU. If the coding type of the 16 H.264 video macroblocks is inter-frame coding, 16 H.264 video macroblocks are rotated according to the preset inter-frame transcoding correspondence.
  • the code is a H.265 tree coding unit CTU, which does not need to decode the H.264 video macroblock into original video data, which can speed up the transcoding process and save time.
  • Determining the relationship between the CUs in the preset intraframe determining the CU of the H.265 CTU, determining the relationship according to the preset intra prediction unit PU, determining the PU of the H.265 CTU, determining the relationship according to the preset transform unit TU, and determining the TU of the H.265 CTU.
  • the H.264 video macroblock is transcoded into the H.265 tree coding unit CTU.
  • Determining the relationship between the CUs of the preset inter-frame determining the CU of the H.265 CTU, determining the relationship according to the preset inter-prediction unit PU, determining the PU of the H.265 CTU, determining the relationship according to the preset transform unit TU, and determining the TU of the H.265 CTU.
  • the H.264 video macroblock is transcoded into the H.265 tree coding unit CTU.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.
  • FIG. 13 is a device for transcoding according to an embodiment of the present invention, where the device includes:
  • the memory 901 is configured to store one or more instructions, wherein the one or more instructions are executed by the processor for calling;
  • the processor 902 is configured to acquire 16 H.264 video macroblocks; determine 16 H.264 video macros The coding type of the block; if the coding type of the 16 H.264 video macroblocks is intraframe coding, 16 H.264 video macroblocks are transcoded into one H.265 according to the preset intraframe transcoding correspondence.
  • the processor 902 can be configured to:
  • the CU is determined according to the preset intra-coding unit CU, and the CU of the H.265 CTU is determined;
  • the relationship is determined according to the preset transform unit TU, and the TU of the H.265 CTU is determined.
  • the processor 902 can be configured to:
  • the coding type of the 16 H.264 video macroblocks is intra coding, determining a division mode of each of the 16 H.264 video macroblocks;
  • the CU corresponding to the certain first video macroblock of the H.265 CTU is determined to be an 8 ⁇ 8 mode
  • the 16 H.264 video macroblocks are divided into four groups of video macroblocks, each of which includes four H.264 video macroblocks, and each group of the video macroblock groups has a shape of a square;
  • the H.265 CTU corresponds to other video macroblocks of the certain group of video macroblocks except the first video macroblock.
  • the CU is determined to be a 16 ⁇ 16 mode;
  • the video macroblock of the 16 ⁇ 16 partition mode When the video macroblock of the 16 ⁇ 16 partition mode is included in the video macroblock group of the certain group, if the prediction directions of the video macroblocks of the four 16 ⁇ 16 partition modes are different, the H.265 CTU and the 4 The CU corresponding to the video macroblock of the 16 ⁇ 16 partition mode is determined to be a 16 ⁇ 16 mode;
  • each group of video macroblocks in the N sets of video macroblocks includes four video macroblocks of 16 ⁇ 16 partition mode, and four 16 ⁇ 16 partition modes in each group of video macroblocks in the N sets of video macroblocks
  • the prediction direction of the video macroblock is the same, then when N is less than 4, the H.265 CTU and the N sets of video macroblocks
  • the CU corresponding to each video macroblock is determined to be a 32 ⁇ 32 mode, and when N is equal to 4, the CU corresponding to each video macroblock in the N sets of video macroblocks of the H.265 CTU is determined to be a 64 ⁇ 64 mode. .
  • the processor 902 is configured to:
  • the PU of the H.265 CTU is in the N ⁇ N mode, and if the intra prediction direction of the H.264 video macroblock is the mode H.264 0, the H.265 CTU The PU prediction direction is mode H.265 26.
  • the intra prediction direction of the H.264 video macroblock is mode H.264 1
  • the PU prediction direction of the H.265 CTU is mode H.265 10
  • the PU prediction direction of the H.265 CTU is the best one selected from the mode H.265 0 and the mode H.265 1 if the H.264 video macroblock
  • the intra prediction direction is mode H.264 3
  • the PU prediction direction of the H.265 CTU is the best one from the mode H.265 31, the mode H.265 32, and the mode H.265 33, if the H.264 video
  • the intra prediction direction of the macroblock is mode H.264 4
  • the PU prediction direction of the H.265 CTU is the best one from the mode H.265 17, the mode H.265 18, and the mode H.265 19, if H
  • the intra prediction direction of the .264 video macroblock is mode H.264 5
  • the PU prediction direction of the H.265 CTU is the best one from the mode H.
  • H.264 The intra prediction direction of the video macroblock is mode H.264 6, and the PU prediction direction of the H.265 CTU is the best one selected from the mode H.265 12, the mode H.265 13 and the mode H.265 14 if The intra prediction direction of the H.264 video macroblock is mode H.264 7, and the PU prediction direction of the H.265 CTU is selected from the mode H.265 28, the mode H.265 29, and the mode H.265 30.
  • the intra prediction direction of the H.264 video macroblock is mode H.264 8
  • the PU prediction direction of the H.265 CTU is slave mode H.265 3, mode H.265 4, mode H.265 5 and mode. Choose the best one of H.265 6;
  • the PU prediction direction of the H.265 CTU is mode H.265 26.
  • the PU prediction direction of the H.265 CTU is Mode H.265 10
  • the PU prediction direction of the H.265 CTU is mode H.265 0
  • the intraframe of the H.264 video macroblock Forecast direction For mode H.264 3, the PU prediction direction of H.265 CTU is mode H.265 1.
  • the processor 902 is configured to:
  • the TUs of the H.265 CTU are selected to be four 32 ⁇ 32 modes;
  • the TU of the H.265 CTU is selected to be the 32 ⁇ 32 mode
  • the TU of the H.265 CTU is selected to be the 16 ⁇ 16 mode
  • the TU of the H.265 CTU is selected to be the 8 ⁇ 8 mode.
  • the processor 902 is configured to:
  • the CU is determined according to the preset inter-frame coding unit CU, and the CU of the H.265 CTU is determined;
  • the relationship is determined according to the preset transform unit TU, and the TU of the H.265 CTU is determined.
  • the processor 902 is configured to:
  • 16 H.264 video macroblocks are divided into four groups of video macroblocks, and each group of the video macroblock groups includes four H.264s. a video macroblock, the shape of each set of the video macroblocks being a block;
  • the H.265 CTU corresponds to a video macroblock in the certain group of video macroblocks.
  • the CU is determined to be in the 8 ⁇ 8 mode;
  • the CU of the H.265 CTU corresponding to the video macroblock in the certain group of video macroblocks is determined when the difference between the motion vector MVs of the four video macroblocks in a group of video macroblocks is greater than the preset motion vector phase difference range threshold.
  • the 16 ⁇ 16 mode
  • each of the N sets of the video macroblock groups includes four 16 ⁇ 16 split mode video macroblocks, and N sets of the video macroblock groups, four of each of the video macroblock groups are 16
  • the prediction direction of the video macroblock of the ⁇ 16 split mode is the same, then when N is less than 4, and the difference between the motion vectors MV of the four video macroblocks of each group of the video macroblocks in the N sets of the video macroblock group is less than or equal to
  • the motion vector phase difference range threshold is set, the CU corresponding to each video macroblock in the N group of the video macroblock groups of the H.265 CTU is determined to be a 32 ⁇ 32 mode, and when N is equal to 4, the H.265 CTU and the N group are determined.
  • the CU corresponding to each video macroblock in the video macroblock group is determined to be a 64x64 mode.
  • the processor 902 is configured to:
  • the CU of the H.265 CTU When the CU of the H.265 CTU is in the 8 ⁇ 8 mode, if the H.264 video macroblock corresponding to the CU of the H.265 CTU is in the 8 ⁇ 4 partition mode, it is determined that the PU of the H.265 CTU is in the 2N ⁇ N mode, if H. The H.264 video macroblock corresponding to the 265 CTU CU is in the 4 ⁇ 8 partition mode, and the PU of the H.265 CTU is determined to be the N ⁇ 2N mode, if the H.264 video macroblock corresponding to the CU of the H.265 CTU is 4 ⁇ 4. Mode, determining that the PU of the H.265 CTU is in the N ⁇ N mode;
  • the CU of the H.265 CTU When the CU of the H.265 CTU is in the 16 ⁇ 16 mode, if the H.264 video macroblock corresponding to the CU of the H.265 CTU is in the 16 ⁇ 16 partition mode, it is determined that the PU of the H.265 CTU is in the 2N ⁇ 2N mode, if H. The H.264 video macroblock corresponding to the 265 CTU CU is in a 16 ⁇ 8 partition mode, and the PU of the H.265 CTU is determined to be a 2N ⁇ N mode, if the H.264 video macroblock corresponding to the CU of the H.265 CTU is 64 ⁇ 64. Mode, determining that the PU of the H.265 CTU is in the N ⁇ 2N mode;
  • the MV of the H.264 video macroblock corresponding to the CU of the H.265 CTU is the same, the MV of the H.264 video macroblock is selected as the MV of the PU of the H.265 CTU;
  • the reference MV is selected, and the new MV is re-searched according to the reference MV, and the new MV is used as the MV of the PU of the H.265 CTU.
  • the processor 902 is configured to:
  • the TUs of the H.265 CTU are selected to be four 32 ⁇ 32 modes;
  • the TU of the H.265 CTU is selected to be the 32 ⁇ 32 mode
  • the TU of the H.265 CTU is selected to be the 16 ⁇ 16 mode
  • the TU of the H.265 CTU is selected to be the 8 ⁇ 8 mode.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本发明公开了一种转码的方法和装置,所述方法包括:获取16个H.264视频宏块;判断16个所述H.264视频宏块的编码类型;如果16个所述H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个所述H.264视频宏块转码为1个H.265树编码单元CTU;如果16个所述H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个所述H.264视频宏块转码为1个所述H.265CTU。所述装置包括:获取模块、判断模块、第一转码模块和第二转码模块。本发明不需要将H.264视频宏块解码为原始视频数据,可以加速转码过程,节省时间。

Description

转码的方法和装置
交叉引用
本发明引用于2015年12月25日递交的名称为“转码的方法和装置”的第201510998049.5号中国专利发明,其通过引用被全部并入本发明。
技术领域
本发明属于计算机网络通信技术领域,具体地说,涉及一种转码的方法和装置。
背景技术
随着计算机网络通信技术的发展,视频已成为重要的信息传播、展示途径。为了便于视频的传播、展示,常常会对视频数据进行压缩编码,以前工业界的主流编码器采用的是H.264(也可以称为AVC(Advanced Video Coding,高级视频编码))编码标准,而H.265(也可以称为HEVCH(High Efficiency Video Coding,高效视频编码))在提供与H.264相同质量码流时,可以节省近50%的码率,由于H.265的高效压缩效率,在可以预见的未来,它必将拥有广泛的应用场景,在工业界绽放异彩。为此,如何将H.264快速转码为H.265是目前比较关注的。
目前,常用的一种转码方法是:将H.264视频块解码为原始视频块,将原始视频块编码为H.265视频块。
现有转码方法是全解全编,需要花费很长时间。
发明内容
本发明的目的在于提供了一种转码的方法和装置,用以解决现有技术中将H.264视频块转码为H.265视频块时需要花费很长时间的技术问题。
为了解决上述技术问题,本发明公开了一种转码的方法,所述方法包括:
获取16个H.264视频宏块;
判断16个所述H.264视频宏块的编码类型;
如果16个所述H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个所述H.264视频宏块转码为1个H.265树编码单元CTU;
如果16个所述H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个所述H.264视频宏块转码为1个所述H.265CTU。
为了解决上述技术问题,本发明还公开了一种转码的装置,所述装置包括:获取模块,用于获取16个H.264视频宏块;
判断模块,用于判断16个所述H.264视频宏块的编码类型;
第一转码模块,用于如果16个所述H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个所述H.264视频宏块转码为1个H.265树编码单元CTU;
第二转码模块,用于如果16个所述H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个所述H.264视频宏块转码为1个所述H.265CTU。
本发明还公开了一种转码的设备,包括:内存、处理器,其中,
所述内存,用于存储一条或多条指令,其中,所述一条或多条指令以供所述处理器调用执行;
所述处理器,用于获取16个H.264视频宏块;判断16个H.264视频宏块的编码类型;如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU;如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个H.264视频宏块转码为1个H.265CTU。
与现有技术相比,本发明可以获得包括以下技术效果:
如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU,如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU,不需要将H.264视频宏块解码为原始视频数据,可以加速转码过程,节省时间。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例提供的一种转码的方法流程图;
图2是本发明实施例提供的第一种当编码方式为帧内时转码的方法流程图;
图3是本发明实施例提供的第一种当编码方式为帧间时转码的方法流程图;
图4是本发明实施例提供的第二种当编码方式为帧内时转码的方法流程图;
图5是本发明实施例提供的一种当编码方式为帧内时转码的示意图;
图6是本发明实施例提供的第三种当编码方式为帧内时转码的方法流程图;
图7是本发明实施例提供的第四种当编码方式为帧内时转码的方法流程图;
图8是本发明实施例提供的第二种当编码方式为帧间时转码的方法流程图;
图9是本发明实施例提供的一种当编码方式为帧间时转码的示意图;
图10是本发明实施例提供的第三种当编码方式为帧间时转码的方法流 程图;
图11是本发明实施例提供的第四种当编码方式为帧间时转码的方法流程图;
图12是本发明实施例提供的一种转码的装置结构示意图;
图13是本发明实施例提供的一种转码的设备结构示意图。
具体实施方式
为使本发明的目的、技术方案和优点更加清楚,以下结合附图及具体实施例,对本发明作进一步地详细说明。在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
如在说明书及权利要求当中使用了某些词汇来指称特定组件。本领域技术人员应可理解,硬件制造商可能会用不同名词来称呼同一个组件。本说明书及权利要求并不以名称的差异来作为区分组件的方式,而是以组件在功能上的差异来作为区分的准则。如在通篇说明书及权利要求当中所提及的“包含” 为一开放式用语,故应解释成“包含但不限定于”。“大致”是指在可接收的误差范围内,本领域技术人员能够在一定误差范围内解决所述技术问题,基本达到所述技术效果。此外,“耦接”一词在此包含任何直接及间接的电性耦接手段。因此,若文中描述一第一装置耦接于一第二装置,则代表所述第一装置可直接电性耦接于所述第二装置,或通过其他装置或耦接手段间接地电性耦接至所述第二装置。说明书后续描述为实施本发明的较佳实施方式,然所述描述乃以说明本发明的一般原则为目的,并非用以限定本发明的范围。本发明的保护范围当视所附权利要求所界定者为准。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的商品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种商品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的商品或者系统中还存在另外的相同要素。
图1是本发明实施例提供的一种转码的方法,包括以下步骤:
S101:获取16个H.264视频宏块。
具体地,H.264视频宏块的大小为16×16,H.265采用固定CTU(coding tree blocks,树编码单元)格式,其CTU大小为64×64,从而16个H.264视频宏块对应1个H.265树编码单元CTU。
S102:判断16个H.264视频宏块的编码类型。
具体地,编码类型包括帧内编码和帧间编码。
S103:如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU。
其中,参见图2,如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU,包括:
S103a:如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内CU(Coding Unit,编码单元)确定关系,确定H.265CTU的CU;
S103b:根据确定的H.265CTU的CU,按照预设帧内预测单元PU确定关系,确定H.265CTU的PU;
S103c:根据确定的H.265CTU的CU,按照预设变换单元TU确定关系,确定H.265CTU的TU(Transform Unit,转换单位)。
S104:如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU。
其中,参见图3,如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU,包括:
S104a:如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间编码单元CU确定关系,确定H.265CTU的CU;
S104b:根据确定的H.265CTU的CU,按照预设帧间PU确定关系,确定H.265CTU的PU;
S104c:根据确定的H.265CTU的CU,按照预设变换单元TU确定关系,确定H.265CTU的TU。
具体地,参见图4,S103a如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内编码单元CU确定关系,确定H.265CTU的CU,包括:
S201:如果16个H.264视频宏块的编码类型为帧内编码,则确定16个H.264视频宏块中每个视频宏块的划分模式。
具体地,对于帧内编码每个H.264视频宏块(16×16)有两种划分模式:由1个16×16子块组成宏块的16×16划分模式,或由16个4×4子块组成宏块的4×4划分模式。
S202:当某第一视频宏块的划分模式是4×4时,H.265CTU的与某第一视频宏块对应的编码单元CU确定为8×8模式。
具体地,参见图5,16个H.264视频宏块(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)中,假设10、15为4×4划分模式,则10、 15对应的CU确定为8×8模式。
S203:将16个H.264视频宏块分为四组视频宏块组,每组视频宏块组中包括4个H.264视频宏块,每组视频宏块组的形状为方块。
具体地,参见图5,将16个H.264视频宏块(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)分为四组视频宏块组分别为:{0,1,4,5}、{2,3,6,7}、{8,9,12,13}、{10,11,14,15}。
S204:当某组视频宏块组中包含4×4划分模式的第一视频宏块时,H.265CTU的与某组视频宏块组中除第一视频宏块之外其他视频宏块对应的CU确定为16×16模式。
例如,参见图5,第四组{10,11,14,15}中,10、15为8×8模式,则11、14直接确定为16×16模式。
S205:当某组视频宏块组中包含4个16×16划分模式的视频宏块时,如果4个16×16划分模式的视频宏块的预测方向存在不同,则H.265CTU的与4个16×16划分模式的视频宏块对应的CU确定为16×16模式。
具体地,经过对4×4划分模式的判断之后,剩下的视频宏块全为16×16划分模式,当某组视频宏块组中包含4个16×16划分模式的视频宏块,某组视频宏块组将有4种预测方向{0,1,2,3},如果某组视频宏块组的预测方向存在不同,则H.265CTU的与4个16×16划分模式的视频宏块对应的CU确定为16×16模式。例如,参见图5,第三组{8,9,12,13}的视频宏块对应的CU确定为16×16模式。
S206:当N组视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4时,H.265CTU的与N组视频宏块组中每个视频宏块对应的CU确定为32×32模式,当N等于4时,H.265CTU的与N组视频宏块组中每个视频宏块对应的CU确定为64×64模式。
具体地,如果全部四组视频宏块组中每组视频宏块组均包含4个16×16划分模式的视频宏块,且四组视频宏块组中每组视频宏块组中的4个16×16 划分模式的视频宏块的预测方向相同,则H.265CTU的与四组视频宏块组中每个视频宏块对应的CU确定为64×64模式。如果不是四组全部满足上述条件,则满足上述视频宏块组包含4个16×16划分模式的视频宏块,且视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同的视频宏块组中的每个视频宏块对应的CU确定为32×32模式。例如,参见图5,第一组{0,1,4,5}、第二组{2,3,6,7}中每个视频宏块对应的CU确定为32×32模式。
具体地,参见图6,S103b根据确定的H.265CTU的CU,按照预设帧内预测单元PU确定关系,确定H.265CTU的PU,包括:
S301:当H.265CTU的CU为8×8模式时,确定H.265CTU的PU为N×N模式,并且,如果H.264视频宏块的帧内预测方向为模式H.264 0,则H.265CTU的PU预测方向为模式H.265 26,如果H.264视频宏块的帧内预测方向为模式H.264 1,则H.265CTU的PU预测方向为模式H.265 10,如果H.264视频宏块的帧内预测方向为模式H.264 2,则H.265CTU的PU预测方向为从模式H.265 0和模式H.265 1中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 3,则H.265CTU的PU预测方向为从模式H.265 31、模式H.265 32和模式H.265 33中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 4,则H.265CTU的PU预测方向为从模式H.265 17、模式H.265 18和模式H.265 19中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 5,则H.265CTU的PU预测方向为从模式H.265 22、模式H.265 23和模式H.265 24中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 6,则H.265CTU的PU预测方向为从模式H.265 12、模式H.265 13和模式H.265 14中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 7,则H.265CTU的PU预测方向为从模式H.265 28、模式H.265 29和模式H.265 30中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 8,则H.265CTU的PU预测方向为从模式H.265 3、模式H.265 4、模式H.265 5和模式H.265 6中选择最优的一个。
具体地,对于H.264视频宏块的4×4划分模式,共有9中帧内预测方向模式,可以分别表示为H.264 0、H.264 1、H.264 2、H.264 3、H.264 4、H.264 5、H.264 6、H.264 7、H.264 8。
具体地,在H.265中,亮度编码块的帧内预测的预测模式进一步扩展至35种,包含0(Planar模式)、1(DC模式)和33种方向模式(2-34)。
具体地,从模式H.265 0和模式H.265 1中选择最优的一个,可以采用任何可行的方式实现,对此做限定,例如,可以通过计算预测方向模式的率失真代价的方法进行比较选择。其他选择最优的地方类似,不再一一赘述。
S302:当H.265CTU的CU为16×16模式、32×32模式、或64×64模式时,确定H.265CTU的PU(Predict Unit,预测单位)为2N×2N模式,并且,如果H.264视频宏块的帧内预测方向为模式H.264 0,则H.265CTU的PU预测方向为模式H.265 26,如果H.264视频宏块的帧内预测方向为模式H.264 1,则H.265CTU的PU预测方向为模式H.265 10,如果H.264视频宏块的帧内预测方向为模式H.264 2,则H.265CTU的PU预测方向为模式H.265 0,如果H.264视频宏块的帧内预测方向为模式H.264 3,则H.265CTU的PU预测方向为模式H.265 1。
具体地,对于H.264视频宏块的16×16划分模式,共有4中帧内预测方向模式,可以分别表示为H.264 0、H.264 1、H.264 2、H.264 3。
具体地,参见图7,S103c根据确定的H.265CTU的CU,按照预设TU确定关系,确定H.265CTU的TU,包括:
S401:当H.265CTU的CU为64×64模式,则选择H.265CTU的TU为四个32×32模式。
S402:当H.265CTU的CU为32×32模式,则选择H.265CTU的TU为32×32模式。
S403:当H.265CTU的CU为16×16模式,则选择H.265CTU的TU为16×16模式。
S404:当H.265CTU的CU为8×8模式,则选择H.265CTU的TU为 8×8模式。
具体地,参见图8,S104a如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间编码单元CU确定关系,确定H.265CTU的CU,包括:
S501:如果16个H.264视频宏块的编码类型为帧间编码,将16个H.264视频宏块分为四组视频宏块组,每组视频宏块组中包括4个H.264视频宏块,每组视频宏块组的形状为方块。
具体地,对于一个帧间编码的H.264视频宏块,它有多种划分模式:一个16×16子块、二个16×8子块、二个8×16子块,或者四个8×8子块。对于每一个8×8子块,它还可以进一步划分为:一个8×8子块、两个8×4子块、两个4×8子块,或者四个4×4子块。
具体地,参见图9,16个H.264视频宏块(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)分为四组视频宏块组分别为:{0,1,4,5}、{2,3,6,7}、{8,9,12,13}、{10,11,14,15}。
S502:确定16个H.264视频宏块中每个视频宏块的划分模式。
S503:当某组视频宏块组中包含8×8、8×4、4×8或4×4划分模式的视频宏块时,H.265CTU的与某组视频宏块组中视频宏块对应的CU确定为8×8模式。
例如,假设10、15含有8×8以下的划分模式,则第四组{10,11,14,15}中视频宏块对应的CU确定为8×8模式。
S504:当某组视频宏块组中没有包含16×16划分模式的视频宏块、或某组视频宏块组中的4个视频宏块的运动矢量MV之差大于预设运动矢量相差范围阈值时,H.265CTU的与某组视频宏块组中视频宏块对应的CU确定为16×16模式。
具体地,设置预设运动矢量相差范围阈值为(-2,2)。
例如,假设8为16×8划分模式,则第三组{8,9,12,13}中视频宏块对应的CU确定为16×16模式。
S505:当N组视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4,且N组视频宏块组中每组视频宏块组的4个视频宏块的运动矢量MV之差小于等于预设运动矢量相差范围阈值时,H.265CTU的与N组视频宏块组中每个视频宏块对应的CU确定为32×32模式,当N等于4时,H.265CTU的与N组视频宏块组中每个视频宏块对应的CU确定为64×64模式。
具体地,如果所有的四组中每组视频宏块组包含4个16×16划分模式的视频宏块,且四组视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则H.265CTU的与四组视频宏块组中每个视频宏块对应的CU确定为64×64模式。
具体地,参见图10,S104b根据确定的H.265CTU的CU,按照预设帧间PU确定关系,确定H.265CTU的PU,包括:
S601:当H.265CTU的CU为8×8模式时,如果H.265CTU的CU对应的H.264视频宏块为8×4划分模式,则确定H.265CTU的PU为2N×N模式,如果H.265CTU的CU对应的H.264视频宏块为4×8划分模式,则确定H.265CTU的PU为N×2N模式,如果H.265CTU的CU对应的H.264视频宏块为4×4划分模式,则确定H.265CTU的PU为N×N模式。
具体地,H.265的帧间预测共支持8种预测模式:PART_2N×2N,PART_2N×N,PART_N×2N,PART_2N×nU,PART_2N×nD,PART_nL×2N,PART_nR×2N,PART_N×N。在PART_2N×N,PART_N×2N模式下,CB在水平或垂直方向上被划分成大小相同的两个PB块。在PART_2N×nU,PART_2N×nD,PART_nL×2N,PART_nR×2N模式下,CB块被划分成大小不同的两个PB块,这种划分模式称为非对称运动划分模式(asymmetric motion partitions,AMP),它是H.265新引入的帧间预测模式。帧间的PART_N×N模式的使用条件与帧内PART_N×N模式的使用条件相同。
S602:当H.265CTU的CU为16×16模式时,如果H.265CTU的CU对应的H.264视频宏块为16×16划分模式,则确定H.265CTU的PU为2N×2N 模式,如果H.265CTU的CU对应的H.264视频宏块为16×8划分模式,则确定H.265CTU的PU为2N×N模式,如果H.265CTU的CU对应的H.264视频宏块为64×64划分模式,则确定H.265CTU的PU为N×2N模式。
S603:当H.265CTU的CU为32×32或64×64模式时,确定H.265CTU的PU为2N×2N模式。
S604:当H.265CTU的CU对应的H.264视频宏块的MV相同时,则选取H.264视频宏块的MV为H.265CTU的PU的MV。
S605:当H.265CTU的CU对应的H.264视频宏块的MV不相同时,则选取参考MV,根据参考MV重新搜索新MV,将新MV作为H.265CTU的PU的MV。
具体地,选取参考MV时,可以选择MV的中间值作为参考MV,当不相同的MV的个数为偶数时,可以采用向下选择的方式选择中间较小者作为参考MV。在参考MV的基础上,在预设窗口范围内(例如2×2窗口下)搜索新MV。
具体地,参见图11,S104c根据确定的H.265CTU的CU,按照预设TU确定关系,确定H.265CTU的TU,包括:
S701:当H.265CTU的CU为64×64模式,则选择H.265CTU的TU为四个32×32模式。
S702:当H.265CTU的CU为32×32模式,则选择H.265CTU的TU为32×32模式。
S703:当H.265CTU的CU为16×16模式,则选择H.265CTU的TU为16×16模式。
S704:当H.265CTU的CU为8×8模式,则选择H.265CTU的TU为8×8模式。
本发明实施例所述的转码的方法,如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU,如果16个H.264视频宏块的编码类型为帧 间编码,则按照预设帧间转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU,不需要将H.264视频宏块解码为原始视频数据,可以加速转码过程,节省时间。按照预设帧内CU确定关系,确定H.265CTU的CU,按照预设帧内预测单元PU确定关系,确定H.265CTU的PU,按照预设变换单元TU确定关系,确定H.265CTU的TU,可以快速实现帧内编码时,将H.264视频宏块转码为H.265树编码单元CTU。按照预设帧间CU确定关系,确定H.265CTU的CU,按照预设帧间预测单元PU确定关系,确定H.265CTU的PU,按照预设变换单元TU确定关系,确定H.265CTU的TU,可以快速实现帧间编码时,将H.264视频宏块转码为H.265树编码单元CTU。
图12是本发明实施例提供的一种转码的装置,所述装置包括:
获取模块801,用于获取16个H.264视频宏块;
判断模块802,用于判断16个H.264视频宏块的编码类型;
第一转码模块803,用于如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU;
第二转码模块804,用于如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个H.264视频宏块转码为1个H.265CTU。
优选地,第一转码模块803包括:
第一CU确定单元,用于如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内编码单元CU确定关系,确定H.265CTU的CU;
第一PU确定单元,用于根据确定的H.265CTU的CU,按照预设帧内预测单元PU确定关系,确定H.265CTU的PU;
第一TU确定单元,用于根据确定的H.265CTU的CU,按照预设变换单元TU确定关系,确定H.265CTU的TU。
优选地,第一CU确定单元包括:
第一划分模式确定子单元,用于如果16个H.264视频宏块的编码类型为帧内编码,则确定16个H.264视频宏块中每个视频宏块的划分模式;
第一8×8模式CU确定子单元,用于当某第一视频宏块的划分模式是4×4时,H.265CTU的与所述某第一视频宏块对应的CU确定为8×8模式;
第一划分子单元,用于将16个H.264视频宏块分为四组视频宏块组,每组所述视频宏块组中包括4个H.264视频宏块,每组所述视频宏块组的形状为方块;
第一16×16模式CU确定子单元,用于当某组视频宏块组中包含4×4划分模式的第一视频宏块时,H.265CTU的与所述某组视频宏块组中除第一视频宏块之外其他视频宏块对应的CU确定为16×16模式;
第二16×16模式CU确定子单元,用于当所述某组视频宏块组中包含4个16×16划分模式的视频宏块时,如果4个16×16划分模式的视频宏块的预测方向存在不同,则H.265CTU的与4个16×16划分模式的视频宏块对应的CU确定为16×16模式;
第一32和64模式CU确定子单元,用于当N组视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4时,H.265CTU的与所述N组视频宏块组中每个视频宏块对应的CU确定为32×32模式,当N等于4时,H.265CTU的与所述N组视频宏块组中每个视频宏块对应的CU确定为64×64模式。
优选地,第一PU确定单元包括:
第一PU确定子单元,用于当H.265CTU的CU为8×8模式时,确定H.265CTU的PU为N×N模式,并且,如果H.264视频宏块的帧内预测方向为模式H.264 0,则H.265CTU的PU预测方向为模式H.265 26,如果H.264视频宏块的帧内预测方向为模式H.264 1,则H.265CTU的PU预测方向为模式H.265 10,如果H.264视频宏块的帧内预测方向为模式H.264 2,则H.265CTU的PU预测方向为从模式H.265 0和模式H.265 1中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 3,则H.265CTU的PU 预测方向为从模式H.265 31、模式H.265 32和模式H.265 33中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 4,则H.265CTU的PU预测方向为从模式H.265 17、模式H.265 18和模式H.265 19中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 5,则H.265CTU的PU预测方向为从模式H.265 22、模式H.265 23和模式H.265 24中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 6,则H.265CTU的PU预测方向为从模式H.265 12、模式H.265 13和模式H.265 14中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 7,则H.265CTU的PU预测方向为从模式H.265 28、模式H.265 29和模式H.265 30中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 8,则H.265CTU的PU预测方向为从模式H.265 3、模式H.265 4、模式H.265 5和模式H.265 6中选择最优的一个;
第二PU确定子单元,用于当H.265CTU的CU为16×16模式、32×32模式、或64×64模式时,确定H.265CTU的PU为2N×2N模式,并且,如果H.264视频宏块的帧内预测方向为模式H.264 0,则H.265CTU的PU预测方向为模式H.265 26,如果H.264视频宏块的帧内预测方向为模式H.264 1,则H.265CTU的PU预测方向为模式H.265 10,如果H.264视频宏块的帧内预测方向为模式H.264 2,则H.265CTU的PU预测方向为模式H.265 0,如果H.264视频宏块的帧内预测方向为模式H.264 3,则H.265CTU的PU预测方向为模式H.265 1。
优选地,第一TU确定单元包括:
第一32×32模式TU确定子单元,用于当H.265CTU的CU为64×64模式,则选择H.265CTU的TU为四个32×32模式;
第二32×32模式TU确定子单元,用于当H.265CTU的CU为32×32模式,则选择H.265CTU的TU为32×32模式;
第一16×16模式TU确定子单元,用于当H.265CTU的CU为16×16模式,则选择H.265CTU的TU为16×16模式;
第一8×8模式TU确定子单元,用于当H.265CTU的CU为8×8模式, 则选择H.265CTU的TU为8×8模式。
优选地,第二转码模块804包括:
第二CU确定单元,用于如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间编码单元CU确定关系,确定H.265CTU的CU;
第二PU确定单元,用于根据确定的H.265CTU的CU,按照预设帧间PU确定关系,确定H.265CTU的PU;
第二TU确定单元,用于根据确定的H.265CTU的CU,按照预设变换单元TU确定关系,确定H.265CTU的TU。
优选地,第二CU确定单元包括:
第二划分子单元,用于如果16个H.264视频宏块的编码类型为帧间编码,将16个H.264视频宏块分为四组视频宏块组,每组所述视频宏块组中包括4个H.264视频宏块,每组所述视频宏块组的形状为方块;
第二划分模式确定子单元,用于确定16个H.264视频宏块中每个视频宏块的划分模式;
第二8×8模式CU确定子单元,用于当某组视频宏块组中包含8×8、8×4、4×8或4×4划分模式的视频宏块时,H.265CTU的与所述某组视频宏块组中视频宏块对应的CU确定为8×8模式;
第三16×16模式CU确定子单元,用于当所述某组视频宏块组中没有包含16×16划分模式的视频宏块、或所述某组视频宏块组中的4个视频宏块的运动矢量MV之差大于预设运动矢量相差范围阈值时,H.265CTU的与所述某组视频宏块组中视频宏块对应的CU确定为16×16模式;
第二32和64模式确定子单元,用于当N组所述视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组所述视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4,且N组所述视频宏块组中每组视频宏块组的4个视频宏块的运动矢量MV之差小于等于预设运动矢量相差范围阈值时,H.265CTU的与N组所述视频宏块组中每个视频宏块对应的CU确定为32×32模式,当N等于4时, H.265CTU的与N组所述视频宏块组中每个视频宏块对应的CU确定为64×64模式。
优选地,第二PU确定单元包括:
第三PU确定子单元,用于当H.265CTU的CU为8×8模式时,如果H.265CTU的CU对应的H.264视频宏块为8×4划分模式,则确定H.265CTU的PU为2N×N模式,如果H.265CTU的CU对应的H.264视频宏块为4×8划分模式,则确定H.265CTU的PU为N×2N模式,如果H.265CTU的CU对应的H.264视频宏块为4×4划分模式,则确定H.265CTU的PU为N×N模式;
第四PU确定子单元,用于当H.265CTU的CU为16×16模式时,如果H.265CTU的CU对应的H.264视频宏块为16×16划分模式,则确定H.265CTU的PU为2N×2N模式,如果H.265CTU的CU对应的H.264视频宏块为16×8划分模式,则确定H.265CTU的PU为2N×N模式,如果H.265CTU的CU对应的H.264视频宏块为64×64划分模式,则确定H.265CTU的PU为N×2N模式;
第五PU确定子单元,用于当H.265CTU的CU为32×32或64×64模式时,确定H.265CTU的PU为2N×2N模式;
第一MV确定子单元,用于当H.265CTU的CU对应的H.264视频宏块的MV相同时,则选取H.264视频宏块的MV为H.265CTU的PU的MV;
第二MV确定子单元,用于当H.265CTU的CU对应的H.264视频宏块的MV不相同时,则选取参考MV,根据所述参考MV重新搜索新MV,将所述新MV作为H.265CTU的PU的MV。
优选地,第二TU确定单元包括:
第三32×32模式TU确定子单元,用于当H.265CTU的CU为64×64模式,则选择H.265CTU的TU为四个32×32模式;
第四32×32模式TU确定子单元,用于当H.265CTU的CU为32×32模式,则选择H.265CTU的TU为32×32模式;
第二16×16模式TU确定子单元,用于当H.265CTU的CU为16×16模式,则选择H.265CTU的TU为16×16模式;
第二8×8模式TU确定子单元,用于当H.265CTU的CU为8×8模式,则选择H.265CTU的TU为8×8模式。
本发明实施例所述的转码的装置,如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU,如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU,不需要将H.264视频宏块解码为原始视频数据,可以加速转码过程,节省时间。按照预设帧内CU确定关系,确定H.265CTU的CU,按照预设帧内预测单元PU确定关系,确定H.265CTU的PU,按照预设变换单元TU确定关系,确定H.265CTU的TU,可以快速实现帧内编码时,将H.264视频宏块转码为H.265树编码单元CTU。按照预设帧间CU确定关系,确定H.265CTU的CU,按照预设帧间预测单元PU确定关系,确定H.265CTU的PU,按照预设变换单元TU确定关系,确定H.265CTU的TU,可以快速实现帧间编码时,将H.264视频宏块转码为H.265树编码单元CTU。
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
图13是本发明实施例提供的一种转码的设备,所述设备包括:
内存901以及处理器902,其中,
内存901,用于存储一条或多条指令,其中,所述一条或多条指令以供所述处理器调用执行;
处理器902,用于获取16个H.264视频宏块;判断16个H.264视频宏 块的编码类型;如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个H.264视频宏块转码为1个H.265树编码单元CTU;如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个H.264视频宏块转码为1个H.265CTU。
优选地,处理器902,可以用于:
如果16个H.264视频宏块的编码类型为帧内编码,则按照预设帧内编码单元CU确定关系,确定H.265CTU的CU;
根据确定的H.265CTU的CU,按照预设帧内预测单元PU确定关系,确定H.265CTU的PU;
根据确定的H.265CTU的CU,按照预设变换单元TU确定关系,确定H.265CTU的TU。
优选地,处理器902,可以用于:
如果16个H.264视频宏块的编码类型为帧内编码,则确定16个H.264视频宏块中每个视频宏块的划分模式;
当某第一视频宏块的划分模式是4×4时,H.265CTU的与所述某第一视频宏块对应的CU确定为8×8模式;
将16个H.264视频宏块分为四组视频宏块组,每组所述视频宏块组中包括4个H.264视频宏块,每组所述视频宏块组的形状为方块;
当某组视频宏块组中包含4×4划分模式的第一视频宏块时,H.265CTU的与所述某组视频宏块组中除第一视频宏块之外其他视频宏块对应的CU确定为16×16模式;
当所述某组视频宏块组中包含4个16×16划分模式的视频宏块时,如果4个16×16划分模式的视频宏块的预测方向存在不同,则H.265CTU的与4个16×16划分模式的视频宏块对应的CU确定为16×16模式;
当N组视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4时,H.265CTU的与所述N组视频宏块组 中每个视频宏块对应的CU确定为32×32模式,当N等于4时,H.265CTU的与所述N组视频宏块组中每个视频宏块对应的CU确定为64×64模式。
优选地,处理器902,用于:
当H.265CTU的CU为8×8模式时,确定H.265CTU的PU为N×N模式,并且,如果H.264视频宏块的帧内预测方向为模式H.264 0,则H.265CTU的PU预测方向为模式H.265 26,如果H.264视频宏块的帧内预测方向为模式H.264 1,则H.265CTU的PU预测方向为模式H.265 10,如果H.264视频宏块的帧内预测方向为模式H.264 2,则H.265CTU的PU预测方向为从模式H.265 0和模式H.265 1中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 3,则H.265CTU的PU预测方向为从模式H.265 31、模式H.265 32和模式H.265 33中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 4,则H.265CTU的PU预测方向为从模式H.265 17、模式H.265 18和模式H.265 19中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 5,则H.265CTU的PU预测方向为从模式H.265 22、模式H.265 23和模式H.265 24中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 6,则H.265CTU的PU预测方向为从模式H.265 12、模式H.265 13和模式H.265 14中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 7,则H.265CTU的PU预测方向为从模式H.265 28、模式H.265 29和模式H.265 30中选择最优的一个,如果H.264视频宏块的帧内预测方向为模式H.264 8,则H.265CTU的PU预测方向为从模式H.265 3、模式H.265 4、模式H.265 5和模式H.265 6中选择最优的一个;
当H.265CTU的CU为16×16模式、32×32模式、或64×64模式时,确定H.265CTU的PU为2N×2N模式,并且,如果H.264视频宏块的帧内预测方向为模式H.264 0,则H.265CTU的PU预测方向为模式H.265 26,如果H.264视频宏块的帧内预测方向为模式H.264 1,则H.265CTU的PU预测方向为模式H.265 10,如果H.264视频宏块的帧内预测方向为模式H.264 2,则H.265CTU的PU预测方向为模式H.265 0,如果H.264视频宏块的帧内预测方向 为模式H.264 3,则H.265CTU的PU预测方向为模式H.265 1。
优选地,处理器902,用于:
当H.265CTU的CU为64×64模式,则选择H.265CTU的TU为四个32×32模式;
当H.265CTU的CU为32×32模式,则选择H.265CTU的TU为32×32模式;
当H.265CTU的CU为16×16模式,则选择H.265CTU的TU为16×16模式;
当H.265CTU的CU为8×8模式,则选择H.265CTU的TU为8×8模式。
优选地,处理器902,用于:
如果16个H.264视频宏块的编码类型为帧间编码,则按照预设帧间编码单元CU确定关系,确定H.265CTU的CU;
根据确定的H.265CTU的CU,按照预设帧间PU确定关系,确定H.265CTU的PU;
根据确定的H.265CTU的CU,按照预设变换单元TU确定关系,确定H.265CTU的TU。
优选地,处理器902,用于:
如果16个H.264视频宏块的编码类型为帧间编码,将16个H.264视频宏块分为四组视频宏块组,每组所述视频宏块组中包括4个H.264视频宏块,每组所述视频宏块组的形状为方块;
确定16个H.264视频宏块中每个视频宏块的划分模式;
当某组视频宏块组中包含8×8、8×4、4×8或4×4划分模式的视频宏块时,H.265CTU的与所述某组视频宏块组中视频宏块对应的CU确定为8×8模式;
当所述某组视频宏块组中没有包含16×16划分模式的视频宏块、或所述 某组视频宏块组中的4个视频宏块的运动矢量MV之差大于预设运动矢量相差范围阈值时,H.265CTU的与所述某组视频宏块组中视频宏块对应的CU确定为16×16模式;
当N组所述视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组所述视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4,且N组所述视频宏块组中每组视频宏块组的4个视频宏块的运动矢量MV之差小于等于预设运动矢量相差范围阈值时,H.265CTU的与N组所述视频宏块组中每个视频宏块对应的CU确定为32×32模式,当N等于4时,H.265CTU的与N组所述视频宏块组中每个视频宏块对应的CU确定为64×64模式。
优选地,处理器902,用于:
当H.265CTU的CU为8×8模式时,如果H.265CTU的CU对应的H.264视频宏块为8×4划分模式,则确定H.265CTU的PU为2N×N模式,如果H.265CTU的CU对应的H.264视频宏块为4×8划分模式,则确定H.265CTU的PU为N×2N模式,如果H.265CTU的CU对应的H.264视频宏块为4×4划分模式,则确定H.265CTU的PU为N×N模式;
当H.265CTU的CU为16×16模式时,如果H.265CTU的CU对应的H.264视频宏块为16×16划分模式,则确定H.265CTU的PU为2N×2N模式,如果H.265CTU的CU对应的H.264视频宏块为16×8划分模式,则确定H.265CTU的PU为2N×N模式,如果H.265CTU的CU对应的H.264视频宏块为64×64划分模式,则确定H.265CTU的PU为N×2N模式;
当H.265CTU的CU为32×32或64×64模式时,确定H.265CTU的PU为2N×2N模式;
当H.265CTU的CU对应的H.264视频宏块的MV相同时,则选取H.264视频宏块的MV为H.265CTU的PU的MV;
当H.265CTU的CU对应的H.264视频宏块的MV不相同时,则选取参考MV,根据所述参考MV重新搜索新MV,将所述新MV作为H.265CTU的PU的MV。
优选地,处理器902,用于:
当H.265CTU的CU为64×64模式,则选择H.265CTU的TU为四个32×32模式;
当H.265CTU的CU为32×32模式,则选择H.265CTU的TU为32×32模式;
当H.265CTU的CU为16×16模式,则选择H.265CTU的TU为16×16模式;
当H.265CTU的CU为8×8模式,则选择H.265CTU的TU为8×8模式。
本设备的技术方案和各模块的功能特征、连接方式,与图1~图11对应实施例所描述的特征和技术方案相对应,不足之处请参见前述图1~图11对应实施例。
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims (18)

  1. 一种转码的方法,其特征在于,所述方法包括:
    获取16个H.264视频宏块;
    判断16个所述H.264视频宏块的编码类型;
    如果16个所述H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个所述H.264视频宏块转码为1个H.265树编码单元CTU;
    如果16个所述H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个所述H.264视频宏块转码为1个所述H.265CTU。
  2. 根据权利要求1所述的方法,其特征在于,如果16个所述H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个所述H.264视频宏块转码为1个H.265树编码单元CTU,包括:
    如果16个所述H.264视频宏块的编码类型为帧内编码,则按照预设帧内编码单元CU确定关系,确定所述H.265CTU的CU;
    根据确定的所述H.265CTU的CU,按照预设帧内预测单元PU确定关系,确定所述H.265CTU的PU;
    根据确定的所述H.265CTU的CU,按照预设变换单元TU确定关系,确定所述H.265CTU的TU。
  3. 根据权利要求2所述的方法,其特征在于,如果16个所述H.264视频宏块的编码类型为帧内编码,则按照预设帧内编码单元CU确定关系,确定所述H.265CTU的CU,包括:
    如果16个所述H.264视频宏块的编码类型为帧内编码,则确定16个所述H.264视频宏块中每个视频宏块的划分模式;
    当某第一视频宏块的划分模式是4×4时,所述H.265CTU的与所述某第一视频宏块对应的CU确定为8×8模式;
    将16个所述H.264视频宏块分为四组视频宏块组,每组所述视频宏块 组中包括4个所述H.264视频宏块,每组所述视频宏块组的形状为方块;
    当某组视频宏块组中包含4×4划分模式的第一视频宏块时,所述H.265CTU的与所述某组视频宏块组中除所述第一视频宏块之外其他视频宏块对应的CU确定为16×16模式;
    当所述某组视频宏块组中包含4个16×16划分模式的视频宏块时,如果4个16×16划分模式的视频宏块的预测方向存在不同,则所述H.265CTU的与4个16×16划分模式的视频宏块对应的CU确定为16×16模式;
    当N组视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4时,所述H.265CTU的与所述N组视频宏块组中每个视频宏块对应的CU确定为32×32模式,当N等于4时,所述H.265CTU的与所述N组视频宏块组中每个视频宏块对应的CU确定为64×64模式。
  4. 根据权利要求3所述的方法,其特征在于,根据确定的所述H.265CTU的CU,按照预设帧内预测单元PU确定关系,确定所述H.265CTU的PU,包括:
    当所述H.265CTU的CU为8×8模式时,确定所述H.265CTU的PU为N×N模式,并且,如果所述H.264视频宏块的帧内预测方向为模式H.264 0,则所述H.265CTU的PU预测方向为模式H.265 26,如果所述H.264视频宏块的帧内预测方向为模式H.264 1,则所述H.265CTU的PU预测方向为模式H.265 10,如果所述H.264视频宏块的帧内预测方向为模式H.264 2,则所述H.265CTU的PU预测方向为从模式H.265 0和模式H.265 1中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 3,则所述H.265CTU的PU预测方向为从模式H.265 31、模式H.265 32和模式H.265 33中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 4,则所述H.265CTU的PU预测方向为从模式H.265 17、模式H.265 18和模式H.265 19中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 5,则所述H.265CTU的PU预测方向为从模式H.265  22、模式H.265 23和模式H.265 24中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 6,则所述H.265CTU的PU预测方向为从模式H.265 12、模式H.265 13和模式H.265 14中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 7,则所述H.265CTU的PU预测方向为从模式H.265 28、模式H.265 29和模式H.265 30中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 8,则所述H.265CTU的PU预测方向为从模式H.265 3、模式H.265 4、模式H.265 5和模式H.265 6中选择最优的一个;
    当所述H.265CTU的CU为16×16模式、32×32模式、或64×64模式时,确定所述H.265CTU的PU为2N×2N模式,并且,如果所述H.264视频宏块的帧内预测方向为模式H.264 0,则所述H.265CTU的PU预测方向为模式H.265 26,如果所述H.264视频宏块的帧内预测方向为模式H.264 1,则所述H.265CTU的PU预测方向为模式H.265 10,如果所述H.264视频宏块的帧内预测方向为模式H.264 2,则所述H.265CTU的PU预测方向为模式H.265 0,如果所述H.264视频宏块的帧内预测方向为模式H.264 3,则所述H.265CTU的PU预测方向为模式H.265 1。
  5. 根据权利要求3所述的方法,其特征在于,根据确定的所述H.265CTU的CU,按照预设变换单元TU确定关系,确定所述H.265CTU的TU,包括:
    当所述H.265CTU的CU为64×64模式,则选择所述H.265CTU的TU为四个32×32模式;
    当所述H.265CTU的CU为32×32模式,则选择所述H.265CTU的TU为32×32模式;
    当所述H.265CTU的CU为16×16模式,则选择所述H.265CTU的TU为16×16模式;
    当所述H.265CTU的CU为8×8模式,则选择所述H.265CTU的TU为8×8模式。
  6. 根据权利要求1所述的方法,其特征在于,如果16个所述H.264视 频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个所述H.264视频宏块转码为1个所述H.265CTU,包括:
    如果16个所述H.264视频宏块的编码类型为帧间编码,则按照预设帧间编码单元CU确定关系,确定所述H.265CTU的CU;
    根据确定的所述H.265CTU的CU,按照预设帧间PU确定关系,确定所述H.265CTU的PU;
    根据确定的所述H.265CTU的CU,按照预设变换单元TU确定关系,确定所述H.265CTU的TU。
  7. 根据权利要求6所述的方法,其特征在于,如果16个所述H.264视频宏块的编码类型为帧间编码,则按照预设帧间编码单元CU确定关系,确定所述H.265CTU的CU,包括:
    如果16个所述H.264视频宏块的编码类型为帧间编码,将16个所述H.264视频宏块分为四组视频宏块组,每组所述视频宏块组中包括4个所述H.264视频宏块,每组所述视频宏块组的形状为方块;
    确定16个所述H.264视频宏块中每个视频宏块的划分模式;
    当某组视频宏块组中包含8×8、8×4、4×8或4×4划分模式的视频宏块时,所述H.265CTU的与所述某组视频宏块组中视频宏块对应的CU确定为8×8模式;
    当所述某组视频宏块组中没有包含16×16划分模式的视频宏块、或所述某组视频宏块组中的4个视频宏块的运动矢量MV之差大于预设运动矢量相差范围阈值时,所述H.265CTU的与所述某组视频宏块组中视频宏块对应的CU确定为16×16模式;
    当N组所述视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组所述视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4,且N组所述视频宏块组中每组视频宏块组的4个视频宏块的运动矢量MV之差小于等于预设运动矢量相差范围阈值时,所述H.265CTU的与N组所述视频宏块组中每个视频宏块对 应的CU确定为32×32模式,当N等于4时,所述H.265CTU的与N组所述视频宏块组中每个视频宏块对应的CU确定为64×64模式。
  8. 根据权利要求7所述的方法,其特征在于,根据确定的所述H.265CTU的CU,按照预设帧间PU确定关系,确定所述H.265CTU的PU,包括:
    当所述H.265CTU的CU为8×8模式时,如果所述H.265CTU的CU对应的所述H.264视频宏块为8×4划分模式,则确定所述H.265CTU的PU为2N×N模式,如果所述H.265CTU的CU对应的所述H.264视频宏块为4×8划分模式,则确定所述H.265CTU的PU为N×2N模式,如果所述H.265CTU的CU对应的所述H.264视频宏块为4×4划分模式,则确定所述H.265CTU的PU为N×N模式;
    当所述H.265CTU的CU为16×16模式时,如果所述H.265CTU的CU对应的所述H.264视频宏块为16×16划分模式,则确定所述H.265CTU的PU为2N×2N模式,如果所述H.265CTU的CU对应的所述H.264视频宏块为16×8划分模式,则确定所述H.265CTU的PU为2N×N模式,如果所述H.265CTU的CU对应的所述H.264视频宏块为64×64划分模式,则确定所述H.265CTU的PU为N×2N模式;
    当所述H.265CTU的CU为32×32或64×64模式时,确定所述H.265CTU的PU为2N×2N模式;
    当所述H.265CTU的CU对应的所述H.264视频宏块的MV相同时,则选取所述H.264视频宏块的MV为所述H.265CTU的PU的MV;
    当所述H.265CTU的CU对应的所述H.264视频宏块的MV不相同时,则选取参考MV,根据所述参考MV重新搜索新MV,将所述新MV作为所述H.265CTU的PU的MV。
  9. 根据权利要求7所述的方法,其特征在于,根据确定的所述H.265CTU的CU,按照预设变换单元TU确定关系,确定所述H.265CTU的TU,包括:
    当所述H.265CTU的CU为64×64模式,则选择所述H.265CTU的TU为四个32×32模式;
    当所述H.265CTU的CU为32×32模式,则选择所述H.265CTU的TU为32×32模式;
    当所述H.265CTU的CU为16×16模式,则选择所述H.265CTU的TU为16×16模式;
    当所述H.265CTU的CU为8×8模式,则选择所述H.265CTU的TU为8×8模式。
  10. 一种转码的装置,其特征在于,所述装置包括:
    获取模块,用于获取16个H.264视频宏块;
    判断模块,用于判断16个所述H.264视频宏块的编码类型;
    第一转码模块,用于如果16个所述H.264视频宏块的编码类型为帧内编码,则按照预设帧内转码对应关系,将16个所述H.264视频宏块转码为1个H.265树编码单元CTU;
    第二转码模块,用于如果16个所述H.264视频宏块的编码类型为帧间编码,则按照预设帧间转码对应关系,将16个所述H.264视频宏块转码为1个所述H.265CTU。
  11. 根据权利要求10所述的装置,其特征在于,所述第一转码模块包括:
    第一CU确定单元,用于如果16个所述H.264视频宏块的编码类型为帧内编码,则按照预设帧内编码单元CU确定关系,确定所述H.265CTU的CU;
    第一PU确定单元,用于根据确定的所述H.265CTU的CU,按照预设帧内预测单元PU确定关系,确定所述H.265CTU的PU;
    第一TU确定单元,用于根据确定的所述H.265CTU的CU,按照预设变换单元TU确定关系,确定所述H.265CTU的TU。
  12. 根据权利要求11所述的装置,其特征在于,所述第一CU确定单元 包括:
    第一划分模式确定子单元,用于如果16个所述H.264视频宏块的编码类型为帧内编码,则确定16个所述H.264视频宏块中每个视频宏块的划分模式;
    第一8×8模式CU确定子单元,用于当某第一视频宏块的划分模式是4×4时,所述H.265CTU的与所述某第一视频宏块对应的CU确定为8×8模式;
    第一划分子单元,用于将16个所述H.264视频宏块分为四组视频宏块组,每组所述视频宏块组中包括4个所述H.264视频宏块,每组所述视频宏块组的形状为方块;
    第一16×16模式CU确定子单元,用于当某组视频宏块组中包含4×4划分模式的第一视频宏块时,所述H.265CTU的与所述某组视频宏块组中除所述第一视频宏块之外其他视频宏块对应的CU确定为16×16模式;
    第二16×16模式CU确定子单元,用于当所述某组视频宏块组中包含4个16×16划分模式的视频宏块时,如果4个16×16划分模式的视频宏块的预测方向存在不同,则所述H.265CTU的与4个16×16划分模式的视频宏块对应的CU确定为16×16模式;
    第一32和64模式CU确定子单元,用于当N组视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4时,所述H.265CTU的与所述N组视频宏块组中每个视频宏块对应的CU确定为32×32模式,当N等于4时,所述H.265CTU的与所述N组视频宏块组中每个视频宏块对应的CU确定为64×64模式。
  13. 根据权利要求12所述的装置,其特征在于,所述第一PU确定单元包括:
    第一PU确定子单元,用于当所述H.265CTU的CU为8×8模式时,确定所述H.265CTU的PU为N×N模式,并且,如果所述H.264视频宏块的帧内预测方向为模式H.264 0,则所述H.265CTU的PU预测方向为模式 H.265 26,如果所述H.264视频宏块的帧内预测方向为模式H.264 1,则所述H.265CTU的PU预测方向为模式H.265 10,如果所述H.264视频宏块的帧内预测方向为模式H.264 2,则所述H.265CTU的PU预测方向为从模式H.265 0和模式H.265 1中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 3,则所述H.265CTU的PU预测方向为从模式H.265 31、模式H.265 32和模式H.265 33中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 4,则所述H.265CTU的PU预测方向为从模式H.265 17、模式H.265 18和模式H.265 19中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 5,则所述H.265CTU的PU预测方向为从模式H.265 22、模式H.265 23和模式H.265 24中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 6,则所述H.265CTU的PU预测方向为从模式H.265 12、模式H.265 13和模式H.265 14中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 7,则所述H.265CTU的PU预测方向为从模式H.265 28、模式H.265 29和模式H.265 30中选择最优的一个,如果所述H.264视频宏块的帧内预测方向为模式H.264 8,则所述H.265CTU的PU预测方向为从模式H.265 3、模式H.265 4、模式H.265 5和模式H.265 6中选择最优的一个;
    第二PU确定子单元,用于当所述H.265CTU的CU为16×16模式、32×32模式、或64×64模式时,确定所述H.265CTU的PU为2N×2N模式,并且,如果所述H.264视频宏块的帧内预测方向为模式H.264 0,则所述H.265CTU的PU预测方向为模式H.265 26,如果所述H.264视频宏块的帧内预测方向为模式H.264 1,则所述H.265CTU的PU预测方向为模式H.265 10,如果所述H.264视频宏块的帧内预测方向为模式H.264 2,则所述H.265CTU的PU预测方向为模式H.265 0,如果所述H.264视频宏块的帧内预测方向为模式H.264 3,则所述H.265CTU的PU预测方向为模式H.265 1。
  14. 根据权利要求12所述的装置,其特征在于,所述第一TU确定单元包括:
    第一32×32模式TU确定子单元,用于当所述H.265CTU的CU为64×64 模式,则选择所述H.265CTU的TU为四个32×32模式;
    第二32×32模式TU确定子单元,用于当所述H.265CTU的CU为32×32模式,则选择所述H.265CTU的TU为32×32模式;
    第一16×16模式TU确定子单元,用于当所述H.265CTU的CU为16×16模式,则选择所述H.265CTU的TU为16×16模式;
    第一8×8模式TU确定子单元,用于当所述H.265CTU的CU为8×8模式,则选择所述H.265CTU的TU为8×8模式。
  15. 根据权利要求10所述的装置,其特征在于,所述第二转码模块包括:
    第二CU确定单元,用于如果16个所述H.264视频宏块的编码类型为帧间编码,则按照预设帧间编码单元CU确定关系,确定所述H.265CTU的CU;
    第二PU确定单元,用于根据确定的所述H.265CTU的CU,按照预设帧间PU确定关系,确定所述H.265CTU的PU;
    第二TU确定单元,用于根据确定的所述H.265CTU的CU,按照预设变换单元TU确定关系,确定所述H.265CTU的TU。
  16. 根据权利要求15所述的装置,其特征在于,所述第二CU确定单元包括:
    第二划分子单元,用于如果16个所述H.264视频宏块的编码类型为帧间编码,将16个所述H.264视频宏块分为四组视频宏块组,每组所述视频宏块组中包括4个所述H.264视频宏块,每组所述视频宏块组的形状为方块;
    第二划分模式确定子单元,用于确定16个所述H.264视频宏块中每个视频宏块的划分模式;
    第二8×8模式CU确定子单元,用于当某组视频宏块组中包含8×8、8×4、4×8或4×4划分模式的视频宏块时,所述H.265CTU的与所述某组视频宏块组中视频宏块对应的CU确定为8×8模式;
    第三16×16模式CU确定子单元,用于当所述某组视频宏块组中没有包含16×16划分模式的视频宏块、或所述某组视频宏块组中的4个视频宏块的 运动矢量MV之差大于预设运动矢量相差范围阈值时,所述H.265CTU的与所述某组视频宏块组中视频宏块对应的CU确定为16×16模式;
    第二32和64模式确定子单元,用于当N组所述视频宏块组中每组视频宏块组包含4个16×16划分模式的视频宏块,且N组所述视频宏块组中每组视频宏块组中的4个16×16划分模式的视频宏块的预测方向相同,则当N小于4,且N组所述视频宏块组中每组视频宏块组的4个视频宏块的运动矢量MV之差小于等于预设运动矢量相差范围阈值时,所述H.265CTU的与N组所述视频宏块组中每个视频宏块对应的CU确定为32×32模式,当N等于4时,所述H.265CTU的与N组所述视频宏块组中每个视频宏块对应的CU确定为64×64模式。
  17. 根据权利要求16所述的装置,其特征在于,所述第二PU确定单元包括:
    第三PU确定子单元,用于当所述H.265CTU的CU为8×8模式时,如果所述H.265CTU的CU对应的所述H.264视频宏块为8×4划分模式,则确定所述H.265CTU的PU为2N×N模式,如果所述H.265CTU的CU对应的所述H.264视频宏块为4×8划分模式,则确定所述H.265CTU的PU为N×2N模式,如果所述H.265CTU的CU对应的所述H.264视频宏块为4×4划分模式,则确定所述H.265CTU的PU为N×N模式;
    第四PU确定子单元,用于当所述H.265CTU的CU为16×16模式时,如果所述H.265CTU的CU对应的所述H.264视频宏块为16×16划分模式,则确定所述H.265CTU的PU为2N×2N模式,如果所述H.265CTU的CU对应的所述H.264视频宏块为16×8划分模式,则确定所述H.265CTU的PU为2N×N模式,如果所述H.265CTU的CU对应的所述H.264视频宏块为64×64划分模式,则确定所述H.265CTU的PU为N×2N模式;
    第五PU确定子单元,用于当所述H.265CTU的CU为32×32或64×64模式时,确定所述H.265CTU的PU为2N×2N模式;
    第一MV确定子单元,用于当所述H.265CTU的CU对应的所述H.264视频宏块的MV相同时,则选取所述H.264视频宏块的MV为所述H.265 CTU的PU的MV;
    第二MV确定子单元,用于当所述H.265CTU的CU对应的所述H.264视频宏块的MV不相同时,则选取参考MV,根据所述参考MV重新搜索新MV,将所述新MV作为所述H.265CTU的PU的MV。
  18. 根据权利要求16所述的装置,其特征在于,所述第二TU确定单元包括:
    第三32×32模式TU确定子单元,用于当所述H.265CTU的CU为64×64模式,则选择所述H.265CTU的TU为四个32×32模式;
    第四32×32模式TU确定子单元,用于当所述H.265CTU的CU为32×32模式,则选择所述H.265CTU的TU为32×32模式;
    第二16×16模式TU确定子单元,用于当所述H.265CTU的CU为16×16模式,则选择所述H.265CTU的TU为16×16模式;
    第二8×8模式TU确定子单元,用于当所述H.265CTU的CU为8×8模式,则选择所述H.265CTU的TU为8×8模式。
PCT/CN2016/088688 2015-12-25 2016-07-05 转码的方法和装置 WO2017107446A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/246,415 US20170188035A1 (en) 2015-12-25 2016-08-24 Transcoding method and electronic apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510998049.5 2015-12-25
CN201510998049.5A CN105898309A (zh) 2015-12-25 2015-12-25 转码的方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/246,415 Continuation US20170188035A1 (en) 2015-12-25 2016-08-24 Transcoding method and electronic apparatus

Publications (1)

Publication Number Publication Date
WO2017107446A1 true WO2017107446A1 (zh) 2017-06-29

Family

ID=57002000

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/088688 WO2017107446A1 (zh) 2015-12-25 2016-07-05 转码的方法和装置

Country Status (2)

Country Link
CN (1) CN105898309A (zh)
WO (1) WO2017107446A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220511A (zh) * 2012-01-20 2013-07-24 索尼公司 Hevc视频编码中的逻辑帧内模式命名
CN103248893A (zh) * 2013-05-10 2013-08-14 四川大学 从h.264/avc标准到hevc标准的快速帧间转码方法及其转码器
CN103796023A (zh) * 2014-03-05 2014-05-14 武汉拓宝电子系统有限公司 基于h.264/avc宏块结构及纹理的h.265/hevc转码方法及转码器
CN103873861A (zh) * 2014-02-24 2014-06-18 西南交通大学 一种用于hevc的编码模式选择方法
CN104038764A (zh) * 2014-06-27 2014-09-10 华中师范大学 一种h.264到h.265的视频转码方法及转码器

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103546754B (zh) * 2012-07-16 2016-09-14 中国科学院声学研究所 从h.264/avc到svc空间可分级的转码方法及系统
AU2013305370B2 (en) * 2012-08-23 2016-07-07 Mediatek Inc. Method and apparatus of interlayer texture prediction
US20140086328A1 (en) * 2012-09-25 2014-03-27 Qualcomm Incorporated Scalable video coding in hevc
CN104104948B (zh) * 2013-04-15 2017-08-01 富士通株式会社 视频转码方法及视频转码器
CN103442228B (zh) * 2013-08-19 2016-05-25 四川大学 从h.264/avc标准到hevc标准的快速帧内转码方法及其转码器

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220511A (zh) * 2012-01-20 2013-07-24 索尼公司 Hevc视频编码中的逻辑帧内模式命名
CN103248893A (zh) * 2013-05-10 2013-08-14 四川大学 从h.264/avc标准到hevc标准的快速帧间转码方法及其转码器
CN103873861A (zh) * 2014-02-24 2014-06-18 西南交通大学 一种用于hevc的编码模式选择方法
CN103796023A (zh) * 2014-03-05 2014-05-14 武汉拓宝电子系统有限公司 基于h.264/avc宏块结构及纹理的h.265/hevc转码方法及转码器
CN104038764A (zh) * 2014-06-27 2014-09-10 华中师范大学 一种h.264到h.265的视频转码方法及转码器

Also Published As

Publication number Publication date
CN105898309A (zh) 2016-08-24

Similar Documents

Publication Publication Date Title
TWI824006B (zh) 交叉分量線性建模中的下採樣
TWI814890B (zh) 簡化的跨分量預測
TWI767126B (zh) 擴展四叉樹子塊的形狀
TWI820168B (zh) 跨分量編碼資訊導出
CN103096055B (zh) 一种图像信号帧内预测及解码的方法和装置
CN110933424A (zh) 一个帧内编码块的多个预测块
CN113812155B (zh) 多种帧间编解码方法之间的交互
CN113711597B (zh) 上下文建模和多重变换矩阵的选择
CN102984523B (zh) 一种多方向的帧内预测编解码方法及装置
WO2020220884A1 (zh) 视频序列的帧内预测方法及装置
CN104601993A (zh) 一种视频编码方法及装置
TW202015427A (zh) 擴展四叉樹分割的強制邊界分割
RU2010135495A (ru) Видеотранскодер с гибким управлением качеством и сложностью
CN110662050B (zh) 处理视频数据的方法、装置及存储介质
JP2015228651A (ja) ビデオ復号方法及びビデオデコーダ
JP2024045720A (ja) インタ予測における大域的運動制約運動ベクトル
BR112021003736A2 (pt) método e aparelho de predição de imagem de vídeo
JP2023101782A (ja) 非直線の非長方形分割を用いた幾何学的分割におけるインター予測
JP7323220B2 (ja) 大域的運動を伴うフレームにおける候補
JP2023093765A (ja) 大域的運動を伴うフレームにおける選択的運動ベクトル予測候補
JP4674496B2 (ja) 符号化装置、復号装置、符号化方法、復号方法、それらのプログラム
JP2022523697A (ja) 適応的な数の領域を伴う幾何学的分割におけるインター予測
KR100644620B1 (ko) 포스트 필터링을 적용한 동영상 디코딩 방법 및 그 장치
WO2017107446A1 (zh) 转码的方法和装置
JP2022529737A (ja) 大域的運動を伴うフレームにおける適応型運動ベクトル予測候補

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: 16877258

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: 16877258

Country of ref document: EP

Kind code of ref document: A1