+

CN102215404B - Video decoding method and system in embedded system - Google Patents

Video decoding method and system in embedded system Download PDF

Info

Publication number
CN102215404B
CN102215404B CN 201110132977 CN201110132977A CN102215404B CN 102215404 B CN102215404 B CN 102215404B CN 201110132977 CN201110132977 CN 201110132977 CN 201110132977 A CN201110132977 A CN 201110132977A CN 102215404 B CN102215404 B CN 102215404B
Authority
CN
China
Prior art keywords
frame
cos
macro block
compensation
motion vector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN 201110132977
Other languages
Chinese (zh)
Other versions
CN102215404A (en
Inventor
包国兴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
HT mMOBILE Inc
Original Assignee
Changxin Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Changxin Technology Co ltd filed Critical Changxin Technology Co ltd
Priority to CN 201110132977 priority Critical patent/CN102215404B/en
Priority to TW100129016A priority patent/TW201249216A/en
Publication of CN102215404A publication Critical patent/CN102215404A/en
Application granted granted Critical
Publication of CN102215404B publication Critical patent/CN102215404B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention provides a method and a system for decoding videos in an embedded system, wherein the method comprises the following steps: extracting a 4 × 4 residual coefficient matrix from an 8 × 8 residual coefficient matrix of an ith frame in the video stream by using the DC coefficient as an element in a first row and a first column; carrying out inverse quantization and inverse transformation on the 4 x 4 residual coefficient matrix to obtain a residual image of the video of the ith frame; and taking the i-1 th frame of the video reduced to the original 1/4 as a reference frame, performing motion compensation on the i-th frame by adopting the motion vector of the macro block at each position in the i-th frame to obtain a motion compensation image of the video of the i-th frame, and adding the motion compensation image and the residual image to obtain and output the i-th frame of the video reduced to the original 1/4.

Description

嵌入式系统中视频的解码方法和系统Video decoding method and system in embedded system

技术领域technical field

本发明涉及信息解码领域,尤其涉及一种嵌入式系统中视频的解码方法和系统。The invention relates to the field of information decoding, in particular to a video decoding method and system in an embedded system.

背景技术Background technique

在支持Sorenson Spark格式视频解码的基于嵌入式平台便携式终端(如手机)上,对于分辨率大于播放器平台(如手机的显示屏幕)的分辨率的视频,由于处理器的可用资源有限,使得视频难以直接实时解码播放。On an embedded platform-based portable terminal (such as a mobile phone) that supports Sorenson Spark format video decoding, for a video with a resolution greater than that of the player platform (such as the display screen of a mobile phone), due to the limited available resources of the processor, the video It is difficult to directly decode and play in real time.

为解决上述问题,现有技术提出如下方案:In order to solve the above problems, the prior art proposes the following solutions:

方案一:进行格式转换再播放。Solution 1: Perform format conversion and play.

用户在电脑机上采用转码器(Transcoder)软件将上述视频转换成播放平台的分辨率,最后再将转换分辨率后的视频拷贝到娱乐应用终端上进行后续播放。The user uses Transcoder software on the computer to convert the above video into the resolution of the playback platform, and finally copies the converted video to the entertainment application terminal for subsequent playback.

发明人发现,在播放上述视频时需要对视频预先进行转换,且必须在电脑上进行转换,操作繁缛,且不能支持用户在线观看分辨率大于播放平台的分辨率的视频。The inventor found that when playing the above-mentioned video, the video needs to be converted in advance, and the conversion must be performed on a computer, the operation is cumbersome, and it cannot support users to watch online videos with a resolution higher than that of the playback platform.

方案二:直接进行缩放解码。Solution 2: Perform scaling and decoding directly.

现有的技术,对于视频分辨率大于播放平台的分辨率的情况,采用的是完全解码该视频,然后将解码后的图片缩小成播放平台支持的格式,再进行播放。In the existing technology, when the resolution of the video is higher than that of the playback platform, the video is completely decoded, and then the decoded picture is reduced to a format supported by the playback platform, and then played.

发明人发现,采用这样的处理方式,解码计算量巨大,造成解码速度低,使得在视频播放过程中会有出现停顿,无法满足大格式视频实时播放的目的。The inventors found that with such a processing method, the amount of decoding calculation is huge, resulting in a low decoding speed, resulting in pauses during video playback, which cannot meet the purpose of real-time playback of large-format videos.

发明内容Contents of the invention

本发明提供的一种嵌入式系统中视频的解码方法和系统,要解决的技术问题是现有技术中嵌入式系统中在解码速度慢,难以实时在线解码播放大格式视频的问题。The invention provides a video decoding method and system in an embedded system. The technical problem to be solved is that the decoding speed in the embedded system in the prior art is slow, and it is difficult to decode and play large-format video online in real time.

为解决上述技术问题,本发明提供了如下技术方案:In order to solve the problems of the technologies described above, the present invention provides the following technical solutions:

一种嵌入式系统中视频的解码方法,包括:A video decoding method in an embedded system, comprising:

以DC系数为第一行第一列的元素从视频流中第i帧的8x8的残差系数矩阵抽取一个4x4的残差系数矩阵;Take the DC coefficient as the element of the first row and the first column to extract a 4x4 residual coefficient matrix from the 8x8 residual coefficient matrix of the i-th frame in the video stream;

对所述4x4的残差系数矩阵进行反量化以及反变换,得到第i帧的视频的残差图像;Inverse quantization and inverse transformation are performed on the 4x4 residual coefficient matrix to obtain a residual image of the i-th frame of video;

以缩小为原来的1/4的视频的第i-1帧为参考帧,采用第i帧中各位置的宏块的运动矢量对所述第i帧进行运动补偿,得到第i帧的视频的运动补偿图像,将运动补偿图像与残差图像相加,得到缩小为原来1/4的视频的第i帧并输出。Taking the i-1th frame of the video reduced to 1/4 as the reference frame, the motion compensation of the i-th frame is performed using the motion vectors of the macroblocks in each position in the i-th frame to obtain the i-th frame of the video Motion compensation image, add the motion compensation image and the residual image to obtain the i-th frame of the video that is reduced to 1/4 of the original and output it.

优选的,所述方法还具有如下特点:所述反变换是通过如下表达式进行的:Preferably, the method also has the following characteristics: the inverse transformation is performed by the following expression:

ff (( xx ,, ythe y )) == 11 22 11 22 coscos (( ππ 88 )) 11 22 11 22 coscos (( 33 ππ 88 )) 11 22 11 22 coscos (( 33 ππ 88 )) -- 11 22 -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( 33 ππ 88 )) -- 11 22 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( 33 ππ 88 )) Ff (( uu ,, vv )) 11 22 11 22 11 22 11 22 11 22 coscos (( ππ 88 )) 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 -- 11 22 11 22 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( ππ 88 )) 11 22 coscos (( ππ 88 )) -- 11 22 coscos (( 33 ππ 88 ))

其中,F(μ,v)为反量化处理后的4x4的残差系数矩阵,f(x,y)为进行反变换处理后的矩阵。Wherein, F(μ, v) is a 4×4 residual coefficient matrix after inverse quantization processing, and f(x, y) is a matrix after inverse transform processing.

优选的,所述方法还具有如下特点:采用第i帧中各位置的宏块的运动矢量对所述第i帧进行运动补偿,包括:Preferably, the method also has the following characteristics: performing motion compensation on the i-th frame by using the motion vectors of the macroblocks at each position in the i-th frame, including:

对所述第i帧中各位置的宏块的运动矢量做除以2的处理,得到处理结果,将所述处理结果的整数部分作为该位置的宏块的目标运动矢量的大小;Divide the motion vector of the macroblock at each position in the i-th frame by 2 to obtain a processing result, and use the integer part of the processing result as the size of the target motion vector of the macroblock at the position;

采用所述第i帧中各位置的宏块的目标运动矢量进行运动补偿。The motion compensation is performed by using the target motion vectors of the macroblocks at each position in the i-th frame.

优选的,所述方法还具有如下特点:采用所述第i帧中各位置的宏块的目标运动矢量进行运动补偿,包括:Preferably, the method also has the following characteristics: using the target motion vectors of the macroblocks at each position in the i-th frame to perform motion compensation, including:

将运动矢量的处理结果包括有小数部分的宏块作为待补偿宏块,对所述待补偿宏块的运动矢量除以2后的处理结果进行矢量补偿,得到补偿结果,将所述补偿结果作为修正后的目标运动矢量;A macroblock whose motion vector processing result includes a fractional part is used as a macroblock to be compensated, and a vector compensation is performed on the processing result obtained by dividing the motion vector of the macroblock to be compensated by 2 to obtain a compensation result, and the compensation result is used as The corrected target motion vector;

根据修正后的目标运动矢量进行运动补偿。Motion compensation is performed according to the corrected target motion vector.

优选的,所述方法还具有如下特点:对所述待补偿宏块的运动矢量除以2后的处理结果进行矢量补偿,得到补偿结果,将所述补偿结果作为修正后的目标运动矢量,包括:Preferably, the method also has the following characteristics: vector compensation is performed on the processing result obtained by dividing the motion vector of the macroblock to be compensated by 2 to obtain a compensation result, and the compensation result is used as the corrected target motion vector, including :

判断距离第i帧最近的帧上是否有同时满足如下条件的宏块,包括:Determine whether there is a macroblock that satisfies the following conditions at the same time on the frame closest to the i-th frame, including:

条件1:与所述待补偿宏块同位置的宏块;Condition 1: a macroblock at the same position as the macroblock to be compensated;

条件2:运动矢量除以2后的处理结果包括有小数部分的宏块;Condition 2: The processing result after the motion vector is divided by 2 includes a macroblock with a fractional part;

条件3:从未进行矢量补偿处理的宏块;Condition 3: Macroblocks that have never been processed for vector compensation;

如果有,则将同时满足上述条件的宏块作为补偿宏块,将所述待补偿宏块的运动矢量除以2后的处理结果与所述补偿宏块的运动矢量的处理结果中的小数部分的运动矢量进行矢量叠加操作,得到所述补偿结果,将所述补偿结果作为修正后的目标运动矢量。If yes, then take the macroblock that satisfies the above conditions at the same time as the compensated macroblock, divide the processing result of the motion vector of the macroblock to be compensated by 2 and the fractional part of the processing result of the motion vector of the compensated macroblock A vector superposition operation is performed on the motion vector to obtain the compensation result, and the compensation result is used as the corrected target motion vector.

优选的,所述方法还具有如下特点:采用第i帧中各位置的宏块的运动矢量对所述第i帧进行运动补偿,包括:Preferably, the method also has the following characteristics: performing motion compensation on the i-th frame by using the motion vectors of the macroblocks at each position in the i-th frame, including:

采用所述第i帧中各位置的宏块的运动矢量对所述第i帧进行双线性插值的运动补偿。performing bilinear interpolation motion compensation on the i-th frame by using the motion vectors of the macroblocks at each position in the i-th frame.

一种嵌入式系统中视频的解码系统,包括:A video decoding system in an embedded system, comprising:

抽取装置,用于以DC系数为第一行第一列的元素从视频流中第i帧的8x8的残差系数矩阵抽取一个4x4的残差系数矩阵;An extracting device for extracting a 4x4 residual coefficient matrix from the 8x8 residual coefficient matrix of the i-th frame in the video stream with the DC coefficient as the element in the first row and the first column;

反量化装置,用于对所述4x4的残差系数矩阵进行反量化;an inverse quantization device, configured to inverse quantize the 4x4 residual coefficient matrix;

反变换装置,用于对于反量化处理后的4x4的残差系数矩阵进行反变换处理,得到第i帧的视频的残差图像;The inverse transformation device is used to perform inverse transformation processing on the 4x4 residual coefficient matrix after inverse quantization processing, to obtain the residual image of the video of the i-th frame;

运动补偿装置,用于以缩小为原来的1/4的视频的第i-1帧为参考帧,采用第i帧中各位置的宏块的运动矢量对所述第i帧进行运动补偿,得到第i帧的视频的运动补偿图像;The motion compensation device is used to use the i-1th frame of the video reduced to the original 1/4 as a reference frame, and use the motion vectors of the macroblocks in each position in the i-th frame to perform motion compensation on the i-th frame to obtain A motion compensated image of the i-th frame of video;

输出装置,用于将运动补偿图像与残差图像相加,得到缩小为原来1/4的视频的第i帧并输出。The output device is used for adding the motion compensation image and the residual image to obtain and output the i-th frame of the video reduced to 1/4 of the original.

优选的,所述系统还具有如下特点:所述反变换装置是通过如下表达式对所述反量化处理后的4x4的残差系数矩阵进行反变换的:Preferably, the system also has the following characteristics: the inverse transformation device performs inverse transformation on the 4x4 residual coefficient matrix after the inverse quantization process through the following expression:

ff (( xx ,, ythe y )) == 11 22 11 22 coscos (( ππ 88 )) 11 22 11 22 coscos (( 33 ππ 88 )) 11 22 11 22 coscos (( 33 ππ 88 )) -- 11 22 -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( 33 ππ 88 )) -- 11 22 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( 33 ππ 88 )) Ff (( uu ,, vv )) 11 22 11 22 11 22 11 22 11 22 coscos (( ππ 88 )) 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 -- 11 22 11 22 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( ππ 88 )) 11 22 coscos (( ππ 88 )) -- 11 22 coscos (( 33 ππ 88 ))

其中,F(μ,v)为反量化处理后的4x4的残差系数矩阵,f(x,y)为进行反变换处理后的矩阵。Wherein, F(μ, v) is a 4×4 residual coefficient matrix after inverse quantization processing, and f(x, y) is a matrix after inverse transformation processing.

优选的,所述系统还具有如下特点:所述运动补偿装置包括:Preferably, the system also has the following characteristics: the motion compensation device includes:

获取模块,用于对所述第i帧中各位置的宏块的运动矢量做除以2的处理,得到处理结果,将所述处理结果的整数部分作为该位置的宏块的目标运动矢量的大小;An acquisition module, configured to divide the motion vector of the macroblock at each position in the i-th frame by 2 to obtain a processing result, and use the integer part of the processing result as the target motion vector of the macroblock at the position size;

补偿模块,用于采用所述第i帧中各位置的宏块的目标运动矢量进行运动补偿。A compensation module, configured to perform motion compensation using target motion vectors of macroblocks at each position in the i-th frame.

优选的,所述系统还具有如下特点:所述补偿模块,包括:Preferably, the system also has the following characteristics: the compensation module includes:

修正子模块,用于将运动矢量的处理结果包括有小数部分的宏块作为待补偿宏块,对所述待补偿宏块的运动矢量除以2后的处理结果进行矢量补偿,得到补偿结果,将所述补偿结果作为修正后的目标运动矢量;The correction sub-module is used to use the macroblock whose motion vector processing result includes a fractional part as the macroblock to be compensated, and perform vector compensation on the processing result obtained by dividing the motion vector of the macroblock to be compensated by 2 to obtain the compensation result, Using the compensation result as the corrected target motion vector;

补偿子模块,用于根据修正后的目标运动矢量进行运动补偿。The compensation sub-module is used for performing motion compensation according to the corrected target motion vector.

优选的,所述系统还具有如下特点:所述补偿子模块,包括:Preferably, the system also has the following characteristics: the compensation sub-module includes:

判断单元,用于判断距离第i帧最近的帧上是否有同时满足如下条件的宏块,包括:A judging unit, configured to judge whether there is a macroblock satisfying the following conditions simultaneously on the frame closest to the i-th frame, including:

条件1:与所述待补偿宏块同位置的宏块;Condition 1: a macroblock at the same position as the macroblock to be compensated;

条件2:运动矢量除以2后的处理结果包括有小数部分的宏块;Condition 2: The processing result after the motion vector is divided by 2 includes a macroblock with a fractional part;

条件3:从未进行矢量补偿处理的宏块;Condition 3: Macroblocks that have never been processed for vector compensation;

修正单元,用于在所述判断单元判断有时,将同时满足上述条件的宏块作为补偿宏块,将所述待补偿宏块的运动矢量除以2后的处理结果与所述补偿宏块的运动矢量的处理结果中的小数部分的运动矢量进行矢量叠加操作,得到所述补偿结果,将所述补偿结果作为修正后的目标运动矢量。A correction unit, configured to use a macroblock that simultaneously satisfies the above conditions as a compensated macroblock when the judging unit judges, and divide the motion vector of the macroblock to be compensated by 2 with the result of the processing of the compensated macroblock A vector superposition operation is performed on the motion vectors of fractional parts in the motion vector processing results to obtain the compensation result, and the compensation result is used as the corrected target motion vector.

优选的,所述系统还具有如下特点:Preferably, the system also has the following characteristics:

所述运动补偿装置,用于采用所述第i帧中各位置的宏块的运动矢量对所述第i帧进行双线性插值的运动补偿。The motion compensation device is configured to perform bilinear interpolation motion compensation on the i-th frame by using motion vectors of macroblocks at various positions in the i-th frame.

本发明提供的多个实施例,通过抽取重要的残差系数构造4x4的残差系数矩阵,使得后续进行的反量化和IDCT变换操作的计算量仅是原来的1/4,降低了视频解码的计算量,提高了解码速度,同时也使解码后的帧图像大小变为了原来的1/4,达到缩小视频图像的目的,满足了实时解码视频图像的应用需求。Multiple embodiments provided by the present invention construct a 4x4 residual coefficient matrix by extracting important residual coefficients, so that the calculation amount of subsequent inverse quantization and IDCT transformation operations is only 1/4 of the original, reducing the cost of video decoding. The amount of calculation improves the decoding speed, and at the same time, the size of the decoded frame image is reduced to 1/4 of the original size, achieving the purpose of reducing the video image and meeting the application requirements of real-time decoding video image.

附图说明Description of drawings

图1为本发明实施例一提供的嵌入式系统中视频的解码方法实施例的流程示意图;FIG. 1 is a schematic flow diagram of an embodiment of a video decoding method in an embedded system provided by Embodiment 1 of the present invention;

图2为本发明提供的嵌入式系统中视频的解码系统实施例的结构示意图;Fig. 2 is the structural representation of the decoding system embodiment of video in the embedded system provided by the present invention;

图3为图2所示实施例中运动补偿装置204的结构示意图;FIG. 3 is a schematic structural diagram of the motion compensation device 204 in the embodiment shown in FIG. 2;

图4为图3所示实施例中补偿模块302的结构示意图;FIG. 4 is a schematic structural diagram of the compensation module 302 in the embodiment shown in FIG. 3;

图5为图4所示实施例中修正子模块401的结构示意图。FIG. 5 is a schematic structural diagram of the correction sub-module 401 in the embodiment shown in FIG. 4 .

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚,下面将结合附图及具体实施例对本发明作进一步的详细描述。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined arbitrarily with each other.

实施例一Embodiment one

图1为本发明实施例一提供的嵌入式系统中视频的解码方法实施例的流程示意图。图1所示方法实施例包括:FIG. 1 is a schematic flowchart of an embodiment of a video decoding method in an embedded system provided by Embodiment 1 of the present invention. The method embodiment shown in Fig. 1 comprises:

步骤101、获取视频流中第i帧的8x8残差系数矩阵和所述第i帧中各位置的宏块的运动矢量。Step 101. Obtain the 8x8 residual coefficient matrix of the i-th frame in the video stream and the motion vectors of the macroblocks at each position in the i-th frame.

例如,通过对视频流中第i帧的码流进行熵解码得到上述信息。For example, the above information is obtained by performing entropy decoding on the code stream of the i-th frame in the video stream.

步骤102、以DC系数为第一行第一列的元素从所述8x8的残差系数矩阵抽取一个4x4的残差系数矩阵。Step 102 , extracting a 4x4 residual coefficient matrix from the 8x8 residual coefficient matrix with DC coefficients as elements in the first row and first column.

其中所述4x4的残差系数矩阵中除了DC系数之外的系数是8x8的残差系数矩阵中与DC系数距离最近的15个AC系数,且该15个AC系数在4x4的残差系数矩阵中相对于DC系数的方位和距离与在8x8的残差系数矩阵中的相同。The coefficients other than the DC coefficient in the 4x4 residual coefficient matrix are the 15 AC coefficients closest to the DC coefficient in the 8x8 residual coefficient matrix, and the 15 AC coefficients are in the 4x4 residual coefficient matrix. The orientations and distances relative to the DC coefficients are the same as in the 8x8 matrix of residual coefficients.

如下依次为8x8的残差系数矩阵以及抽取系数后得到的相应的4x4的残差系数矩阵:The following are the 8x8 residual coefficient matrix and the corresponding 4x4 residual coefficient matrix obtained after extracting the coefficients:

Figure GDA00002856271400071
DC AC 01 AC 02 AC 03 AC 10 AC 11 AC 12 AC 13 AC 20 AC 21 AC 22 AC 23 AC 30 AC 31 AC 32 AC 33
Figure GDA00002856271400071
DC AC 01 AC 02 AC 03 AC 10 AC 11 AC 12 AC 13 AC 20 AC twenty one AC twenty two AC twenty three AC 30 AC 31 AC 32 AC 33

通过减少残差系数矩阵中元素的个数,可以有效减少后续IDCT部分和运动插值补偿部分的计算量,且由于图像细节主要集中在靠近DC系数的位置,保留与DC系数距离最近的15个参数可以最大的减少缩小过程中丢失的图像细节,保证图像质量。By reducing the number of elements in the residual coefficient matrix, the calculation amount of the subsequent IDCT part and motion interpolation compensation part can be effectively reduced, and since the image details are mainly concentrated near the DC coefficient, the 15 parameters closest to the DC coefficient are reserved It can minimize the loss of image details during the reduction process and ensure the image quality.

步骤103、对所述4x4的残差系数矩阵进行反量化;Step 103, performing inverse quantization on the 4x4 residual coefficient matrix;

步骤104、对反量化处理后的4x4的残差系数矩阵进行反变换,得到第i帧的视频的残差图像,具体包括:Step 104, performing inverse transformation on the 4x4 residual coefficient matrix after inverse quantization processing, to obtain the residual image of the i-th frame of video, specifically including:

ff (( xx ,, ythe y )) == 11 22 11 22 coscos (( ππ 88 )) 11 22 11 22 coscos (( 33 ππ 88 )) 11 22 11 22 coscos (( 33 ππ 88 )) -- 11 22 -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( 33 ππ 88 )) -- 11 22 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( 33 ππ 88 )) Ff (( uu ,, vv )) 11 22 11 22 11 22 11 22 11 22 coscos (( ππ 88 )) 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 -- 11 22 11 22 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( ππ 88 )) 11 22 coscos (( ππ 88 )) -- 11 22 coscos (( 33 ππ 88 ))

其中,F(μ,v)为反量化的4x4的残差系数矩阵,f(x,y)为对反量化处理后的4x4的残差系数矩阵进行反变换处理后的矩阵。Wherein, F(μ, v) is the dequantized 4x4 residual coefficient matrix, and f(x, y) is a matrix obtained by inversely transforming the dequantized 4x4 residual coefficient matrix.

经过反变换后输出的矩阵为4x4矩阵,共16个残差系数,实现了缩小图像的目的。After inverse transformation, the output matrix is a 4x4 matrix, with a total of 16 residual coefficients, which realizes the purpose of shrinking the image.

步骤105、对所述第i帧中各位置的宏块的运动矢量做除以2的处理,得到处理结果,将所述处理结果的整数部分作为该位置的宏块的目标运动矢量的大小;Step 105, divide the motion vector of the macroblock at each position in the i-th frame by 2 to obtain a processing result, and use the integer part of the processing result as the size of the target motion vector of the macroblock at the position;

步骤106、以缩小为原来的1/4的视频的第i-1帧作为参考帧,采用所述目标运动矢量对第i帧进行运动补偿,得到运动补偿图像;Step 106: Taking the i-1th frame of the video reduced to 1/4 as the reference frame, and using the target motion vector to perform motion compensation on the i-th frame to obtain a motion-compensated image;

其中,运动补偿主要是根据运动矢量进行插值,插值方法为标准规定的方法,但是输出块的大小由原来16x16变为输出8x8块。这里使用选择标准算法,一方面不会增加插值算法的复杂度,另一方面计算简单,同时输出8x8的块可以减少计算量,实现解码缩放。Among them, the motion compensation is mainly to perform interpolation according to the motion vector, and the interpolation method is the method stipulated in the standard, but the size of the output block is changed from the original 16x16 to the output 8x8 block. The selection standard algorithm is used here. On the one hand, it will not increase the complexity of the interpolation algorithm. On the other hand, the calculation is simple. At the same time, outputting 8x8 blocks can reduce the amount of calculation and realize decoding scaling.

步骤107、将运动补偿图像和残差图像相加,得到缩小为原来的1/4的视频的第i帧并输出。Step 107: Add the motion compensation image and the residual image to obtain the i-th frame of the video reduced to 1/4 of the original size and output it.

其中上述步骤中,步骤102~104与步骤105~106没有明显的执行顺序。Among the above steps, steps 102-104 and steps 105-106 have no obvious order of execution.

需要说明的是,在经过变换残差系数的抽取和IDCT变换后,I帧解码重构的图像已经是宽和高缩小一半的图像,当第i帧作为第i+1帧的参考帧时,需要对第i帧的运动矢量进行同比例的缩小。重构完成的参考帧需要进行临时的存储,与现有技术不同的是,需要的存储空间缩小为标准解码空间的1/4。It should be noted that after the extraction of the transform residual coefficients and the IDCT transformation, the decoded and reconstructed image of the I frame is an image whose width and height have been reduced by half. When the i-th frame is used as the reference frame of the i+1-th frame, It is necessary to reduce the motion vector of the i-th frame in the same proportion. The reconstructed reference frame needs to be temporarily stored, which is different from the prior art in that the required storage space is reduced to 1/4 of the standard decoding space.

本发明实施例一提供的技术方案,通过抽取重要的残差系数构造4x4的残差系数矩阵,使得后续进行的反量化、IDCT变换和运动补偿操作所计算的数据量仅是原来数据量的1/4,降低了解码的数据量,提高了解码速度,同时也使得解码帧图像的大小变为了原来的1/4,达到缩小视频图像的目的,满足了实时解码视频图像的应用需求。In the technical solution provided by Embodiment 1 of the present invention, a 4x4 residual coefficient matrix is constructed by extracting important residual coefficients, so that the amount of data calculated by subsequent inverse quantization, IDCT transformation, and motion compensation operations is only 1 of the original data amount /4, which reduces the amount of decoded data, improves the decoding speed, and also reduces the size of the decoded frame image to 1/4 of the original size, achieving the purpose of shrinking the video image and meeting the application requirements for real-time decoding of video images.

实施例二Embodiment two

由于步骤106中,第i帧重构需要使用到前面已经解码的第i-1帧作为参考帧,与编码端使用的第i-1帧相比,已重构的i-1帧的宽和高均为编码端第i-1帧的一半,所以在进行第i帧的运动补偿时,需要将各个宏块解码得到的运动矢量除以二,即缩小为原来的一半,用缩小后的运动矢量进行补偿。同样第i-1帧的重构也是如此处理。如果运动矢量的大小为奇数,在运动矢量除以二的处理中,会有半个像素的运动矢量发生丢失,造成运动矢量精度的误差。当处理多帧后,丢失的运动矢量累积越来越多,使得缩小后的图像在播放时有跳动,影响视频播放效果。因此实施例一中的步骤105之后,还包括:Since in step 106, the i-th frame reconstruction needs to use the previously decoded i-1th frame as a reference frame, compared with the i-1th frame used by the encoder, the width and width of the reconstructed i-1 frame The height is half of the i-1th frame at the encoding end, so when performing motion compensation for the i-th frame, it is necessary to divide the motion vector obtained by decoding each macroblock by two, that is, reduce it to half of the original, and use the reduced motion vector vector compensation. The same is true for the reconstruction of the i-1th frame. If the size of the motion vector is an odd number, half a pixel of the motion vector will be lost during the process of dividing the motion vector by two, resulting in an error in the accuracy of the motion vector. After processing multiple frames, the lost motion vectors accumulate more and more, which makes the reduced image jump when playing, affecting the video playback effect. Therefore, after step 105 in the first embodiment, it also includes:

步骤A、将运动矢量的处理结果包括有小数部分的宏块作为待补偿宏块,对所述待补偿宏块的运动矢量除以2后的处理结果进行矢量补偿,得到补偿结果,将所述补偿结果作为修正后的目标运动矢量;Step A, taking the macroblock whose motion vector processing result includes a fractional part as the macroblock to be compensated, performing vector compensation on the processing result obtained by dividing the motion vector of the macroblock to be compensated by 2 to obtain a compensation result, and converting the The compensation result is used as the corrected target motion vector;

相应的,实施例一中步骤106会采用修正后的目标运动矢量进行运动补偿。Correspondingly, step 106 in the first embodiment uses the corrected target motion vector to perform motion compensation.

其中优选的是,采用如下方式对待补偿宏块进行矢量补偿,包括:Wherein it is preferable to perform vector compensation for the macroblock to be compensated in the following manner, including:

步骤A1、判断距离第i帧最近的帧上是否有同时满足如下条件的宏块,包括:Step A1, judging whether there is a macroblock that satisfies the following conditions at the same time on the frame closest to the i-th frame, including:

条件1:与所述待补偿宏块同位置的宏块;Condition 1: a macroblock at the same position as the macroblock to be compensated;

条件2:运动矢量除以2后的处理结果包括有小数部分的宏块;Condition 2: The processing result after the motion vector is divided by 2 includes a macroblock with a fractional part;

条件3:从未进行矢量补偿处理的宏块;Condition 3: Macroblocks that have never been processed for vector compensation;

步骤A2、如果有,则将同时满足上述条件的宏块作为补偿宏块,将所述待补偿宏块的运动矢量除以2后的处理结果与所述补偿宏块的运动矢量的处理结果中的小数部分的运动矢量进行矢量叠加操作,得到所述补偿结果,将所述补偿结果作为修正后的目标运动矢量。Step A2, if yes, then use the macroblock that satisfies the above conditions at the same time as the compensated macroblock, divide the processing result of the motion vector of the macroblock to be compensated by 2 and the processing result of the motion vector of the compensated macroblock A vector superposition operation is performed on the motion vector of the fractional part of , to obtain the compensation result, and the compensation result is used as the corrected target motion vector.

首先对如何选择补偿宏块进行说明:First, how to select the compensation macroblock is explained:

该补偿宏块应属于第i帧之前的帧,且在帧中的位置与该待补偿宏块在第i帧的位置相同;另外该补偿模块的运动矢量在除以2后的处理结果应包括有小数部分,即大小为半个像素的运动矢量;还要没进行过矢量补偿,即该补偿宏块在运动补偿过程中已丢弃了半个像素的运动矢量。The compensated macroblock should belong to the frame before the i-th frame, and its position in the frame is the same as the position of the to-be-compensated macroblock in the i-th frame; in addition, the processing result of the motion vector of the compensation module after dividing by 2 should include There is a fractional part, that is, the motion vector whose size is half a pixel; and no vector compensation has been performed, that is, the motion vector of half a pixel has been discarded in the motion compensation process of the compensated macroblock.

以下以某一位置的待补偿宏块的矢量补偿进行说明:The following describes the vector compensation of a macroblock to be compensated at a certain position:

情况1:如果待补偿宏块的运动矢量除以2后的的处理结果的矢量方向与补偿宏块的运动矢量除以2后的的处理结果的矢量方向相同,将补偿宏块的运动矢量除以2后的处理结果中的小数部分与待补偿宏块的运动矢量除以2后的处理结果进行矢量叠加,则使得待补偿宏块的运动矢量除以2后的处理结果增加了半个像素的运动矢量,变成了没有小数部分的处理结果,同时又实现了在i帧上对补偿宏块丢失的运动矢量的补偿;Case 1: If the vector direction of the processing result after the motion vector of the macroblock to be compensated is divided by 2 is the same as the vector direction of the processing result of the motion vector of the compensated macroblock divided by 2, divide the motion vector of the compensated macroblock by The fractional part of the processing result after 2 and the processing result of the motion vector of the macroblock to be compensated divided by 2 are used for vector superposition, so that the processing result of the motion vector of the macroblock to be compensated divided by 2 is increased by half a pixel The motion vector of , becomes a processing result without a fractional part, and at the same time realizes the compensation of the motion vector that compensates for the loss of the macroblock on the i frame;

相反,如果待补偿宏块的运动矢量除以2后的的处理结果的矢量方向与补偿宏块的运动矢量除以2后的的处理结果的矢量方向相反,将补偿宏块的运动矢量除以2后的处理结果中的小数部分与待补偿宏块的运动矢量除以2后的处理结果进行矢量叠加,则使得待补偿宏块的运动矢量除以2后的处理结果丢失了半个像素的运动矢量,变成了没有小数部分的处理结果,同时又实现了在i帧上对补偿宏块丢失的运动矢量的补偿;即同一位置的宏块丢失的运动矢量信息相互抵消了。On the contrary, if the vector direction of the processing result after the motion vector of the macroblock to be compensated is divided by 2 is opposite to the vector direction of the processing result of the motion vector of the compensated macroblock divided by 2, divide the motion vector of the compensated macroblock by The fractional part of the processing result after 2 is vector-superimposed with the processing result after the motion vector of the macroblock to be compensated is divided by 2, so that the processing result after the motion vector of the macroblock to be compensated is divided by 2 loses half a pixel. The motion vector has become a processing result without a fractional part, and at the same time, the compensation for the motion vector lost by the macroblock on the i frame is realized; that is, the lost motion vector information of the macroblock at the same position cancels each other out.

其中本发明中,将补偿宏块的运动矢量除以2后的处理结果中的小数部分与待补偿宏块的运动矢量除以2后的处理结果进行叠加的过程称为矢量补偿。In the present invention, the process of superimposing the fractional part of the processing result obtained by dividing the motion vector of the compensated macroblock by 2 and the processing result obtained by dividing the motion vector of the macroblock to be compensated by 2 is called vector compensation.

情况2:对第i帧中的宏块,在运动矢量缩小为为原来一半时没有运动矢量信息丢失的情况,则将第i-1帧中丢失的运动矢量信息补偿到第i帧之后的其他帧的同位置宏块,以完成对第i-1帧上丢失的运动矢量信息的补偿处理。可以理解为在第i帧之后第一个同位置宏块有丢失的运动矢量的帧时,将该帧与第i-1帧进行补偿处理。Case 2: For the macroblock in the i-th frame, when the motion vector is reduced to half of the original, there is no loss of motion vector information, then the lost motion vector information in the i-1th frame is compensated to other frames after the i-th frame The co-located macroblock of the frame is used to complete the compensation process for the lost motion vector information on the i-1th frame. It can be understood that when the first co-located macroblock after the i-th frame has a lost motion vector frame, the frame is compensated with the i-1th frame.

在实际应用中,可通过采用如下公式来处理:In practical applications, it can be handled by using the following formula:

Mv=(sign(Mv_prev))(1)*(Mv_prev&1)+Mv_vlcMv=(sign(Mv_prev))(1)*(Mv_prev&1)+Mv_vlc

公式中,Mv_prev是待补偿宏块的真实运动矢量(即解码流得到运动矢量),在程序中专门开辟这样的buffer保存每一个宏块解码流得到的运动矢量。Mv_vlc是补偿宏块解码流得到的真实运动矢量(也专门开辟buffer进行存储)。Mv即为矢量补偿后的待补偿宏块的运动矢量,存储时直接覆盖Mv_vlc,用于待补偿宏块的运动矢量的矢量补偿计算。Mv除以2后得到的结果为插值补偿中使用的运动矢量,这个运动矢量不需要保存。sign(Mv_prev)是获取前一帧宏块运动矢量的符号,Mv_prev&1是获取补偿宏块的运动矢量的小数位。因为此处运动矢量精度是半像素,所以在程序中用最低比特位表示0.5(最低位为1时)或者0(最低位为0时)像素的运动矢量。In the formula, Mv_prev is the real motion vector of the macroblock to be compensated (that is, the motion vector obtained from the decoded stream), and such a buffer is specially opened in the program to save the motion vector obtained from the decoded stream of each macroblock. Mv_vlc is the real motion vector obtained by compensating the macroblock decoding stream (also specially opened up buffer for storage). Mv is the motion vector of the to-be-compensated macroblock after vector compensation, which directly overwrites Mv_vlc during storage, and is used for vector compensation calculation of the to-be-compensated macroblock's motion vector. The result obtained after dividing Mv by 2 is the motion vector used in interpolation compensation, and this motion vector does not need to be saved. sign(Mv_prev) is to obtain the sign of the motion vector of the macroblock of the previous frame, and Mv_prev&1 is to obtain the decimal place of the motion vector of the compensated macroblock. Because the precision of the motion vector here is half a pixel, the lowest bit is used to represent the motion vector of 0.5 (when the lowest bit is 1) or 0 (when the lowest bit is 0) pixel in the program.

通过上面的公式,实现用上一帧宏块丢失的小数部分运动矢量,补偿当前帧宏块的运动矢量的目的。Through the above formula, the purpose of compensating the motion vector of the macroblock of the current frame is realized by using the motion vector of the fractional part lost by the macroblock of the previous frame.

通过在后续帧上相同位置的宏块进行前面帧中丢失的运动矢量信息的补偿,可以减少运动矢量信息的丢失量,避免出现视频画面跳动的问题。By compensating the motion vector information lost in the previous frame on the macroblock at the same position in the subsequent frame, the amount of loss of the motion vector information can be reduced, and the problem of jumping video images can be avoided.

实施例三Embodiment three

与实施例一和二不同的是,为了达到解码视频图像的目的,本实施例采用了采用如下手段:Different from Embodiments 1 and 2, in order to achieve the purpose of decoding video images, this embodiment adopts the following means:

步骤B1、以DC系数为第一行第一列的元素从视频流中第i帧的8x8的残差系数矩阵抽取一个4x4的残差系数矩阵;Step B1, using DC coefficients as elements in the first row and first column to extract a 4x4 residual coefficient matrix from the 8x8 residual coefficient matrix of the i-th frame in the video stream;

步骤B2、对所述4x4的残差系数矩阵进行反量化以及反变换,得到第i帧中图像的缩略图像;Step B2, performing inverse quantization and inverse transformation on the 4x4 residual coefficient matrix to obtain a thumbnail image of the image in the i-th frame;

步骤B3、以视频缩小为原来1/4的第i-1帧为参考帧,采用所述第i帧中各位置的宏块的运动矢量对所述第i帧进行双线性插值的运动补偿,并输出运动补偿的处理结果。Step B3, taking the i-1th frame whose video is reduced to 1/4 of the original as a reference frame, and using the motion vectors of the macroblocks in each position in the i-th frame to perform bilinear interpolation motion compensation on the i-th frame , and output the processing result of motion compensation.

其中进行双线性插值的运动补偿时各位置的宏块的运动矢量为原始的运动矢量。The motion vectors of the macroblocks at each position are the original motion vectors when the bilinear interpolation motion compensation is performed.

需要说明的是,实施例一至三是以Sorenson Spark标准解码框架为例进行说明的,但不限于此,对于MPEG4SP和H.263标准的解码处理框架同样使用,因方法和流程类似,此处不再赘述。It should be noted that Embodiments 1 to 3 are illustrated with the Sorenson Spark standard decoding framework as an example, but are not limited to this. The decoding processing frameworks of the MPEG4SP and H.263 standards are also used, because the methods and processes are similar, and are not described here. Let me repeat.

图2为本发明提供的嵌入式系统中视频的解码系统实施例的结构示意图。图2所示系统实施例包括:FIG. 2 is a schematic structural diagram of an embodiment of a video decoding system in an embedded system provided by the present invention. The system embodiment shown in Figure 2 includes:

抽取装置201,用于以DC系数为第一行第一列的元素从视频流中第i帧的8x8的残差系数矩阵抽取一个4x4的残差系数矩阵;The extracting device 201 is used to extract a 4x4 residual coefficient matrix from the 8x8 residual coefficient matrix of the i-th frame in the video stream with the DC coefficient as the element in the first row and the first column;

反量化装置202,与所述抽取模块201相连,用于对所述4x4的残差系数矩阵进行反量化;An inverse quantization device 202, connected to the extraction module 201, for inverse quantizing the 4x4 residual coefficient matrix;

反变换装置203,与所述反量化模块202相连,用于对于反量化处理后的4x4的残差系数矩阵进行反变换处理,得到第i帧的视频的残差图像;The inverse transformation device 203 is connected to the inverse quantization module 202, and is used to perform an inverse transformation process on the 4x4 residual coefficient matrix after the inverse quantization process, to obtain a residual image of the i-th frame of video;

运动补偿装置204,用于以缩小为原来的1/4的视频的第i-1帧为参考帧,采用第i帧中各位置的宏块的运动矢量对所述第i帧进行运动补偿,得到第i帧的视频的运动补偿图像;The motion compensation device 204 is used to use the i-1th frame of the video reduced to 1/4 as the reference frame, and use the motion vectors of the macroblocks in each position in the i-th frame to perform motion compensation on the i-th frame, Obtain the motion-compensated image of the video of the i-th frame;

输出模块装置,与所述反变换模块203和所述运动补偿模块204相连,用于将运动补偿图像与残差图像相加,得到缩小为原来的1/4的视频的第i帧并输出。The output module device is connected with the inverse transformation module 203 and the motion compensation module 204, and is used to add the motion compensation image and the residual image to obtain the i-th frame of the video reduced to 1/4 of the original and output it.

其中,所述反变换装置可通过如下表达式对所述反量化处理后的4x4的残差系数矩阵进行反变换,但反变换的表达式并不仅限于此:Wherein, the inverse transformation device can inversely transform the 4x4 residual coefficient matrix after inverse quantization processing through the following expression, but the expression of inverse transformation is not limited to this:

ff (( xx ,, ythe y )) == 11 22 11 22 coscos (( ππ 88 )) 11 22 11 22 coscos (( 33 ππ 88 )) 11 22 11 22 coscos (( 33 ππ 88 )) -- 11 22 -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( 33 ππ 88 )) -- 11 22 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 coscos (( 33 ππ 88 )) Ff (( uu ,, vv )) 11 22 11 22 11 22 11 22 11 22 coscos (( ππ 88 )) 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( ππ 88 )) 11 22 -- 11 22 -- 11 22 11 22 11 22 coscos (( 33 ππ 88 )) -- 11 22 coscos (( ππ 88 )) 11 22 coscos (( ππ 88 )) -- 11 22 coscos (( 33 ππ 88 ))

其中,F(μ,v)为反量化的4x4的残差系数矩阵,f(x,y)为进行反变换处理后的矩阵。Wherein, F(μ, v) is a 4x4 residual coefficient matrix of inverse quantization, and f(x, y) is a matrix after inverse transformation processing.

图3为图2所示实施例中运动补偿装置204的结构示意图。图3所示运动补偿装置204包括:FIG. 3 is a schematic structural diagram of the motion compensation device 204 in the embodiment shown in FIG. 2 . The motion compensation device 204 shown in FIG. 3 includes:

获取模块301,用于对所述第i帧中各位置的宏块的运动矢量做除以2的处理,得到处理结果,将所述处理结果的整数部分作为该位置的宏块的目标运动矢量的大小;The obtaining module 301 is used to divide the motion vector of the macroblock at each position in the i-th frame by 2 to obtain a processing result, and use the integer part of the processing result as the target motion vector of the macroblock at the position the size of;

补偿模块302,与所述获取模块301相连,用于采用所述第i帧中各位置的宏块的目标运动矢量进行运动补偿。The compensation module 302 is connected to the acquisition module 301 and configured to perform motion compensation using the target motion vectors of the macroblocks at each position in the i-th frame.

图4为图3所示实施例中补偿模块302的结构示意图。图3所示补偿模块302包括:FIG. 4 is a schematic structural diagram of the compensation module 302 in the embodiment shown in FIG. 3 . The compensation module 302 shown in FIG. 3 includes:

修正子模块401,用于将运动矢量的处理结果包括有小数部分的宏块作为待补偿宏块,对所述待补偿宏块的运动矢量除以2后的处理结果进行矢量补偿,得到补偿结果,将所述补偿结果作为修正后的目标运动矢量;The correction sub-module 401 is configured to use a macroblock whose motion vector processing result includes a fractional part as a macroblock to be compensated, perform vector compensation on the processing result obtained by dividing the motion vector of the macroblock to be compensated by 2, and obtain a compensation result , using the compensation result as the corrected target motion vector;

补偿子模块402,与所述修正子模块相连,用于根据修正后的目标运动矢量进行运动补偿。The compensation sub-module 402 is connected with the correction sub-module, and is used for performing motion compensation according to the corrected target motion vector.

图5为图4所示实施例中修正子模块401的结构示意图。图5所示修正子模块401包括:FIG. 5 is a schematic structural diagram of the correction sub-module 401 in the embodiment shown in FIG. 4 . The correction submodule 401 shown in Figure 5 includes:

判断单元501,用于判断距离第i帧最近的帧上是否有同时满足如下条件的宏块,包括:Judging unit 501, for judging whether there is a macroblock satisfying the following conditions simultaneously on the frame closest to the i-th frame, including:

条件1:与所述待补偿宏块同位置的宏块;Condition 1: a macroblock at the same position as the macroblock to be compensated;

条件2:运动矢量除以2后的处理结果包括有小数部分的宏块;Condition 2: The processing result after the motion vector is divided by 2 includes a macroblock with a fractional part;

条件3:从未进行矢量补偿处理的宏块;Condition 3: Macroblocks that have never been processed for vector compensation;

修正单元502,与所述选择单元相连,用于在所述判断单元判断有时,将同时满足上述条件的宏块作为补偿宏块,将所述待补偿宏块的运动矢量除以2后的处理结果与所述补偿宏块的运动矢量的处理结果中的小数部分的运动矢量进行矢量叠加操作,得到所述补偿结果,将所述补偿结果作为修正后的目标运动矢量。The correction unit 502 is connected to the selection unit, and is used for the processing of dividing the motion vector of the macroblock to be compensated by 2 when the judging unit judges that the macroblock that satisfies the above conditions at the same time is used as the compensation macroblock A vector superposition operation is performed on the result and the motion vector of the fractional part in the processing result of the motion vector of the compensated macroblock to obtain the compensation result, and the compensation result is used as the corrected target motion vector.

可选的,所述运动补偿装置,用于采用所述第i帧中各位置的宏块的运动矢量对所述第i帧进行双线性插值的运动补偿。Optionally, the motion compensation device is configured to perform bilinear interpolation motion compensation on the i-th frame by using motion vectors of macroblocks at various positions in the i-th frame.

本发明提供的系统实施例,通过抽取重要的残差系数构造4x4的残差系数矩阵,使得后续进行的反量化和IDCT变换操作的计算量仅是原来的1/4,降低了视频解码的计算量,提高了解码速度,同时也使解码后的帧图像大小变为了原来的1/4,达到缩小视频图像的目的,满足了实时解码视频图像的应用需求。The system embodiment provided by the present invention constructs a 4x4 residual coefficient matrix by extracting important residual coefficients, so that the calculation amount of subsequent inverse quantization and IDCT transformation operations is only 1/4 of the original, reducing the calculation of video decoding The amount increases the decoding speed, and also reduces the size of the decoded frame image to 1/4 of the original size, achieving the purpose of shrinking the video image and meeting the application requirements for real-time decoding of video images.

另外,本发明也可首先获取视频流中第i帧的16x16残差系数矩阵,并通过抽取重要的残差系数、反量化以及IDCT变换等操作来提高解码速度,达到缩小视频图像的目的。为简洁,省略具体实现方式的描述。In addition, the present invention can first obtain the 16x16 residual coefficient matrix of the i-th frame in the video stream, and increase the decoding speed by extracting important residual coefficients, inverse quantization, and IDCT transformation to achieve the purpose of shrinking the video image. For brevity, the description of the specific implementation manner is omitted.

本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。Those skilled in the art can understand that all or part of the steps in the above embodiments can be implemented using a computer program flow, the computer program can be stored in a computer-readable storage medium, and the computer program can be run on a corresponding hardware platform (such as system, device, device, device, etc.), and when executed, includes one or a combination of the steps of the method embodiment.

可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。Optionally, all or part of the steps in the above embodiments can also be implemented using integrated circuits, and these steps can be fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module accomplish. As such, the present invention is not limited to any specific combination of hardware and software.

上述实施例中的各装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/functional modules/functional units in the above embodiments can be realized by general-purpose computing devices, and they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices.

上述实施例中的各装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When each device/functional module/functional unit in the above-mentioned embodiments is realized in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, and the like.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求所述的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope described in the claims.

Claims (12)

1. the coding/decoding method of video in the embedded system is characterized in that, comprising:
Be that the element of first row first row 8 * 8 residual error coefficient matrix of i frame from video flowing extracts one 4 * 4 residual error coefficient matrix with the DC coefficient;
Residual error coefficient matrix to described 4 * 4 carries out inverse quantization and inverse transformation, obtains the residual image of the video of i frame;
Be reference frame with the i-1 frame that is reduced into original 1/4 video, adopt the motion vector of the macro block of each position in the i frame that described i frame is carried out motion compensation, obtain the motion compensated image of the video of i frame, with motion compensated image and residual image addition, obtain being reduced into i frame and the output of original 1/4 video.
2. method according to claim 1 is characterized in that, described inverse transformation is undertaken by following expression:
f ( x , y ) = 1 2 1 2 cos ( π 8 ) 1 2 1 2 cos ( 3 π 8 ) 1 2 1 2 cos ( 3 π 8 ) - 1 2 - 1 2 cos ( π 8 ) 1 2 - 1 2 cos ( 3 π 8 ) - 1 2 1 2 cos ( π 8 ) 1 2 - 1 2 cos ( π 8 ) 1 2 - 1 2 cos ( 3 π 8 ) F ( u , v ) 1 2 1 2 1 2 1 2 1 2 cos ( π 8 ) 1 2 cos ( 3 π 8 ) - 1 2 cos ( 3 π 8 ) - 1 2 cos ( π 8 ) 1 2 - 1 2 - 1 2 1 2 1 2 cos ( 3 π 8 ) - 1 2 cos ( π 8 ) 1 2 cos ( π 8 ) - 1 2 cos ( 3 π 8 )
Wherein, (μ v) is the residual error coefficient matrix of 4 * 4 after the inverse quantization processing to F, and (x is y) for carrying out the matrix after inverse transformation is handled for f.
3. method according to claim 1 is characterized in that, adopts the motion vector of the macro block of each position in the i frame that described i frame is carried out motion compensation, comprising:
The motion vector of the macro block of each position in the described i frame is done processing divided by 2, obtain result, with the integer part of the described result size as the target motion vectors of the macro block of this position;
Adopt the target motion vectors of the macro block of each position in the described i frame to carry out motion compensation.
4. method according to claim 3 is characterized in that, adopts the target motion vectors of the macro block of each position in the described i frame to carry out motion compensation, comprising:
The result of motion vector is included the macro block of fractional part as macro block to be compensated, the motion vector of described macro block to be compensated is carried out vector compensation divided by the result after 2, be compensated the result, with described compensation result as revised target motion vectors;
Carry out motion compensation according to revised target motion vectors.
5. method according to claim 4 is characterized in that, the motion vector of described macro block to be compensated is carried out vector compensation divided by the result after 2, is compensated the result, and described compensation result as revised target motion vectors, being comprised:
On the nearest frame of judging distance i frame whether the macro block that satisfies following condition is simultaneously arranged, comprising:
Condition 1: with the macro block of described macro block co-located to be compensated;
Condition 2: motion vector includes the macro block of fractional part divided by the result after 2;
Condition 3: never carry out the macro block that vector compensation is handled;
If have, the macro block that then will satisfy above-mentioned condition simultaneously is macro block by way of compensation, the motion vector of described macro block to be compensated is carried out vector superposed operation divided by the motion vector of the fractional part in the result of the motion vector of the result after 2 and described compensation macro block, obtain described compensation result, with described compensation result as revised target motion vectors.
6. method according to claim 1 is characterized in that, adopts the motion vector of the macro block of each position in the i frame that described i frame is carried out motion compensation, comprising:
Adopt the motion vector of the macro block of each position in the described i frame that described i frame is carried out the motion compensation of bilinear interpolation.
7. the decode system of video in the embedded system is characterized in that, comprising:
Draw-out device, being used for the DC coefficient is that the element of first row, first row extracts one 4 * 4 residual error coefficient matrix from 8 * 8 residual error coefficient matrix of video flowing i frame;
Inverse quantization device, the residual error coefficient matrix that is used for described 4 * 4 carries out inverse quantization;
Inverse transformation device is used for carrying out the inverse transformation processing for the residual error coefficient matrix of 4 * 4 after the inverse quantization processing, obtains the residual image of the video of i frame;
Motion compensation unit, the i-1 frame that is used for to be reduced into original 1/4 video is reference frame, adopts the motion vector of the macro block of each position in the i frame that described i frame is carried out motion compensation, obtains the motion compensated image of the video of i frame;
Output device is used for motion compensated image and residual image addition, obtains being reduced into the i frame of original 1/4 video and exports.
8. system according to claim 7 is characterized in that, described inverse transformation device is that the residual error coefficient matrix of 4 * 4 after by following expression described inverse quantization being handled carries out inverse transformation:
f ( x , y ) = 1 2 1 2 cos ( π 8 ) 1 2 1 2 cos ( 3 π 8 ) 1 2 1 2 cos ( 3 π 8 ) - 1 2 - 1 2 cos ( π 8 ) 1 2 - 1 2 cos ( 3 π 8 ) - 1 2 1 2 cos ( π 8 ) 1 2 - 1 2 cos ( π 8 ) 1 2 - 1 2 cos ( 3 π 8 ) F ( u , v ) 1 2 1 2 1 2 1 2 1 2 cos ( π 8 ) 1 2 cos ( 3 π 8 ) - 1 2 cos ( 3 π 8 ) - 1 2 cos ( π 8 ) 1 2 - 1 2 - 1 2 1 2 1 2 cos ( 3 π 8 ) - 1 2 cos ( π 8 ) 1 2 cos ( π 8 ) - 1 2 cos ( 3 π 8 )
Wherein, (μ v) is the residual error coefficient matrix of 4 * 4 after the inverse quantization processing to F, and (x is y) for carrying out the matrix after inverse transformation is handled for f.
9. system according to claim 7 is characterized in that, described motion compensation unit comprises:
Acquisition module is used for the motion vector of the macro block of each position of described i frame is done processing divided by 2, obtains result, with the integer part of the described result size as the target motion vectors of the macro block of this position;
Compensating module, the target motion vectors that is used for the macro block of each position of the described i frame of employing is carried out motion compensation.
10. system according to claim 9 is characterized in that, described compensating module comprises:
Revise submodule, be used for the result of motion vector is included the macro block of fractional part as macro block to be compensated, the motion vector of described macro block to be compensated is carried out vector compensation divided by the result after 2, is compensated the result, with described compensation result as revised target motion vectors;
The compensation submodule is used for carrying out motion compensation according to revised target motion vectors.
11. system according to claim 10 is characterized in that, described compensation submodule comprises:
Judging unit is used on the nearest frame of judging distance i frame whether the macro block that satisfies following condition simultaneously being arranged, and comprising:
Condition 1: with the macro block of described macro block co-located to be compensated;
Condition 2: motion vector includes the macro block of fractional part divided by the result after 2;
Condition 3: never carry out the macro block that vector compensation is handled;
Amending unit, be used in described judgment unit judges sometimes, with the macro block that satisfies above-mentioned condition simultaneously macro block by way of compensation, the motion vector of described macro block to be compensated is carried out vector superposed operation divided by the motion vector of the fractional part in the result of the motion vector of the result after 2 and described compensation macro block, obtain described compensation result, with described compensation result as revised target motion vectors.
12. system according to claim 7 is characterized in that:
Described motion compensation unit, the motion vector that is used for the macro block of each position of the described i frame of employing carries out the motion compensation of bilinear interpolation to described i frame.
CN 201110132977 2011-05-20 2011-05-20 Video decoding method and system in embedded system Active CN102215404B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN 201110132977 CN102215404B (en) 2011-05-20 2011-05-20 Video decoding method and system in embedded system
TW100129016A TW201249216A (en) 2011-05-20 2011-08-16 Method for video decoding in an embedded system and system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110132977 CN102215404B (en) 2011-05-20 2011-05-20 Video decoding method and system in embedded system

Publications (2)

Publication Number Publication Date
CN102215404A CN102215404A (en) 2011-10-12
CN102215404B true CN102215404B (en) 2013-07-10

Family

ID=44746498

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110132977 Active CN102215404B (en) 2011-05-20 2011-05-20 Video decoding method and system in embedded system

Country Status (2)

Country Link
CN (1) CN102215404B (en)
TW (1) TW201249216A (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
ES2770609T3 (en) * 2012-07-02 2020-07-02 Samsung Electronics Co Ltd Entropy encoding of a video and entropy decoding of a video
CN111147954A (en) * 2019-12-30 2020-05-12 北京奇艺世纪科技有限公司 Thumbnail extraction method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1204207A (en) * 1997-06-26 1999-01-06 三星电子株式会社 Image format converter and method thereof
CN1866244A (en) * 2006-06-23 2006-11-22 浙江大学 Adaptive display method for graphic image in cooperative design in pervasive environment
CN101710994A (en) * 2009-12-17 2010-05-19 北京中星微电子有限公司 Method and system for video decoding
WO2010067668A1 (en) * 2008-12-08 2010-06-17 シャープ株式会社 Image encoder and image decoder
CN101888549A (en) * 2010-06-18 2010-11-17 浙江大学 Intra 4×4 Prediction Mode Selection Method Based on Transform Domain Information
WO2011053020A2 (en) * 2009-10-28 2011-05-05 Samsung Electronics Co., Ltd. Method and apparatus for encoding residual block, and method and apparatus for decoding residual block

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1204207A (en) * 1997-06-26 1999-01-06 三星电子株式会社 Image format converter and method thereof
CN1866244A (en) * 2006-06-23 2006-11-22 浙江大学 Adaptive display method for graphic image in cooperative design in pervasive environment
WO2010067668A1 (en) * 2008-12-08 2010-06-17 シャープ株式会社 Image encoder and image decoder
WO2011053020A2 (en) * 2009-10-28 2011-05-05 Samsung Electronics Co., Ltd. Method and apparatus for encoding residual block, and method and apparatus for decoding residual block
CN101710994A (en) * 2009-12-17 2010-05-19 北京中星微电子有限公司 Method and system for video decoding
CN101888549A (en) * 2010-06-18 2010-11-17 浙江大学 Intra 4×4 Prediction Mode Selection Method Based on Transform Domain Information

Also Published As

Publication number Publication date
TW201249216A (en) 2012-12-01
CN102215404A (en) 2011-10-12

Similar Documents

Publication Publication Date Title
KR101974261B1 (en) Encoding method and apparatus comprising convolutional neural network(cnn) based in-loop filter, and decoding method and apparatus comprising convolutional neural network(cnn) based in-loop filter
US9344731B2 (en) Image encoding and decoding apparatus and method
TWI587685B (en) An apparatus, a method and a computer program for video processing
WO2018127090A1 (en) Image prediction method and related device
JP2010501911A (en) Reducing errors during computation of inverse discrete cosine transform
KR20130099242A (en) Motion prediction in video coding
JP6409516B2 (en) Picture coding program, picture coding method, and picture coding apparatus
US10225573B1 (en) Video coding using parameterized motion models
WO2017005096A2 (en) Method and device for encoding multiple video streams
CN101360238A (en) Image processing device, image processing method and program
CN101682787A (en) Spatial Enhanced Transform Coding
RU2419855C2 (en) Reducing errors when calculating inverse discrete cosine transform
KR20130070644A (en) Methods, apparatuses and computer programs for video coding
US10110914B1 (en) Locally adaptive warped motion compensation in video coding
KR100723411B1 (en) Conversion apparatus and method for multi-codec, and inverse conversion apparatus and method for multi-codec
WO2024078066A1 (en) Video decoding method and apparatus, video encoding method and apparatus, storage medium, and device
CN118870028A (en) Video encoding and decoding method and device
CN102215404B (en) Video decoding method and system in embedded system
CN112352434A (en) Method and apparatus for aspect-ratio-based filtering for intra prediction
CN115988205B (en) Method and apparatus for intra prediction
JP4559811B2 (en) Information processing apparatus and information processing method
CN117979021A (en) End-to-end video transmission method, device, equipment and computer-readable storage medium
US9781439B2 (en) Combined parallel and pipelined video encoder
CN105338365B (en) Method for video coding and video coding apparatus
US20090074054A1 (en) Resolution-converting apparatus, resolution-converting method and previewing apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
ASS Succession or assignment of patent right

Owner name: CHANGXIN TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: HT MMOBILE INC.

Effective date: 20120913

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: TAIWAN, CHINA TO: HONG KONG, CHINA

TA01 Transfer of patent application right

Effective date of registration: 20120913

Address after: Room 5, building 42-56, 12 fortune business center, Kwong Wah Street, Mong Kok, Hongkong, China

Applicant after: HT mMobile Inc.

Address before: Science and Industry Park, Hsinchu County, Taiwan, China, No. 19-1

Applicant before: HT mMobile Inc.

C14 Grant of patent or utility model
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载