+

CN102769753B - H264 encoder and coding method - Google Patents

H264 encoder and coding method Download PDF

Info

Publication number
CN102769753B
CN102769753B CN201210272224.9A CN201210272224A CN102769753B CN 102769753 B CN102769753 B CN 102769753B CN 201210272224 A CN201210272224 A CN 201210272224A CN 102769753 B CN102769753 B CN 102769753B
Authority
CN
China
Prior art keywords
frame
data
unit
prediction
reference data
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
CN201210272224.9A
Other languages
Chinese (zh)
Other versions
CN102769753A (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.)
Omnivision Technologies Shanghai Co Ltd
Original Assignee
Omnivision Technologies Shanghai 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 Omnivision Technologies Shanghai Co Ltd filed Critical Omnivision Technologies Shanghai Co Ltd
Priority to CN201210272224.9A priority Critical patent/CN102769753B/en
Publication of CN102769753A publication Critical patent/CN102769753A/en
Application granted granted Critical
Publication of CN102769753B publication Critical patent/CN102769753B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本发明提供一种H.264编码器及编码方法,在实现帧间预测时,通过设定适当的搜索窗并对参考码流进行解码,从而获得当前宏块所需的参考数据,所涉及的存储空间仅包括用于参考的码流以及部分参考数据,大小远远小于一帧图像的大小,因而有效减少了H.264编码器所需参考帧的存储空间;同时由于没有使用片外存储器,整个H.264编码器的成本以及系统功耗被有效降低,而且,由于片内存储的读写性能一般要远优于片外存储,所以在进行大尺寸图像编码时,可以在保证图像质量的同时,大大提高存储数据吞吐率。

The present invention provides an H.264 encoder and encoding method. When realizing inter-frame prediction, by setting an appropriate search window and decoding the reference code stream, the reference data required by the current macroblock is obtained. The involved The storage space only includes code streams for reference and part of the reference data, and the size is much smaller than the size of a frame of image, thus effectively reducing the storage space of the reference frame required by the H.264 encoder; at the same time, because no off-chip memory is used, The cost of the entire H.264 encoder and system power consumption are effectively reduced. Moreover, since the read and write performance of on-chip storage is generally much better than that of off-chip storage, when encoding large-size images, image quality can be guaranteed. At the same time, the storage data throughput rate is greatly improved.

Description

H264编码器及编码方法H264 encoder and encoding method

技术领域 technical field

本发明涉及图像处理技术领域,尤其涉及一种H.264编码器及编码方法。The present invention relates to the technical field of image processing, in particular to an H.264 encoder and an encoding method.

背景技术 Background technique

H.264标准是联合视频组(JVT,JointVideoTeam)提出的一种高性能数字视频编解码标准,它最大的优势是具有很高的数据压缩率。在同等图像质量的条件下,H.264压缩比可以达到MPEG-4的2倍,之所以能有如此高的压缩比,这是因为H.264包含了一系列新的特征,比如多帧参考、变块尺寸运动补偿,还有高精度的亚像素运动补偿、去块效应滤波器等等。The H.264 standard is a high-performance digital video codec standard proposed by the Joint Video Team (JVT, Joint Video Team). Its biggest advantage is its high data compression rate. Under the condition of the same image quality, the compression ratio of H.264 can reach twice that of MPEG-4. The reason for such a high compression ratio is that H.264 contains a series of new features, such as multi-frame reference , variable block size motion compensation, and high-precision sub-pixel motion compensation, deblocking filter, etc.

根据H.264的标准规定,宏块(Macroblock或简称MB)类型主要分两大类:帧内(Intra)编码和帧间(Inter)编码。帧内编码使用当前宏块的相邻数据做预测,然后用当前宏块数据减去预测值,从而产生残差数据,最后对该残差进行后续的编码处理,整个过程不需要用到其他图像的数据。而帧间编码需要利用已经编码过的重建图像去做预测,即在重建图像中搜索出与当前块最匹配的数据块,由于视频图像在时间上的冗余性,帧间预测往往能找到比帧内预测更加匹配当前块的数据,这样就提高了整个图像压缩性能。由此可见,使用帧间编码能提高视频图像的压缩性能,但是在做帧间预测时需要一定的存储空间去存储一些重建图像,或称为参考帧(referenceframe)图像。依照H.264标准,参考帧至少1帧,最多可为16帧,如果所需编码的图像尺寸较大(例如VGA:640x480),那么这个参考帧的存储空间还是很可观的。According to the H.264 standard, macroblock (Macroblock or MB for short) types are mainly divided into two categories: intra-frame (Intra) coding and inter-frame (Inter) coding. Intra-frame encoding uses the adjacent data of the current macroblock for prediction, and then subtracts the predicted value from the current macroblock data to generate residual data, and finally performs subsequent encoding processing on the residual, without using other images in the whole process The data. However, inter-frame coding needs to use the encoded reconstructed image to make predictions, that is, to search for the data block that best matches the current block in the reconstructed image. Due to the temporal redundancy of video images, inter-frame prediction can often find a better Intra-prediction better matches the data of the current block, thus improving the overall image compression performance. It can be seen that the use of inter-frame coding can improve the compression performance of video images, but a certain storage space is required to store some reconstructed images, or referred to as reference frame (reference frame) images, when performing inter-frame prediction. According to the H.264 standard, the reference frame is at least 1 frame and can be up to 16 frames. If the size of the image to be encoded is large (such as VGA: 640x480), then the storage space for this reference frame is still considerable.

如图1所示,目前公开的H.264编码器包括以下子模块:As shown in Figure 1, the currently disclosed H.264 encoder includes the following submodules:

CurrentFrame:输入当前图像数据;CurrentFrame: Input the current image data;

ME/MC:MotionEstimation/MotionCompensation,即实现帧间预测;ME/MC: MotionEstimation/MotionCompensation, which realizes inter-frame prediction;

ChooseIntraMode:通过比较编码代价,选择最佳的帧内预测模式;ChooseIntraMode: Choose the best intra prediction mode by comparing the encoding cost;

IntraPrediction:根据最佳的帧内模式,实现帧内预测;IntraPrediction: Realize intra-frame prediction according to the best intra-frame mode;

ModeDecision:根据编码代价的大小来选择使用帧内预测还是帧间预测;ModeDecision: Choose whether to use intra prediction or inter prediction according to the size of the encoding cost;

DCT/Q:实现正向的DCT变换(即整数离散余弦变换)以及量化;DCT/Q: Realize forward DCT transform (that is, integer discrete cosine transform) and quantization;

EntropyEncoder:熵编码模块;EntropyEncoder: Entropy encoding module;

IDCT/InvQ:实现反向DCT变换及反量化;IDCT/InvQ: Realize inverse DCT transformation and inverse quantization;

Deblocking:为了减小块效应而对图像进行滤波;Deblocking: Filter the image in order to reduce the block effect;

片外存储器:提供1~16帧的参考帧数据1~16ReferenceFrames。Off-chip memory: Provide reference frame data 1~16ReferenceFrames of 1~16 frames.

H.264标准采用整数离散余弦变换(即DCT变换)及量化来消除图像信号中的相关性及减小图像编码的动态范围以达到压缩的目的。在图1中,由当前帧得到的残差数据Dn经过正向的DCT变换以及量化处理后,一方面进入熵编码模块进行编码,然后给出图像压缩后的码流(bitstream);另一方面,进入反向DCT变换以及反量化后,再加上预测值,就得到了重建数据Fn',该重建数据可以作为邻块值参与当前帧的帧内预测,而且它们经过环路Deblocking滤波后被写入片外存储器,可以作为后续帧的帧间预测的参考数据。The H.264 standard uses integer discrete cosine transform (ie, DCT transform) and quantization to eliminate the correlation in the image signal and reduce the dynamic range of image coding to achieve the purpose of compression. In Fig. 1, after the residual data Dn obtained from the current frame undergoes forward DCT transformation and quantization processing, on the one hand, it enters the entropy coding module for coding, and then gives the code stream (bitstream) after image compression; on the other hand, , after entering the inverse DCT transformation and dequantization, plus the predicted value, the reconstructed data Fn' is obtained. The reconstructed data can be used as the adjacent block value to participate in the intra-frame prediction of the current frame, and they are filtered by the loop Deblocking It can be written into the off-chip memory as reference data for inter-frame prediction of subsequent frames.

现有技术的H.264编码器虽然可以通过使用片外存储器来实现帧间预测,满足大尺寸图像的编码时对存储器的空间以及数据吞吐率的高要求,但是另一方面会由于片外存储器很高的数据吞吐率而大大增加系统成本以及系统功耗,使得该H.264编码器不能满足低功耗设备的要求。Although the H.264 encoder in the prior art can realize inter-frame prediction by using an off-chip memory to meet the high requirements for memory space and data throughput when encoding large-size images, on the other hand it will High data throughput greatly increases system cost and system power consumption, making the H.264 encoder unable to meet the requirements of low-power devices.

发明内容 Contents of the invention

本发明的目的在于提供一种H.264编码器及编码方法,可以在保证图像质量的同时,节约参考帧的存储空间,提高数据吞吐率,降低系统成本以及系统功耗。The purpose of the present invention is to provide an H.264 encoder and encoding method, which can save the storage space of reference frames, improve data throughput, and reduce system cost and power consumption while ensuring image quality.

为解决上述问题,本发明提出一种H.264编码器,包括:In order to solve the above problems, the present invention proposes a H.264 encoder, including:

编码子系统,用于输入当前图像的数据,进行当前宏块的帧内预测或帧间预测以得到所述当前宏块的残差数据,对所述残差数据进行DCT变换和量化以及熵编码后输出所述当前宏块的码流,其中,在对当前宏块进行帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好需要的参考数据;The encoding subsystem is used to input the data of the current image, perform intra-frame prediction or inter-frame prediction of the current macroblock to obtain the residual data of the current macroblock, and perform DCT transformation, quantization and entropy coding on the residual data Then output the code stream of the current macroblock, wherein, when performing inter-frame prediction on the current macroblock, set the search window of the current macroblock, and prepare the required reference data in the search window;

码流缓存模块,用于缓存参考码流,所述的参考码流为参考帧图像经过编码后的码流;A code stream caching module, configured to cache a reference code stream, where the reference code stream is an encoded code stream of a reference frame image;

解码子系统,用于对所述参考码流进行熵解码以及反向DCT变换和反量化,获得所述编码子系统进行帧间预测时所需要的参考数据;The decoding subsystem is used to perform entropy decoding, reverse DCT transformation and inverse quantization on the reference code stream, and obtain the reference data required by the encoding subsystem for inter-frame prediction;

参考数据缓存模块,用于缓存所述解码子系统获得的参考数据,并为所述编码子系统提供当前宏块的帧间预测时的搜索窗内所需要的参考数据。The reference data buffering module is used for buffering the reference data obtained by the decoding subsystem, and providing the encoding subsystem with the reference data required in the search window during the inter-frame prediction of the current macroblock.

进一步地,所述编码子系统包括:Further, the encoding subsystem includes:

控制单元,用于输入当前宏块数据,并给出一个宏块启动信号分送到其他单元以通知其他单元启动宏块相应的计算;The control unit is used to input the current macroblock data, and send a macroblock start signal to other units to notify other units to start the corresponding calculation of the macroblock;

求残差单元,用于进行当前宏块的帧内预测或帧间预测,得到所述当前宏块的残差数据,其中,在对当前宏块进行帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好所需要的参考数据,该参考数据是通过对参考码流进行解码而获得;The residual unit is used to perform intra-frame prediction or inter-frame prediction of the current macroblock to obtain the residual data of the current macroblock, wherein, when performing inter-frame prediction on the current macroblock, set the current macroblock Search the window, and prepare the required reference data in the search window, the reference data is obtained by decoding the reference code stream;

正向DCT变换和量化单元,用于对所述残差数据进行正向DCT变换和量化;A forward DCT transform and quantization unit, configured to perform forward DCT transform and quantization on the residual data;

熵编码单元,用于将所述对正向DCT变换和量化后的残差数据进行熵编码,生成所述当前宏块的码流;An entropy encoding unit, configured to perform entropy encoding on the forward DCT transformed and quantized residual data to generate a code stream of the current macroblock;

反向DCT变换和反量化单元,用于对正向DCT变换和量化后的残差数据进行反向DCT变换和反量化;Inverse DCT transformation and dequantization unit, for performing reverse DCT transformation and dequantization on residual data after forward DCT transformation and quantization;

重构单元,用于对反向DCT变换和反量化后的残差数据和所述当前宏块的帧内预测或帧间预测后的数据进行相加,得到重构数据,为下一宏块的帧内预测提供参考数据。The reconstruction unit is used to add the residual data after inverse DCT transformation and inverse quantization to the intra-predicted or inter-predicted data of the current macroblock to obtain reconstructed data, which is the next macroblock The intra prediction of provides reference data.

进一步地,所述求残差单元包括:Further, the residual unit includes:

预测模式选择模块,用于根据编码代价的大小为当前宏块选择帧内预测或帧间预测模式;A prediction mode selection module, configured to select an intra-frame prediction or an inter-frame prediction mode for the current macroblock according to the size of the encoding cost;

帧间预测模块,用于在帧间预测模式下,为当前宏块设定搜索窗,并从所述参考数据缓存模块中选择出所述搜索窗需要的参考数据,并依据所述参考数据对当前宏块进行帧间预测;The inter-frame prediction module is used to set the search window for the current macroblock in the inter-frame prediction mode, select the reference data required by the search window from the reference data cache module, and pair the search window according to the reference data The current macroblock performs inter-frame prediction;

帧内预测模式选择模块,用于根据先前已编码的宏块得到的重构数据,选择当前宏块的最佳帧内预测模式;An intra-frame prediction mode selection module is used to select the best intra-frame prediction mode of the current macroblock according to the reconstructed data obtained by the previously coded macroblock;

帧内预测模块,用于根据所述最佳帧内预测模式以及所述重构数据对所述当前宏块进行帧内预测;An intra-frame prediction module, configured to perform intra-frame prediction on the current macroblock according to the optimal intra-frame prediction mode and the reconstructed data;

多路选择模块,用于实现预测模式选择模块、帧内预测模块以及帧间预测模块输出的预测数据的选择。The multiplex selection module is used to realize the selection of the prediction data output by the prediction mode selection module, the intra-frame prediction module and the inter-frame prediction module.

进一步地,所述解码子系统包括:Further, the decoding subsystem includes:

熵解码单元,用于对所述参考码流进行熵解码;an entropy decoding unit, configured to perform entropy decoding on the reference code stream;

反向DCT变换和反量化单元,用于对所述熵解码单元输出的残差系数进行反向DCT变换和反量化;An inverse DCT transform and inverse quantization unit, configured to perform inverse DCT transform and inverse quantization on the residual coefficients output by the entropy decoding unit;

帧内预测单元,用于根据所述熵解码单元输出的帧内预测模式进行帧内预测;an intra prediction unit, configured to perform intra prediction according to the intra prediction mode output by the entropy decoding unit;

重构单元,用于对解码子系统的反向DCT变换和反量化单元输出的残差数据和帧内预测单元输出的预测数据进行相加,得到重构数据,作为宏块帧间预测时搜索窗内所需要的参考数据。The reconstruction unit is used to add the residual data output by the inverse DCT transform and inverse quantization unit of the decoding subsystem and the prediction data output by the intra prediction unit to obtain reconstructed data, which is used as the macroblock inter-frame prediction search The reference data required in the window.

进一步地,所述解码子系统的帧内预测单元与所述编码子系统的帧内预测模块为复用的同一个帧内预测器或者两个独立的帧内预测器。Further, the intra-frame prediction unit of the decoding subsystem and the intra-frame prediction module of the encoding subsystem are the same intra-frame predictor or two independent intra-frame predictors that are multiplexed.

进一步地,所述解码子系统的反向DCT变换和反量化单元与所述编码子系统的反向DCT变换和反量化单元为复用的同一个反向DCT变换/反量化器或两个独立的反向DCT变换/反量化器。Further, the inverse DCT transform and inverse quantization unit of the decoding subsystem and the inverse DCT transform and inverse quantization unit of the encoding subsystem are the same inverse DCT transform/dequantizer or two independent The inverse DCT transform/inverse quantizer.

进一步地,所述解码子系统还包括:滤波单元,用于在所述解码子系统获得的参考数据缓存到所述参考数据缓存模块之前,对所述参考数据进行滤波。Further, the decoding subsystem further includes: a filtering unit, configured to filter the reference data obtained by the decoding subsystem before being cached in the reference data caching module.

进一步地,所述参考数据缓存模块为循环存储器,设有一定宏块数的存储空间,在缓存所述解码子系统获得的参考数据时,当前获得的参考数据覆盖所述循环存储器中进行帧间预测时不会再使用到的参考数据。Further, the reference data cache module is a circular memory, which is provided with a storage space of a certain number of macroblocks. When buffering the reference data obtained by the decoding subsystem, the currently obtained reference data covers the circular memory for inter-frame Reference data that will no longer be used for forecasting.

进一步地,所述参考数据缓存模块存储的宏块数S的计算公式为:Further, the calculation formula of the number S of macroblocks stored in the reference data cache module is:

S=Ceil(sw_height_by_pix/16)*pic_width_by_mb-(pic_width_by_mb-Ceil(sw_width_by_pix/16))+1S=Ceil(sw_height_by_pix/16)*pic_width_by_mb-(pic_width_by_mb-Ceil(sw_width_by_pix/16))+1

其中,Ceil(x)表示大于或等于x的最小整数;Among them, Ceil(x) represents the smallest integer greater than or equal to x;

sw_height_by_pix是以像素为单位表示的搜索窗的高度;sw_height_by_pix is the height of the search window expressed in pixels;

sw_width_by_pix是以像素为单位表示的搜索窗的宽度;sw_width_by_pix is the width of the search window expressed in pixels;

pic_width_by_mb是以宏块为单位表示的图像的宽度。pic_width_by_mb is the width of the picture expressed in units of macroblocks.

进一步地,所述参考数据缓存模块缓存的所述参考数据还包括P帧的数据,所述P帧的数据是通过编码子系统以一个I帧为参考数据编码以及通过所述解码子系统解码得到的。Further, the reference data cached by the reference data caching module also includes P frame data, and the P frame data is obtained by encoding an I frame as reference data through the encoding subsystem and decoding through the decoding subsystem of.

进一步地,所述编码子系统对输入的当前图像的后续P帧编码时,以所述参考数据缓存模块中的I帧数据或P帧数据为参考数据。Further, when the encoding subsystem encodes the subsequent P frames of the input current image, the I frame data or the P frame data in the reference data buffer module is used as reference data.

进一步地,所述解码子系统包括用于提供所述P帧类型的参考数据的P帧解码系统和所述I帧类型的参考数据的I帧解码系统。Further, the decoding subsystem includes a P frame decoding system for providing reference data of the P frame type and an I frame decoding system for providing reference data of the I frame type.

进一步地,所述I帧解码系统包括:Further, the I frame decoding system includes:

第一熵解码单元,用于对所述参考码流中的I帧参考码流进行熵解码;A first entropy decoding unit, configured to perform entropy decoding on an I-frame reference code stream in the reference code stream;

第一反向DCT变换和反量化单元,用于对所述第一熵解码单元输出的残差系数进行反向DCT变换和反量化;A first inverse DCT transform and inverse quantization unit, configured to perform inverse DCT transform and inverse quantization on the residual coefficient output by the first entropy decoding unit;

第一帧内预测单元,用于根据所述第一熵解码单元输出的帧内预测模式进行帧内预测;a first intra-frame prediction unit, configured to perform intra-frame prediction according to the intra-frame prediction mode output by the first entropy decoding unit;

第一重构单元,用于对所述第一反向DCT变换和反量化单元输出的残差数据和第一帧内预测单元输出的预测数据进行相加,获得所述I帧参考码流的重构数据,以用于P帧参考码流的解码或用作当前宏块的帧间预测时其搜索窗内所需要的参考数据;The first reconstruction unit is configured to add the residual data output by the first inverse DCT transform and inverse quantization unit and the prediction data output by the first intra prediction unit to obtain the I frame reference code stream The reconstructed data is used for the decoding of the P-frame reference code stream or as the reference data required in the search window for the inter-frame prediction of the current macroblock;

第一滤波单元,用于对第一重构单元的参考数据进行滤波。The first filtering unit is configured to filter the reference data of the first reconstruction unit.

进一步地,所述P帧解码系统包括:Further, the P frame decoding system includes:

第二熵解码单元,用于对所述参考码流中的P帧参考码流进行熵解码;A second entropy decoding unit, configured to perform entropy decoding on the P frame reference code stream in the reference code stream;

第二反向DCT变换和反量化单元,用于对所述第二熵解码单元的残差系数进行反向DCT变换和反量化;A second inverse DCT transform and inverse quantization unit, configured to perform inverse DCT transform and inverse quantization on the residual coefficients of the second entropy decoding unit;

第二帧内预测单元,用于根据所述第二熵解码单元输出的帧内预测模式进行帧内预测;a second intra-frame prediction unit, configured to perform intra-frame prediction according to the intra-frame prediction mode output by the second entropy decoding unit;

第二帧间预测单元,用于根据所述的第一重构单元的重构数据和所述第二熵解码单元输出的运动向量进行帧间预测;a second inter-frame prediction unit, configured to perform inter-frame prediction according to the reconstructed data of the first reconstruction unit and the motion vector output by the second entropy decoding unit;

第二重构单元,用于对所述第二反向DCT变换和反量化单元输出的残差数据和第二帧内预测单元或第二帧间预测单元输出的预测数据进行相加,获得所述P帧参考码流的重构数据,以用于所述当前宏块的帧间预测时其搜索窗内所需要的参考数据;The second reconstruction unit is configured to add the residual data output by the second inverse DCT transform and inverse quantization unit to the prediction data output by the second intra prediction unit or the second inter prediction unit, to obtain the The reconstructed data of the P-frame reference code stream is used for the reference data required in the search window of the current macroblock during inter-frame prediction;

第二滤波单元,用于对第二重构单元的参考数据进行滤波。The second filtering unit is configured to filter the reference data of the second reconstruction unit.

相应的,本发明还提供一种H.264的编码方法,包括以下步骤:Correspondingly, the present invention also provides a kind of H.264 coding method, comprises the following steps:

(1)判断当前宏块是否需要进行帧间预测,如果不需要帧间预测,则对当前宏块进行编码,并转入步骤(4),如果需要帧间预测,则进入下一步;(1) Determine whether the current macroblock needs to perform inter-frame prediction, if no inter-frame prediction is required, encode the current macroblock, and transfer to step (4), if inter-frame prediction is required, proceed to the next step;

(2)为当前宏块设定搜索窗,判断搜索窗内的参考数据是否准备好,如果是,则根据参考数据对当前宏块进行编码,转入步骤(4),如果否,则进入下一步;(2) Set the search window for the current macroblock, judge whether the reference data in the search window is ready, if yes, encode the current macroblock according to the reference data, and go to step (4), if not, go to the next step step;

(3)对参考码流进行解码,获得一个宏块的参考数据,返回步骤(2);(3) Decode the reference code stream to obtain the reference data of a macroblock, and return to step (2);

(4)判断是否结束编码,如果未结束,则处理下一个宏块并返回步骤(1)。(4) Judging whether to end encoding, if not, process the next macroblock and return to step (1).

进一步地,所述参考数据为I帧类型的参考数据。Further, the reference data is I frame type reference data.

进一步地,所述参考数据包括P帧类型的参考数据,所述P帧类型的参考数据是以I帧类型的参考帧数据为参考来编码、解码得到的。Further, the reference data includes reference data of the P frame type, and the reference data of the P frame type is encoded and decoded by referring to the reference frame data of the I frame type.

进一步地,在步骤(1)中,在不需要帧间预测时,对当前宏块进行编码的过程包括:Further, in step (1), when inter-frame prediction is not required, the process of encoding the current macroblock includes:

依据先前已编码宏块重构处理后得到的参考数据进行当前宏块的帧内预测,得到帧内预测值,再用当前宏块数据减去该预测值,得到所述当前宏块的残差数据;Perform intra-frame prediction of the current macroblock according to the reference data obtained after the previous coded macroblock reconstruction processing to obtain an intra-frame prediction value, and then subtract the prediction value from the current macroblock data to obtain the residual of the current macroblock data;

对所述当前宏块残差数据进行正向DCT变换和量化;performing forward DCT transformation and quantization on the residual data of the current macroblock;

将所述对正向DCT变换和量化后的残差数据进行熵编码,生成所述当前宏块的码流并缓存;performing entropy encoding on the residual data after forward DCT transformation and quantization, generating and caching the code stream of the current macroblock;

对正向DCT变换和量化后的残差数据进行反向DCT变换和反量化;Perform reverse DCT transformation and dequantization on the residual data after forward DCT transformation and quantization;

对反向DCT变换和反量化后的残差数据和所述最佳预测模式的预测数据进行重构,得到用于下一宏块的帧内预测的参考数据。The residual data after inverse DCT transformation and dequantization and the prediction data of the best prediction mode are reconstructed to obtain reference data for intra-frame prediction of the next macroblock.

进一步地,在步骤(2)中,在搜索窗内准备当前宏块的参考数据的过程包括:Further, in step (2), the process of preparing the reference data of the current macroblock within the search window includes:

对缓存的参考码流进行熵解码;Perform entropy decoding on the cached reference code stream;

对通过熵解码而得到的残差系数进行反向DCT变换和反量化;Perform inverse DCT transformation and inverse quantization on residual coefficients obtained by entropy decoding;

根据熵解码输出的帧内预测模式进行帧内预测;perform intra-frame prediction according to the intra-frame prediction mode output by entropy decoding;

对反向DCT变换和反量化后的残差数据和帧内预测后的预测数据进行重构,获得当前宏块的帧间预测时的搜索窗内需要的参考数据并缓存。The residual data after inverse DCT transformation and dequantization and the prediction data after intra-frame prediction are reconstructed to obtain and cache the reference data required in the search window during inter-frame prediction of the current macroblock.

进一步地,在步骤(2)中,在搜索窗内的参考数据准备好后,根据参考数据对当前宏块进行编码的过程包括:Further, in step (2), after the reference data in the search window is prepared, the process of encoding the current macroblock according to the reference data includes:

依据所述参考数据进行当前宏块的帧间预测,通过比较帧内预测和帧间预测的编码代价,选择编码代价较小的预测模式作为当前宏块的最佳预测模式输出,并得到所述当前宏块的残差数据;Perform inter-frame prediction of the current macroblock according to the reference data, compare the coding costs of intra-frame prediction and inter-frame prediction, select a prediction mode with a smaller coding cost as the best prediction mode of the current macroblock, and obtain the Residual data of the current macroblock;

对所述当前宏块残差数据进行正向DCT变换和量化;performing forward DCT transformation and quantization on the residual data of the current macroblock;

将所述对正向DCT变换和量化后的残差数据进行熵编码,生成所述当前宏块的码流并缓存;performing entropy encoding on the residual data after forward DCT transformation and quantization, generating and caching the code stream of the current macroblock;

对正向DCT变换和量化后的残差数据进行反向DCT变换和反量化;Perform reverse DCT transformation and dequantization on the residual data after forward DCT transformation and quantization;

对反向DCT变换和反量化后的残差数据和所述最佳预测模式的预测数据进行重构,得到用于下一宏块的帧内预测的参考数据。The residual data after inverse DCT transformation and dequantization and the prediction data of the best prediction mode are reconstructed to obtain reference data for intra-frame prediction of the next macroblock.

与现有技术相比,本发明所述提供的H.264编码器及编码方法,在实现帧间预测时,通过设定搜索窗获得当前宏块所需的参考数据,涉及的存储空间仅包括存储的参考码流以及部分参考数据,大小远远小于一帧图像的大小,因而有效减少了H.264编码器所需参考帧的存储空间;同时由于没有使用片外存储器,整个H.264编码器的成本以及系统功耗被有效降低,而且,由于片内存储的读写性能一般要远优于片外存储,所以在进行大尺寸图像编码时,可以在保证图像质量的同时,大大提高存储数据吞吐率。Compared with the prior art, the H.264 encoder and encoding method provided by the present invention obtain the reference data required by the current macroblock by setting the search window when realizing inter-frame prediction, and the storage space involved only includes The size of the stored reference code stream and part of the reference data is much smaller than the size of a frame of image, thus effectively reducing the storage space of the reference frame required by the H.264 encoder; at the same time, because no off-chip memory is used, the entire H.264 encoding The cost of the device and the power consumption of the system are effectively reduced. Moreover, since the read and write performance of the on-chip storage is generally much better than that of the off-chip storage, when large-scale image encoding is performed, the image quality can be guaranteed while greatly improving the storage capacity. Data throughput.

附图说明 Description of drawings

图1是现有技术的一种H.264编码器的结构示意图;Fig. 1 is the structural representation of a kind of H.264 coder of prior art;

图2是本发明的H.264编码器的结构示意图;Fig. 2 is the structural representation of H.264 coder of the present invention;

图3是本发明的H.264编码器的编码工作简易流程图;Fig. 3 is the simple flow chart of the encoding work of H.264 encoder of the present invention;

图4是本发明实施例一的H.264编码器的结构示意图;FIG. 4 is a schematic structural diagram of an H.264 encoder according to Embodiment 1 of the present invention;

图5是本发明实施例一的H.264编码器的编码顺序及参考关系示意图;FIG. 5 is a schematic diagram of the encoding sequence and reference relationship of the H.264 encoder according to Embodiment 1 of the present invention;

图6是本发明实施例一的H.264编码器的宏块对应搜索窗位置示意图;FIG. 6 is a schematic diagram of the position of the search window corresponding to the macroblock of the H.264 encoder according to Embodiment 1 of the present invention;

图7是本发明实施例一的H.264编码器的编码/解码子系统的宏块对应关系示意图;FIG. 7 is a schematic diagram of the macroblock correspondence relationship of the encoding/decoding subsystem of the H.264 encoder according to Embodiment 1 of the present invention;

图8是本发明实施例二的H.264编码器的结构示意图;FIG. 8 is a schematic structural diagram of an H.264 encoder according to Embodiment 2 of the present invention;

图9是本发明实施例二的H.264编码器的编码/解码子系统的宏块对应关系示意图;FIG. 9 is a schematic diagram of the macroblock correspondence relationship of the encoding/decoding subsystem of the H.264 encoder according to Embodiment 2 of the present invention;

图10是本发明实施例三的H.264编码器的结构示意图;FIG. 10 is a schematic structural diagram of an H.264 encoder according to Embodiment 3 of the present invention;

图11是本发明实施例三的H.264编码器的编码顺序及参考关系示意图;FIG. 11 is a schematic diagram of the encoding sequence and reference relationship of the H.264 encoder according to Embodiment 3 of the present invention;

图12是本发明实施例三的H.264编码器的编码/解码子系统的宏块对应关系示意图。FIG. 12 is a schematic diagram of macroblock correspondences of the encoding/decoding subsystem of the H.264 encoder according to Embodiment 3 of the present invention.

具体实施方式 Detailed ways

由于帧间预测宏块分为前向帧间预测宏块和双向帧间预测宏块,所以在H.264标准中存在三种主要的帧类型:I帧,P帧和B帧。其中I帧的所有宏块都是帧内预测,P帧包含了前向帧间预测宏块和帧内预测宏块,而B帧则包含了双向帧间预测宏块和帧内预测宏块。当然,实现P帧和B帧编码是需要参考帧的,而I帧则不需要。Since inter-prediction macroblocks are divided into forward inter-prediction macroblocks and bidirectional inter-prediction macroblocks, there are three main frame types in the H.264 standard: I frame, P frame and B frame. All the macroblocks of the I frame are intra-prediction, the P frame contains the forward interframe prediction macroblock and the intraframe prediction macroblock, and the B frame contains the bidirectional interframe prediction macroblock and the intraframe prediction macroblock. Of course, the realization of P-frame and B-frame encoding requires a reference frame, but I-frame does not.

因此,本发明提出的H.264编码器及编码方法,主要包括以下几个方面:Therefore, the H.264 encoder and encoding method proposed by the present invention mainly include the following aspects:

存储参考帧编码后的码流(bitstream),即参考码流;Store the encoded bitstream of the reference frame, that is, the reference bitstream;

帧间预测时,设定一定大小的搜索窗(searchwindow),搜索最佳匹配块数据都在搜索窗内进行;During inter-frame prediction, set a search window (search window) of a certain size, and search for the best matching block data within the search window;

通过对参考码流进行解码,得到当前宏块所需的搜索窗数据,并存储这些数据;Obtain the search window data required by the current macroblock by decoding the reference code stream, and store the data;

考虑到对参考码流进行解码的独立性,所以参考码流中至少有一帧是I帧。Considering the independence of decoding the reference code stream, at least one frame in the reference code stream is an I frame.

因此,请参考图2,本发明提供的H.264编码器,主要包括以下四部分:Therefore, referring to Fig. 2, the H.264 encoder provided by the present invention mainly includes the following four parts:

编码子系统10,用于输入当前图像的数据,进行当前宏块的帧内预测或帧间预测以得到所述当前宏块的残差数据,对所述残差数据进行DCT变换和量化以及熵编码后输出所述当前宏块的码流,其中,在对当前宏块进行帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好需要的参考数据;The encoding subsystem 10 is used to input the data of the current image, perform intra-frame prediction or inter-frame prediction of the current macroblock to obtain the residual data of the current macroblock, and perform DCT transformation, quantization and entropy on the residual data Outputting the code stream of the current macroblock after encoding, wherein, when performing inter-frame prediction on the current macroblock, setting a search window for the current macroblock, and preparing required reference data within the search window;

码流缓存模块20,用于缓存参考码流,所述的参考码流为参考帧图像经过编码后的码流,即如果当前帧会被用于后续帧的参考帧,那么当前帧的所有宏块的码流会一直被保存,直到该帧作为参考帧的属性被取消;如果当前帧不被用于后续帧的参考帧,那么当前宏块的码流在被送出编码系统后,比如写入SD卡,这些码流可以被后续的码流数据覆盖;The code stream buffer module 20 is used to cache the reference code stream, and the reference code stream is the code stream after the reference frame image is encoded, that is, if the current frame will be used as the reference frame of the subsequent frame, then all the macros of the current frame The code stream of the block will be saved until the attribute of the frame as a reference frame is cancelled; if the current frame is not used as the reference frame of the subsequent frame, the code stream of the current macroblock will be sent to the coding system, such as writing SD card, these code streams can be overwritten by subsequent code stream data;

解码子系统30,用于对所述参考码流进行熵解码以及反向DCT变换和反量化,获得当前宏块的帧间预测时的搜索窗内所需要的参考数据;The decoding subsystem 30 is configured to perform entropy decoding, inverse DCT transformation, and inverse quantization on the reference code stream to obtain reference data required in the search window during inter-frame prediction of the current macroblock;

参考数据缓存模块40,用于缓存所述解码子系统获得的参考数据,并为所述编码子系统提供当前宏块的帧间预测时的搜索窗内所需要的参考数据。The reference data caching module 40 is configured to cache the reference data obtained by the decoding subsystem, and provide the coding subsystem with the reference data required in the search window during the inter-frame prediction of the current macroblock.

请参考图3,本发明提供的H.264编码器的编码/解码过程都是以宏块(MB)为单位进行的,而且在对当前MB进行编码的同时,解码子系统也可以同时工作,提前为下一个宏块准备参考数据,可以有效提高整个系统的编码速度。在当前宏块的实现帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好需要的参考数据,若是未准备参考数据,则调用解码子系统30,按照宏块的光栅扫描顺序对参考码流进一步解码,获得当前宏块帧间预测所述的参考数据。Please refer to Figure 3, the encoding/decoding process of the H.264 encoder provided by the present invention is carried out in units of macroblocks (MB), and while encoding the current MB, the decoding subsystem can also work simultaneously, Preparing reference data for the next macroblock in advance can effectively improve the encoding speed of the entire system. When realizing the inter-frame prediction of the current macroblock, set the search window of the current macroblock, and prepare the reference data needed in the search window, if the reference data is not prepared, then call the decoding subsystem 30, according to the macroblock The reference code stream is further decoded in the raster scan order of the current macroblock to obtain the reference data for inter-frame prediction of the current macroblock.

以下结合附图和具体实施例对本发明提出的H.264编码器及编码方法作进一步详细说明。The H.264 encoder and encoding method proposed by the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

实施例一Embodiment one

请参考图4,本实施例提供一种H.264编码器,包括以下四部分:Please refer to FIG. 4. This embodiment provides an H.264 encoder, which includes the following four parts:

编码子系统10,用于输入当前图像的数据,进行当前宏块的帧内预测或帧间预测以得到所述当前宏块的残差数据,对所述残差数据进行DCT变换和量化以及熵编码后输出所述当前宏块的码流,其中,在对当前宏块进行帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好需要的参考数据;The encoding subsystem 10 is used to input the data of the current image, perform intra-frame prediction or inter-frame prediction of the current macroblock to obtain the residual data of the current macroblock, and perform DCT transformation, quantization and entropy on the residual data Outputting the code stream of the current macroblock after encoding, wherein, when performing inter-frame prediction on the current macroblock, setting a search window for the current macroblock, and preparing required reference data within the search window;

码流缓存模块BitstreamBuffer20,用于缓存参考码流,所述的参考码流为参考帧图像经过编码后的码流;The bitstream buffer module BitstreamBuffer20 is used to cache the reference bitstream, and the reference bitstream is the coded bitstream of the reference frame image;

解码子系统30,用于对所述参考码流进行解码以及反向DCT变换和反量化,获得当前宏块的帧间预测时的搜索窗内所需要的参考数据;The decoding subsystem 30 is used to decode the reference code stream, perform inverse DCT transformation and inverse quantization, and obtain the reference data required in the search window during the inter-frame prediction of the current macroblock;

参考数据缓存模块ReferenceData40,用于缓存所述解码子系统获得的参考数据,并为所述编码子系统提供当前宏块的帧间预测时的搜索窗内所需要的参考数据。The reference data cache module ReferenceData40 is used to cache the reference data obtained by the decoding subsystem, and provide the encoding subsystem with the reference data required in the search window during the inter-frame prediction of the current macroblock.

请继续参考图4,本实施例中,编码子系统10包括以下子单元:Please continue to refer to FIG. 4, in the present embodiment, the coding subsystem 10 includes the following subunits:

控制单元CurrentFrame101,用于输入当前宏块数据,并给出一个宏块启动信号分送到其他单元以通知其他单元启动宏块相应的计算;The control unit CurrentFrame101 is used to input the current macroblock data, and send a macroblock start signal to other units to notify other units to start the corresponding calculation of the macroblock;

求残差单元,用于进行当前宏块的帧内预测或帧间预测,得到所述当前宏块的残差数据,其中,在对当前宏块进行帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好需要的参考数据,该参考数据是通过对参考码流进行解码而获得;The residual unit is used to perform intra-frame prediction or inter-frame prediction of the current macroblock to obtain the residual data of the current macroblock, wherein, when performing inter-frame prediction on the current macroblock, set the current macroblock Search the window, and prepare the required reference data in the search window, the reference data is obtained by decoding the reference code stream;

正向DCT变换和量化单元DCT/Q103,用于对所述残差数据进行正向DCT变换和量化;A forward DCT transformation and quantization unit DCT/Q103, configured to perform forward DCT transformation and quantization on the residual data;

熵编码单元EntropyEncoder104,用于将所述对正向DCT变换和量化后的残差数据进行熵编码,生成所述当前宏块的码流;An entropy encoding unit EntropyEncoder104, configured to perform entropy encoding on the residual data after the forward DCT transformation and quantization, to generate the code stream of the current macroblock;

反向DCT变换和反量化单元IDCT/InvQ105,用于对正向DCT变换和量化后的残差数据进行反向DCT变换和反量化;The inverse DCT transformation and inverse quantization unit IDCT/InvQ105 is used to perform inverse DCT transformation and inverse quantization on the residual data after forward DCT transformation and quantization;

重构单元106,用于对反向DCT变换和反量化后的残差数据和所述当前宏块的帧内预测或帧间预测后的数据进行相加,得到重构数据,为下一宏块的帧内预测提供参考数据。The reconstruction unit 106 is configured to add the residual data after inverse DCT transformation and inverse quantization to the intra-predicted or inter-predicted data of the current macroblock to obtain reconstructed data, which is the next macroblock Intra prediction of blocks provides reference data.

请继续参考图4,本实施例中,所述求残差单元包括以下子模块:Please continue to refer to Fig. 4, in the present embodiment, the described residual unit includes the following submodules:

预测模式选择模块ModeDecision102a,用于根据编码代价的大小为当前宏块选择帧内预测或帧间预测模式;The prediction mode selection module ModeDecision102a is used to select an intra prediction or inter prediction mode for the current macroblock according to the size of the encoding cost;

帧间预测模块ME/MC(MotionEstimation/MotionCompensation)102b,用于在帧间预测模式下,为当前宏块设定搜索窗,并从所述参考数据缓存模块中选择出所述搜索窗需要的参考数据,并依据所述参考数据对当前宏块进行帧间预测;The inter-frame prediction module ME/MC (MotionEstimation/MotionCompensation) 102b is used to set the search window for the current macroblock in the inter-frame prediction mode, and select the reference required by the search window from the reference data cache module data, and perform inter-frame prediction on the current macroblock according to the reference data;

帧内预测选择模块ChooseIntraMode102c,用于根据先前已编码的宏块得到的重构数据,通过比较各帧内预测模式的编码代价来选择编码代价最小的预测模式作为当前宏块的最佳帧内预测模式;The intra-frame prediction selection module ChooseIntraMode102c is used to select the prediction mode with the smallest coding cost as the best intra-frame prediction of the current macroblock by comparing the coding costs of each intra-frame prediction mode according to the reconstructed data obtained from the previously coded macroblocks model;

帧内预测模块IntraPrediction102d,用于根据所述最佳帧内预测模式以及所述重构数据对所述当前宏块进行帧内预测;An intra prediction module IntraPrediction102d, configured to perform intra prediction on the current macroblock according to the optimal intra prediction mode and the reconstructed data;

多路选择模块MUX102e,用于实现预测模式选择模块102a、帧间预测模块102b以及帧内预测模块102d输出的预测数据的选择;The multiplex selection module MUX102e is used to realize the selection of the prediction data output by the prediction mode selection module 102a, the inter-frame prediction module 102b and the intra-frame prediction module 102d;

计算模块102f,用于将当前宏块的输入数据与帧内预测或帧间预测数据相减,得到当前宏块的残差数据。The calculation module 102f is used for subtracting the input data of the current macroblock from the intra-frame prediction or inter-frame prediction data to obtain the residual data of the current macroblock.

请继续参考图4,本实施例中,所述解码子系统30包括以下子单元:Please continue to refer to FIG. 4. In this embodiment, the decoding subsystem 30 includes the following subunits:

熵解码单元EntropyDecoder301,用于对所述参考码流进行熵解码;An entropy decoding unit EntropyDecoder301, configured to perform entropy decoding on the reference code stream;

反向DCT变换和反量化单元IDCT/InvQ302,用于对所述熵解码单元输出的残差系数进行反向DCT变换和反量化;Inverse DCT transformation and inverse quantization unit IDCT/InvQ302, used to perform inverse DCT transformation and inverse quantization on the residual coefficient output by the entropy decoding unit;

帧内预测单元IntraPrediction303,用于根据所述熵解码单元输出的帧内预测模式以及先前已解码的宏块的重构数据来进行帧内预测;An intra-frame prediction unit IntraPrediction303, configured to perform intra-frame prediction according to the intra-frame prediction mode output by the entropy decoding unit and the reconstructed data of the previously decoded macroblock;

重构单元304,用于对反向DCT变换和反量化单元302输出的残差数据以及帧内预测单元303输出的预测数据进行相加,得到重构数据,该重构数据为当前宏块的帧间预测时其搜索窗内所需要的参考数据。The reconstruction unit 304 is configured to add the residual data output by the inverse DCT transformation and inverse quantization unit 302 and the prediction data output by the intra prediction unit 303 to obtain reconstructed data, which is the current macroblock The reference data required in the search window during inter-frame prediction.

本实施例中,所述解码子系统30的帧内预测单元303与所述求残差单元的帧内预测模块102d为两个独立的帧内预测器;所述解码子系统30的反向DCT变换和反量化单元302与所述编码子系统10的反向DCT变换和反量化单元105为两个独立的反向DCT变换/反量化器。In this embodiment, the intra prediction unit 303 of the decoding subsystem 30 and the intra prediction module 102d of the residual unit are two independent intra predictors; the reverse DCT of the decoding subsystem 30 The transform and inverse quantization unit 302 and the inverse DCT transform and inverse quantization unit 105 of the encoding subsystem 10 are two independent inverse DCT transform/dequantizers.

本实施例中,所述解码子系统30还包括:滤波单元Deblocking305,用于在所述重构单元304获得的参考数据缓存到所述参考数据缓存模块之前,对所述参考数据进行滤波,以减小块效应。在本发明的其他实施例中,也可以省去Deblocking305。In this embodiment, the decoding subsystem 30 further includes: a filtering unit Deblocking305, configured to filter the reference data obtained by the reconstruction unit 304 before being cached in the reference data caching module, so as to Reduce blockiness. In other embodiments of the present invention, Deblocking 305 may also be omitted.

本实施例中,BitstreamBuffer20与ReferenceData40优选为SRAM。其中,BitstreamBuffer20的大小跟编码图像尺寸以及选用的量化系数相关。另外,如果要实现B帧编码,那么必须先缓存当前图像数据,等到下一帧图像编码完成后再进行编码,这增加了编码系统的存储空间。因此,为了减小存储空间以及降低编码系统成本,本实施例的H.264编码器更适用于I帧和P帧编码。In this embodiment, BitstreamBuffer20 and ReferenceData40 are preferably SRAM. Among them, the size of BitstreamBuffer20 is related to the size of the encoded image and the selected quantization coefficient. In addition, if B-frame encoding is to be implemented, the current image data must be cached first, and then encoded after the next frame image encoding is completed, which increases the storage space of the encoding system. Therefore, in order to reduce the storage space and reduce the cost of the encoding system, the H.264 encoder of this embodiment is more suitable for encoding I frames and P frames.

本实施例中,所述参考数据缓存模块ReferenceData40是一个循环存储器(cyclicbuffer),设有一定宏块数的存储空间,在缓存所述解码子系统获得的参考数据时,当前获得的参考数据将覆盖所述循环存储器中不会再被用于帧间预测的参考数据,也就是说解码新生成的数据会覆盖“旧”数据;当ReferenceData40存储的基本数据单元是一个宏块,那么它最少需要存储的宏块数S可以用下面的公式来表示:In this embodiment, the reference data buffering module ReferenceData40 is a cyclic memory (cyclic buffer) with a storage space of a certain number of macroblocks. When buffering the reference data obtained by the decoding subsystem, the currently obtained reference data will overwrite the The reference data in the circular memory will no longer be used for inter-frame prediction, that is to say, decoding the newly generated data will cover the "old" data; when the basic data unit stored by ReferenceData40 is a macroblock, it needs to store at least The number of macroblocks S can be expressed by the following formula:

S=Ceil(sw_height_by_pix/16)*pic_width_by_mb-(pic_width_by_mb-Ceil(sw_width_by_pix/16))+1S=Ceil(sw_height_by_pix/16)*pic_width_by_mb-(pic_width_by_mb-Ceil(sw_width_by_pix/16))+1

其中,Ceil(x)表示大于或等于x的最小整数;Among them, Ceil(x) represents the smallest integer greater than or equal to x;

sw_height_by_pix是以像素为单位表示的搜索窗的高度;sw_height_by_pix is the height of the search window expressed in pixels;

sw_width_by_pix是以像素为单位表示的搜索窗的宽度;sw_width_by_pix is the width of the search window expressed in pixels;

pic_width_by_mb是以宏块为单位表示的图像的宽度。pic_width_by_mb is the width of the picture expressed in units of macroblocks.

下面举例说明基于图4所示的H.264编码器的具体操作方法,假设需要编码的图像尺寸为640x480,图像格式为Y∶Cb:Cr=4:2:0,搜索窗的大小为592x48。首先,根据上述宏块数的公式可以得到ReferenceData40的存储空间最小为118个宏块,但是为了读写寻址的便利性,设定该存储空间大小为120个宏块,即三个完整的宏块条(MB-line),也就是45Kbyte;另外,一个VGA图像的I帧码流大小一般可以控制在25Kbyte以内。综上,为了实现VGA图像的P帧编码,传统的H.264编码器至少需要存储一个参考图像,即450Kbyte的存储空间,而使用本实施例的H.264编码器的编码方法,则只需要70Kbyte的存储空间。具体过程见图5、图6、图7。The following example illustrates the specific operation method based on the H.264 encoder shown in Figure 4, assuming that the size of the image to be encoded is 640x480, the image format is Y:Cb:Cr=4:2:0, and the size of the search window is 592x48. Firstly, according to the above formula of the number of macroblocks, it can be obtained that the minimum storage space of ReferenceData40 is 118 macroblocks, but for the convenience of reading and writing addressing, the size of the storage space is set to 120 macroblocks, that is, three complete macroblocks Block bar (MB-line), which is 45Kbyte; in addition, the size of the I-frame stream of a VGA image can generally be controlled within 25Kbyte. To sum up, in order to realize the P-frame encoding of VGA images, the traditional H.264 encoder needs to store at least one reference image, that is, a storage space of 450Kbyte, while using the encoding method of the H.264 encoder of this embodiment, it only needs 70Kbyte storage space. See Figure 5, Figure 6, and Figure 7 for the specific process.

图5为本实施例的H.264编码器图像编码顺序以及它们之间的参考关系。值得说明的是,P帧不会被限制只参考前面最近的I帧,例如图中P-24帧如果要用I-0帧做参考,那么必须保证I-0帧的码流还存储在BitstreamBuffer20内,而没有被I-22帧的码流所覆盖,当然付出的代价就是增加了存储空间;另外,两个I帧之间的P帧个数也是可以任意的。FIG. 5 shows the image encoding sequence of the H.264 encoder in this embodiment and the reference relationship between them. It is worth noting that the P frame will not be limited to only refer to the previous I frame. For example, if the P-24 frame in the figure uses the I-0 frame as a reference, then it must be ensured that the code stream of the I-0 frame is still stored in BitstreamBuffer20 If it is not covered by the code stream of the I-22 frame, of course the price paid is to increase the storage space; in addition, the number of P frames between two I frames can also be arbitrary.

图6描述了搜索窗位置的移动过程。图中一个虚线框为P帧第一个宏块(即MB0)的搜索窗,随着编码宏块按照光栅扫描(rasterscan)的顺序递增,那么搜索窗的位置也相应改变,图中另一个虚线框即为P帧中MB59的搜索窗。虽然搜索窗的大小是可以自由设定的,但是在实际应用中,一个编码系统所拥有的片内存储空间是固定的,所以可根据上述ReferenceData40存储的宏块数的公式倒推出搜索窗的最大值。Figure 6 describes the moving process of the search window position. A dotted box in the figure is the search window of the first macroblock (MB0) of the P frame. As the coded macroblocks increase in the order of rasterscan, the position of the search window changes accordingly. Another dotted line in the figure The frame is the search window of MB59 in the P frame. Although the size of the search window can be set freely, in practical applications, the on-chip storage space owned by a coding system is fixed, so the maximum value of the search window can be deduced according to the formula of the number of macroblocks stored in ReferenceData40 above. value.

图7为编码/解码子系统各自的启动时间以及它们的相对关系。解码子系统会提前开始工作,按照光栅扫描(rasterscan)的顺序对参考帧的宏块进行解码,为当前P帧准备参考数据。当P帧第一个宏块的搜索窗所需的参考数据都准备好后,编码子系统开始工作,接下来编码/解码同时进行。当解码子系统进行到MB120时,ReferenceData40中参考数据的存储空间已经存满了,这时候就要把MB120的解码数据覆盖到原先存MB0数据的空间,因为MB0的数据再也不会被用作参考数据了,即所谓的循环存储。最后,解码子系统会提前结束,如果后续帧仍然是个P帧,那么解码子系统会重新对参考帧进行解码。Figure 7 shows the start-up times of the encoding/decoding subsystems and their relative relationship. The decoding subsystem will start working in advance to decode the macroblocks of the reference frame in the order of rasterscan, and prepare reference data for the current P frame. When the reference data needed for the search window of the first macroblock of the P frame are all ready, the encoding subsystem starts to work, and then the encoding/decoding proceeds simultaneously. When the decoding subsystem reaches MB120, the storage space for reference data in ReferenceData40 is full. At this time, the decoded data of MB120 should be overwritten to the space where MB0 data was originally stored, because the data of MB0 will no longer be used as Reference data, the so-called circular storage. Finally, the decoding subsystem will end early, and if the subsequent frame is still a P frame, the decoding subsystem will decode the reference frame again.

需要说明的是,如果要提升本实施例的H.264编码器的编码性能,一方面可以加大搜索窗;另一方面可以多存储几帧参考码流,形成多帧参考。这两点都是为了能找到更加匹配当前宏块的参考数据,当然代价就是增加了片内存储空间,只要所用的存储空间小于传统的实现方案,那么这样做就是有意义的。It should be noted that, if the encoding performance of the H.264 encoder in this embodiment is to be improved, on the one hand, the search window can be enlarged; on the other hand, several more frames of reference streams can be stored to form a multi-frame reference. These two points are for finding reference data that better matches the current macroblock. Of course, the cost is to increase the on-chip storage space. As long as the storage space used is smaller than the traditional implementation scheme, it is meaningful to do so.

实施例二Embodiment two

对于H.264编码器的硬件实现,通常需要从以下四个方面考虑:1).硬件实现的面积;2).工作时钟的最高频率;3).编码速度,即处理每个宏块所需的时钟周期(cycles);4).编码性能,即在相同的图像质量下生成的码流越小越好。而这几个方面又是相互影响的,例如要减小所用面积,就要共享一部分逻辑单元或者减小存储空间,那么就会降低编码速度或是编码性能;如果要提高最大工作时钟频率,那么一般情况下就会增大面积;如果要提升编码性能,一般会加大计算复杂度以及存储空间,以便预测值能更加匹配当前宏块数据,这样又增加了面积。For the hardware implementation of the H.264 encoder, it is usually necessary to consider the following four aspects: 1). The area of the hardware implementation; 2). The highest frequency of the working clock; 3). The encoding speed, that is, the processing required for each macroblock 4). Coding performance, that is, the smaller the code stream generated under the same image quality, the better. And these aspects affect each other. For example, to reduce the area used, it is necessary to share a part of the logic unit or reduce the storage space, then the encoding speed or encoding performance will be reduced; if the maximum operating clock frequency is to be increased, then In general, the area will be increased; if the coding performance is to be improved, the computational complexity and storage space will generally be increased so that the predicted value can better match the current macroblock data, which increases the area.

基于上述的H.264编码器的硬件实现的四个因素考量,本实施例提供一种能够可以相对节省面积的H.264编码器,其中的编码子系统和解码子系统可以复用部分相同逻辑块,例如复用反向DCT/反量化以及帧内预测的功能模块,请参考图8,具体结构包括:Based on the consideration of the four factors of the hardware implementation of the above-mentioned H.264 encoder, this embodiment provides an H.264 encoder that can relatively save area, in which the encoding subsystem and the decoding subsystem can reuse part of the same logic Blocks, such as functional modules that multiplex inverse DCT/inverse quantization and intra-frame prediction, please refer to Figure 8. The specific structure includes:

编码子系统10,用于输入当前图像的数据,进行当前宏块的帧内预测或帧间预测以得到所述当前宏块的残差数据,对所述残差数据进行DCT变换和量化以及熵编码后输出所述当前宏块的码流,其中,在对当前宏块进行帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好需要的参考数据;The encoding subsystem 10 is used to input the data of the current image, perform intra-frame prediction or inter-frame prediction of the current macroblock to obtain the residual data of the current macroblock, and perform DCT transformation, quantization and entropy on the residual data Outputting the code stream of the current macroblock after encoding, wherein, when performing inter-frame prediction on the current macroblock, setting a search window for the current macroblock, and preparing required reference data within the search window;

码流缓存模块BitstreamBuffer20,用于缓存参考码流,所述的参考码流为参考帧图像编码后的码流,即如果当前帧会被用于后续帧的参考帧,那么当前帧的所有宏块的码流会一直被保存,直到该帧作为参考帧的属性被取消;如果当前帧不被用于后续帧的参考帧,那么当前宏块的码流在被送出编码系统后,比如写入SD卡,这些码流可以被后续的码流数据覆盖;The bitstream buffer module BitstreamBuffer20 is used to cache the reference bitstream, the reference bitstream is the encoded bitstream of the reference frame image, that is, if the current frame will be used as the reference frame of the subsequent frame, then all the macroblocks of the current frame The code stream of the current macroblock will be saved until the attribute of the frame as a reference frame is cancelled; if the current frame is not used as the reference frame of the subsequent frame, the code stream of the current macroblock will be sent to the coding system, such as written to SD card, these code streams can be overwritten by subsequent code stream data;

解码子系统30,用于对参考码流进行熵解码以及反向DCT变换和反量化,获得当前宏块的帧间预测时的搜索窗内所需要的参考数据;The decoding subsystem 30 is used to perform entropy decoding, inverse DCT transformation and inverse quantization on the reference code stream, so as to obtain the reference data required in the search window during the inter-frame prediction of the current macroblock;

参考数据缓存模块ReferenceData40,用于缓存所述解码子系统获得的参考数据,并为所述编码子系统提供当前宏块的帧间预测时的搜索窗内所需要的参考数据。The reference data cache module ReferenceData40 is used to cache the reference data obtained by the decoding subsystem, and provide the encoding subsystem with the reference data required in the search window during the inter-frame prediction of the current macroblock.

请继续参考图8,本实施例中,编码子系统10包括以下子单元:Please continue to refer to FIG. 8. In this embodiment, the encoding subsystem 10 includes the following subunits:

控制单元CurrentFrame101,用于输入当前宏块数据,并给出一个宏块启动信号分送到其他单元以通知其他单元启动宏块相应的计算;The control unit CurrentFrame101 is used to input the current macroblock data, and send a macroblock start signal to other units to notify other units to start the corresponding calculation of the macroblock;

求残差单元,用于进行当前宏块的帧内预测或帧间预测,得到所述当前宏块的残差数据,其中,在对当前宏块进行帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好需要的参考数据,该参考数据是通过对参考码流进行解码而获得;The residual unit is used to perform intra-frame prediction or inter-frame prediction of the current macroblock to obtain the residual data of the current macroblock, wherein, when performing inter-frame prediction on the current macroblock, set the current macroblock Search the window, and prepare the required reference data in the search window, the reference data is obtained by decoding the reference code stream;

正向DCT变换和量化单元DCT/Q103,用于对所述残差数据进行正向DCT变换和量化;A forward DCT transformation and quantization unit DCT/Q103, configured to perform forward DCT transformation and quantization on the residual data;

熵编码单元EntropyEncoder104,用于将所述对正向DCT变换和量化后的残差数据进行熵编码,生成所述当前宏块的码流;An entropy encoding unit EntropyEncoder104, configured to perform entropy encoding on the residual data after the forward DCT transformation and quantization, to generate the code stream of the current macroblock;

反向DCT变换和反量化单元IDCT/InvQ105,用于对正向DCT变换和量化后的残差数据进行反向DCT变换和反量化;The inverse DCT transformation and inverse quantization unit IDCT/InvQ105 is used to perform inverse DCT transformation and inverse quantization on the residual data after forward DCT transformation and quantization;

重构单元106,用于对反向DCT变换和反量化后的残差数据Dn以及所述当前宏块的帧内预测或帧间预测后的预测数据进行相加,得到重构数据,为下一宏块的帧内预测提供参考数据。The reconstruction unit 106 is configured to add the residual data Dn after inverse DCT transformation and inverse quantization and the prediction data after intra-frame prediction or inter-frame prediction of the current macroblock to obtain reconstructed data, which is as follows Intra prediction of a macroblock provides reference data.

请继续参考图8,本实施例中,所述求残差单元包括以下子模块:Please continue to refer to Figure 8, in the present embodiment, the described residual unit includes the following submodules:

预测模式选择模块ModeDecision102a,用于根据编码代价的大小为当前宏块选择帧内预测或帧间预测模式;The prediction mode selection module ModeDecision102a is used to select an intra prediction or inter prediction mode for the current macroblock according to the size of the encoding cost;

帧间预测模块ME/MC(MotionEstimation/MotionCompensation)102b,用于在帧间预测模式下,为当前宏块设定搜索窗,并从所述参考数据缓存模块中选择出所述搜索窗需要的参考数据,并依据所述参考数据对当前宏块进行帧间预测;The inter-frame prediction module ME/MC (MotionEstimation/MotionCompensation) 102b is used to set the search window for the current macroblock in the inter-frame prediction mode, and select the reference required by the search window from the reference data cache module data, and perform inter-frame prediction on the current macroblock according to the reference data;

帧内预测选择模块ChooseIntraMode102c,用于根据先前已编码的宏块得到的重构数据,通过比较各帧内预测模式的编码代价,选择当前宏块的最佳帧内预测模式;The intra-frame prediction selection module ChooseIntraMode102c is used to select the best intra-frame prediction mode of the current macroblock by comparing the encoding costs of each intra-frame prediction mode according to the reconstructed data obtained from the previously encoded macroblocks;

帧内预测模块IntraPrediction102d,用于根据所述最佳帧内预测模式以及所述重构数据对所述当前宏块进行帧内预测;An intra prediction module IntraPrediction102d, configured to perform intra prediction on the current macroblock according to the optimal intra prediction mode and the reconstructed data;

多路选择模块MUX102e,用于实现预测模式选择模块102a、帧间预测模块102b以及帧内预测模块102d输出的预测数据的选择;The multiplex selection module MUX102e is used to realize the selection of the prediction data output by the prediction mode selection module 102a, the inter-frame prediction module 102b and the intra-frame prediction module 102d;

计算模块102f,用于将当前宏块的输入数据与帧内预测或帧间预测数据相减,得到当前宏块的残差数据。The calculation module 102f is used for subtracting the input data of the current macroblock from the intra-frame prediction or inter-frame prediction data to obtain the residual data of the current macroblock.

请继续参考图8,本实施例中,所述解码子系统30包括以下子单元:Please continue to refer to FIG. 8. In this embodiment, the decoding subsystem 30 includes the following subunits:

熵解码单元EntropyDecoder301,用于对所述参考码流进行熵解码;An entropy decoding unit EntropyDecoder301, configured to perform entropy decoding on the reference code stream;

反向DCT变换和反量化单元IDCT/InvQ105,即所述编码子系统10的反向DCT变换和反量化单元105用于对所述熵解码单元输出的残差系数进行反向DCT变换和反量化;The inverse DCT transformation and inverse quantization unit IDCT/InvQ105, that is, the inverse DCT transformation and inverse quantization unit 105 of the encoding subsystem 10 is used to perform inverse DCT transformation and inverse quantization on the residual coefficient output by the entropy decoding unit ;

帧内预测单元IntraPrediction102d,即所述求残差单元的帧内预测模块102d,用于根据所述熵解码单元301输出的帧内预测模式以及先前已解码的宏块的重构数据来进行帧内预测;The intra-frame prediction unit IntraPrediction102d, that is, the intra-frame prediction module 102d of the residual unit, is used to perform intra-frame prediction according to the intra-frame prediction mode output by the entropy decoding unit 301 and the previously decoded macroblock reconstruction data. predict;

重构单元304,用于对反向DCT变换和反量化单元105输出的残差数据以及帧内预测模块102d输出后的预测数据进行相加,得到重构数据,作为宏块帧间预测时搜索窗内所需要的参考数据。The reconstruction unit 304 is used to add the residual data output by the inverse DCT transformation and inverse quantization unit 105 and the prediction data output by the intra prediction module 102d to obtain reconstructed data, which is used as the macroblock inter prediction search The reference data required in the window.

本实施例中,所述解码子系统30还包括:滤波单元Deblocking305,用于在所述重构单元304获得的参考数据缓存到所述参考数据缓存模块之前,对所述参考数据进行滤波,以减小块效应。在本发明的其他实施例中,也可以省去Deblocking305。In this embodiment, the decoding subsystem 30 further includes: a filtering unit Deblocking305, configured to filter the reference data obtained by the reconstruction unit 304 before being cached in the reference data caching module, so as to Reduce blockiness. In other embodiments of the present invention, Deblocking 305 may also be omitted.

请参考图9,由于本实施例的H.264编码器中编码子系统和解码子系统复用了部分逻辑,那么编码子系统和解码子系统就不能同时工作,只能采用分时进行编码和解码,这样处理一个宏块数据就需要更多的时钟周期,所以编码速度相对实施例一就有所下降。Please refer to Fig. 9, since the encoding subsystem and the decoding subsystem in the H.264 encoder of this embodiment reuse part of the logic, then the encoding subsystem and the decoding subsystem cannot work at the same time, and only time-sharing can be used for encoding and decoding. For decoding, it takes more clock cycles to process one macroblock data, so the encoding speed is reduced compared with the first embodiment.

实施例三Embodiment three

同样地,基于实施例二中所述的H.264编码器的硬件实现的四个因素考量,本实施例提供一种通过多存储几帧参考码流以形成多帧参考来提升编码性能的H.264编码器,请参考图10,具体结构包括:Similarly, based on the four considerations of the hardware implementation of the H.264 encoder described in Embodiment 2, this embodiment provides an H.264 encoder that improves encoding performance by storing several more frames of reference streams to form a multi-frame reference. .264 encoder, please refer to Figure 10, the specific structure includes:

编码子系统10,用于输入当前图像的数据,进行当前宏块的帧内预测或帧间预测以得到所述当前宏块的残差数据,对所述残差数据进行DCT变换和量化以及熵编码后输出所述当前宏块的码流,其中,在对当前宏块进行帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好需要的参考数据;The encoding subsystem 10 is used to input the data of the current image, perform intra-frame prediction or inter-frame prediction of the current macroblock to obtain the residual data of the current macroblock, and perform DCT transformation, quantization and entropy on the residual data Outputting the code stream of the current macroblock after encoding, wherein, when performing inter-frame prediction on the current macroblock, setting a search window for the current macroblock, and preparing required reference data within the search window;

码流缓存模块BitstreamBuffer20,用于缓存参考码流,所述的参考码流为参考帧图像编码后的码流,即如果当前帧会被用于后续帧的参考帧,那么当前帧的所有宏块的码流会一直被保存,直到该帧作为参考帧的属性被取消;如果当前帧不被用于后续帧的参考帧,那么当前宏块的码流在被送出编码系统后,比如写入SD卡,这些码流可以被后续的码流数据覆盖;The bitstream buffer module BitstreamBuffer20 is used to cache the reference bitstream, the reference bitstream is the encoded bitstream of the reference frame image, that is, if the current frame will be used as the reference frame of the subsequent frame, then all the macroblocks of the current frame The code stream of the current macroblock will be saved until the attribute of the frame as a reference frame is cancelled; if the current frame is not used as the reference frame of the subsequent frame, the code stream of the current macroblock will be sent to the coding system, such as written to SD card, these code streams can be overwritten by subsequent code stream data;

解码子系统30,用于对所缓存的参考码流进行熵解码以及反向DCT变换和反量化,获得当前宏块的帧间预测时的搜索窗内所需要的参考数据;The decoding subsystem 30 is used to perform entropy decoding, inverse DCT transformation and inverse quantization on the cached reference code stream, so as to obtain the reference data required in the search window during the inter-frame prediction of the current macroblock;

参考数据缓存模块ReferenceData40,用于缓存所述解码子系统获得的参考数据,并为所述编码子系统提供当前宏块的帧间预测时的搜索窗内所需要的参考数据。The reference data cache module ReferenceData40 is used to cache the reference data obtained by the decoding subsystem, and provide the encoding subsystem with the reference data required in the search window during the inter-frame prediction of the current macroblock.

请继续参考图10,本实施例中,编码子系统10包括以下子单元:Please continue to refer to Figure 10. In this embodiment, the coding subsystem 10 includes the following subunits:

控制单元CurrentFrame101,用于输入当前宏块数据,并给出一个宏块启动信号分送到其他单元以通知其他单元启动宏块相应的计算;The control unit CurrentFrame101 is used to input the current macroblock data, and send a macroblock start signal to other units to notify other units to start the corresponding calculation of the macroblock;

求残差单元,用于进行当前宏块的帧内预测或帧间预测,得到所述当前宏块的残差数据,其中,在对当前宏块进行帧间预测时,设定当前宏块的搜索窗,并在所述搜索窗内准备好需要的参考数据,该参考数据是通过对参考码流进行解码而获得;The residual unit is used to perform intra-frame prediction or inter-frame prediction of the current macroblock to obtain the residual data of the current macroblock, wherein, when performing inter-frame prediction on the current macroblock, set the current macroblock Search the window, and prepare the required reference data in the search window, the reference data is obtained by decoding the reference code stream;

正向DCT变换和量化单元DCT/Q103,用于对所述残差数据进行正向DCT变换和量化;A forward DCT transformation and quantization unit DCT/Q103, configured to perform forward DCT transformation and quantization on the residual data;

熵编码单元EntropyEncoder104,用于将所述对正向DCT变换和量化后的残差数据进行熵编码,生成所述当前宏块的码流;An entropy encoding unit EntropyEncoder104, configured to perform entropy encoding on the residual data after the forward DCT transformation and quantization, to generate the code stream of the current macroblock;

反向DCT变换和反量化单元IDCT/InvQ105,用于对正向DCT变换和量化后的残差数据进行反向DCT变换和反量化;The inverse DCT transformation and inverse quantization unit IDCT/InvQ105 is used to perform inverse DCT transformation and inverse quantization on the residual data after forward DCT transformation and quantization;

重构单元106,用于对反向DCT变换和反量化后的残差数据Dn以及所述当前宏块的帧内预测或帧间预测后的预测数据进行相加,得到用于下一宏块的帧内预测的参考数据。The reconstruction unit 106 is configured to add the residual data Dn after inverse DCT transformation and inverse quantization and the prediction data after intra-frame prediction or inter-frame prediction of the current macroblock to obtain Reference data for intra prediction.

请继续参考图10,本实施例中,所述求残差单元包括以下子模块:Please continue to refer to Figure 10, in this embodiment, the described residual unit includes the following submodules:

预测模式选择模块ModeDecision102a,用于根据编码代价的大小为当前宏块选择帧内预测或帧间预测模式;The prediction mode selection module ModeDecision102a is used to select an intra prediction or inter prediction mode for the current macroblock according to the size of the encoding cost;

帧间预测模块ME/MC(MotionEstimation/MotionCompensation)102b,用于在帧间预测模式下,为当前宏块设定搜索窗,并从所述参考数据缓存模块中选择出所述搜索窗需要的参考数据,并依据所述参考数据对当前宏块进行帧间预测;The inter-frame prediction module ME/MC (MotionEstimation/MotionCompensation) 102b is used to set the search window for the current macroblock in the inter-frame prediction mode, and select the reference required by the search window from the reference data cache module data, and perform inter-frame prediction on the current macroblock according to the reference data;

帧内预测选择模块ChooseIntraMode102c,用于根据先前已编码的宏块得到的重构数据,通过比较各帧内预测模式的编码代价来选择编码代价最小的预测模式作为当前宏块的最佳帧内预测模式;The intra-frame prediction selection module ChooseIntraMode102c is used to select the prediction mode with the smallest coding cost as the best intra-frame prediction of the current macroblock by comparing the coding costs of each intra-frame prediction mode according to the reconstructed data obtained from the previously coded macroblocks model;

帧内预测模块IntraPrediction102d,用于根据所述最佳帧内预测模式以及所述重构数据对所述当前宏块进行帧内预测;An intra prediction module IntraPrediction102d, configured to perform intra prediction on the current macroblock according to the optimal intra prediction mode and the reconstructed data;

多路选择模块MUX102e,用于实现预测模式选择模块102a、帧间预测模块102b以及帧内预测模块102d输出的预测数据的选择;The multiplex selection module MUX102e is used to realize the selection of the prediction data output by the prediction mode selection module 102a, the inter-frame prediction module 102b and the intra-frame prediction module 102d;

计算模块102f,用于将当前宏块的输入数据与帧内预测或帧间预测数据相减,得到当前宏块的残差数据。The calculation module 102f is used for subtracting the input data of the current macroblock from the intra-frame prediction or inter-frame prediction data to obtain the residual data of the current macroblock.

请继续参考图10,本实施例中,由于其中有P帧作为参考数据,所以在解码子系统中就要增加一套能对P帧进行解码的逻辑,因此,所述解码子系统30包括用于提供所述P帧类型的参考数据的P帧解码系统和所述I帧类型的参考数据的I帧解码系统。Please continue to refer to Fig. 10, in the present embodiment, because there is P frame wherein as reference data, so will add a set of logic that can decode P frame in decoding subsystem, therefore, described decoding subsystem 30 includes The P frame decoding system for providing the reference data of the P frame type and the I frame decoding system for the reference data of the I frame type.

其中,请继续参考图10,所述I帧解码系统包括:Wherein, please continue to refer to Figure 10, the I frame decoding system includes:

第一熵解码单元EntropyDecoder301b,用于对所述参考码流中的I帧参考码流进行熵解码;The first entropy decoding unit EntropyDecoder301b is used to perform entropy decoding on the I-frame reference code stream in the reference code stream;

第一反向DCT变换和反量化单元IDCT/InvQ302b,用于对所述第一熵解码单元301b输出的残差系数进行反向DCT变换和反量化;The first inverse DCT transformation and inverse quantization unit IDCT/InvQ302b, configured to perform inverse DCT transformation and inverse quantization on the residual coefficient output by the first entropy decoding unit 301b;

第一帧内预测单元IntraPrediction303b,用于根据所述第一熵解码单元301b输出的帧内预测模式进行帧内预测;The first intra-frame prediction unit IntraPrediction303b is configured to perform intra-frame prediction according to the intra-frame prediction mode output by the first entropy decoding unit 301b;

第一重构单元304b,用于对所述第一反向DCT变换和反量化单元302b输出的残差数据以及第一帧内预测单元303b输出的预测数据进行相加,获得所述I帧参考码流提供的当前宏块的帧间预测时其搜索窗内所需要的参考数据,同时该参考数据可用于P帧参考码流解码时的帧间预测。The first reconstruction unit 304b is configured to add the residual data output by the first inverse DCT transform and inverse quantization unit 302b and the prediction data output by the first intra-frame prediction unit 303b to obtain the I frame reference The code stream provides the reference data required in the search window for the inter-frame prediction of the current macroblock, and the reference data can be used for inter-frame prediction when the P-frame reference code stream is decoded.

第一滤波单元Deblocking305b,用于对第一重构单元304b的参考数据进行滤波。The first filtering unit Deblocking 305b is configured to filter the reference data of the first reconstruction unit 304b.

所述P帧解码系统包括:The P frame decoding system includes:

第二熵解码单元EntropyDecoder301a,用于对所述参考码流中的P帧参考码流进行熵解码;The second entropy decoding unit EntropyDecoder301a is used to perform entropy decoding on the P frame reference code stream in the reference code stream;

第二反向DCT变换和反量化单元IDCT/InvQ302a,用于对所述第二熵解码单元301a输出的残差系数进行反向DCT变换和反量化;The second inverse DCT transformation and inverse quantization unit IDCT/InvQ302a, configured to perform inverse DCT transformation and inverse quantization on the residual coefficient output by the second entropy decoding unit 301a;

第二帧内预测单元IntraPrediction303a,用于根据所述第二熵解码单元301a输出的帧内预测模式进行帧内预测;The second intra-frame prediction unit IntraPrediction303a is configured to perform intra-frame prediction according to the intra-frame prediction mode output by the second entropy decoding unit 301a;

第二帧间预测单元MC306,用于根据所述的第一重构单元304b的重构数据以及所述第二熵解码单元301a输出的运动向量进行帧间预测;The second inter-frame prediction unit MC306 is configured to perform inter-frame prediction according to the reconstructed data of the first reconstruction unit 304b and the motion vector output by the second entropy decoding unit 301a;

多路选择器MUX307,用于实现第二帧内预测单元IntraPrediction303a和第二帧间预测单元MC306输出的预测数据的选择;a multiplexer MUX307, configured to select the prediction data output by the second intra prediction unit IntraPrediction303a and the second inter prediction unit MC306;

第二重构单元304a,用于对所述第二反向DCT变换和反量化单元302a输出的残差数据以及第二帧内预测单元303a或第二帧间预测单元306处理后的预测数据进行相加,获得所述P帧参考码流的重构数据,以用于所述当前宏块的帧间预测时其搜索窗内所需要的参考数据,而且如果该参考码流下一个宏块是帧内预测,那么该重构数据也作为解码时帧内预测的参考数据;The second reconstruction unit 304a is configured to perform the residual data output by the second inverse DCT transform and inverse quantization unit 302a and the prediction data processed by the second intra prediction unit 303a or the second inter prediction unit 306 Add up to obtain the reconstructed data of the P-frame reference code stream, which is used for the reference data required in the search window for the inter-frame prediction of the current macroblock, and if the next macroblock of the reference code stream is a frame Intra-prediction, then the reconstructed data is also used as reference data for intra-frame prediction during decoding;

第二滤波单元Deblocking305a,用于对第二重构单元304a的参考数据进行滤波。The second filtering unit Deblocking 305a is configured to filter the reference data of the second reconstruction unit 304a.

请继续参考图10,本实施例中,参考数据缓存模块包括用于缓存I帧类型的参考数据的I帧缓存模块401、缓存P帧类型的P帧缓存模块402以及用于选择I帧类型或P帧类型的参考数据的选择器403。Please continue to refer to FIG. 10 , in this embodiment, the reference data cache module includes an I frame cache module 401 for caching reference data of an I frame type, a P frame cache module 402 for caching a P frame type, and a P frame cache module 402 for selecting an I frame type or A selector 403 for reference data of P frame type.

在本发明的其他实施例中,也可以省去Deblocking305a、305b,也可以参考实施例二的原理,将编码子系统与解码子系统中相同功能的模块或/或单元部分复用,复用后只会影响编/解码子系统运行的相对关系。In other embodiments of the present invention, Deblocking 305a, 305b can also be omitted, and the principle of Embodiment 2 can also be referred to, and the modules or/or units with the same function in the encoding subsystem and the decoding subsystem can be partially multiplexed, and after multiplexing Only affects the relative relationship between encoding/decoding subsystem operation.

图11所示为本实施例的H.264编码器的编码顺序以及参考关系。值得说明的是,作为参考帧的P'帧一定是在I帧之后,而且该P'帧必须以I帧作参考。另外,后续的P帧既可以用P'帧作参考,也可以用P'帧的参考帧(即I帧)作参考。FIG. 11 shows the encoding sequence and reference relationship of the H.264 encoder in this embodiment. It is worth noting that the P' frame as the reference frame must be after the I frame, and the P' frame must use the I frame as a reference. In addition, the subsequent P frame can use either the P' frame as a reference, or the reference frame (ie, the I frame) of the P' frame as a reference.

图12描述了编码/解码子系统运行的相对关系。该图仍然假设编码图像尺寸为640x480,搜索窗大小为592x48。由图12可知,如果当前帧要参考P'帧,那么就要先解出P'帧的参考帧(即I帧),然后才能对P'帧进行解码,以上两步完成后才能对当前P帧进行编码。Figure 12 depicts the relative relationship between the encoding/decoding subsystem operation. The figure still assumes that the encoded image size is 640x480 and the search window size is 592x48. It can be seen from Figure 12 that if the current frame needs to refer to the P' frame, then the reference frame of the P' frame (that is, the I frame) must be decoded first, and then the P' frame can be decoded, and the current P' frame can only be decoded after the above two steps are completed. frames are encoded.

本实施例的H.264编码器虽然增加了系统的实现复杂度,而且增加了片内存储空间,但是由于提供多帧参考,因此提高了编码系统的性能,可以作为实际应用的一种选择。Although the H.264 encoder in this embodiment increases the implementation complexity of the system and increases the on-chip storage space, since it provides multi-frame reference, it improves the performance of the encoding system and can be used as a choice for practical applications.

此外,本发明还提供一种H.264的编码方法,包括以下步骤:In addition, the present invention also provides a kind of H.264 coding method, comprises the following steps:

(1)判断当前宏块是否需要进行帧间预测,如果不需要帧间预测,则对当前宏块进行编码,并转入步骤(4),如果需要帧间预测,则进入下一步;(1) Determine whether the current macroblock needs to perform inter-frame prediction, if no inter-frame prediction is required, encode the current macroblock, and transfer to step (4), if inter-frame prediction is required, proceed to the next step;

(2)为当前宏块设定搜索窗,判断搜索窗内的参考数据是否准备好,如果是,则根据参考数据对当前宏块进行编码,转入步骤(4),如果否,则进入下一步;(2) Set the search window for the current macroblock, judge whether the reference data in the search window is ready, if yes, encode the current macroblock according to the reference data, and go to step (4), if not, go to the next step step;

(3)对参考码流进行解码,获得一个宏块的参考数据,返回步骤(2);(3) Decode the reference code stream to obtain the reference data of a macroblock, and return to step (2);

(4)判断是否结束编码,如果未结束,则处理下一个宏块并返回步骤(1)。(4) Judging whether to end encoding, if not, process the next macroblock and return to step (1).

其中所述参考数据可以为I帧类型的参考数据,还可以包括P帧类型的参考数据,所述P帧类型的参考数据是以I帧类型的参考帧数据为参考来编码、解码得到的。The reference data may be reference data of I frame type, and may also include reference data of P frame type, and the reference data of P frame type is obtained by encoding and decoding with reference to reference frame data of I frame type.

在步骤(1)中,在不需要帧间预测时,对当前宏块进行编码的过程包括:In step (1), when inter-frame prediction is not required, the process of encoding the current macroblock includes:

依据先前已编码宏块重构处理后得到的参考数据进行当前宏块的帧内预测,得到帧内预测值,再用当前宏块数据减去该预测值,得到所述当前宏块的残差数据;Perform intra-frame prediction of the current macroblock according to the reference data obtained after the previous coded macroblock reconstruction processing to obtain an intra-frame prediction value, and then subtract the prediction value from the current macroblock data to obtain the residual of the current macroblock data;

对所述当前宏块残差数据进行正向DCT变换和量化;performing forward DCT transformation and quantization on the residual data of the current macroblock;

将所述对正向DCT变换和量化后的残差数据进行熵编码,生成所述当前宏块的码流并缓存;performing entropy encoding on the residual data after forward DCT transformation and quantization, generating and caching the code stream of the current macroblock;

对正向DCT变换和量化后的残差数据进行反向DCT变换和反量化;Perform reverse DCT transformation and dequantization on the residual data after forward DCT transformation and quantization;

对反向DCT变换和反量化后的残差数据和所述最佳预测模式的预测数据进行重构,得到用于下一宏块的帧内预测的参考数据。The residual data after inverse DCT transformation and dequantization and the prediction data of the best prediction mode are reconstructed to obtain reference data for intra-frame prediction of the next macroblock.

在步骤(2)中,在搜索窗内准备当前宏块的参考数据的过程包括:In step (2), the process of preparing the reference data of the current macroblock within the search window includes:

对缓存的参考码流进行熵解码;Perform entropy decoding on the cached reference code stream;

对通过熵解码而得到的残差系数进行反向DCT变换和反量化;Perform inverse DCT transformation and inverse quantization on residual coefficients obtained by entropy decoding;

根据熵解码输出的帧内预测模式进行帧内预测;perform intra-frame prediction according to the intra-frame prediction mode output by entropy decoding;

对反向DCT变换和反量化后的残差数据和帧内预测后的预测数据进行重构,获得当前宏块的帧间预测时的搜索窗内需要的参考数据并缓存。The residual data after inverse DCT transformation and dequantization and the prediction data after intra-frame prediction are reconstructed to obtain and cache the reference data required in the search window during inter-frame prediction of the current macroblock.

在步骤(2)中,在搜索窗内的参考数据准备好后,根据参考数据对当前宏块进行编码的过程包括:In step (2), after the reference data in the search window is ready, the process of encoding the current macroblock according to the reference data includes:

依据所述参考数据进行当前宏块的帧间预测,通过比较帧内预测和帧间预测的编码代价,选择编码代价较小的预测模式作为当前宏块的最佳预测模式输出,并得到所述当前宏块的残差数据;Perform inter-frame prediction of the current macroblock according to the reference data, compare the coding costs of intra-frame prediction and inter-frame prediction, select a prediction mode with a smaller coding cost as the best prediction mode of the current macroblock, and obtain the Residual data of the current macroblock;

对所述当前宏块残差数据进行正向DCT变换和量化;performing forward DCT transformation and quantization on the residual data of the current macroblock;

将所述对正向DCT变换和量化后的残差数据进行熵编码,生成所述当前宏块的码流并缓存;performing entropy encoding on the residual data after forward DCT transformation and quantization, generating and caching the code stream of the current macroblock;

对正向DCT变换和量化后的残差数据进行反向DCT变换和反量化;Perform reverse DCT transformation and dequantization on the residual data after forward DCT transformation and quantization;

对反向DCT变换和反量化后的残差数据和所述最佳预测模式的预测数据进行重构,得到用于下一宏块的帧内预测的参考数据。The residual data after inverse DCT transformation and dequantization and the prediction data of the best prediction mode are reconstructed to obtain reference data for intra-frame prediction of the next macroblock.

由上所述可知,本实施例提出的H.264编码器及编码方法并不是存储参考帧所有的原始数据,而是细化到宏块级,存储当前宏块所需的参考数据,这些参考数据又是通过对参考码流进行解码而得到的,这样参考码流加上一些参考数据的存储空间就代替了整个参考帧的存储空间。由于所存的参考数据必需包含整个搜索窗的数据,所以参考数据的存储空间与搜索窗大小有关,而且根据图像压缩性能,搜索窗的大小可以自由设定,但是一般会远远小于一帧图像的大小,这样就减少了H.264编码器所需的存储空间。因此根据上述方法,使得利用较小的片内SRAM就可以进行H.264编码,具体的硬件实现方案如图3所示。由于没有使用片外存储器,那么整个编码系统的成本降低了,同时也减小了系统功耗。而且,片内SRAM的读写性能一般要远优于片外SDRAM存储器,所以在进行大尺寸图像编码时,存储器的数据吞吐率也不会成为问题。It can be seen from the above that the H.264 encoder and encoding method proposed in this embodiment do not store all the original data of the reference frame, but refine it to the macroblock level to store the reference data required by the current macroblock. The data is obtained by decoding the reference code stream, so that the storage space of the reference code stream plus some reference data replaces the storage space of the entire reference frame. Since the stored reference data must contain the data of the entire search window, the storage space of the reference data is related to the size of the search window, and according to the image compression performance, the size of the search window can be set freely, but generally it is much smaller than the size of a frame of image size, which reduces the storage space required by the H.264 encoder. Therefore, according to the above method, H.264 encoding can be performed using a smaller on-chip SRAM. The specific hardware implementation scheme is shown in FIG. 3 . Since no off-chip memory is used, the cost of the entire coding system is reduced, and the power consumption of the system is also reduced. Moreover, the read and write performance of the on-chip SRAM is generally much better than that of the off-chip SDRAM memory, so the data throughput rate of the memory will not become a problem when encoding large-size images.

综上所述,本发明所述提供的H.264编码器及编码方法,在实现帧间预测时,通过设定搜索窗获得当前宏块所需的参考数据,涉及的存储空间仅包括存储的码流以及部分参考数据,大小远远小于一帧图像的大小,因而有效减少了H.264编码器所需参考帧的存储空间;同时由于没有使用片外存储器,整个H.264编码器的成本以及系统功耗被有效降低,而且,由于片内存储的读写性能一般要远优于片外存储,所以在进行大尺寸图像编码时,可以在保证图像质量的同时,大大提高存储数据吞吐率。In summary, the H.264 encoder and encoding method provided by the present invention obtain the reference data required by the current macroblock by setting the search window when realizing inter-frame prediction, and the storage space involved only includes the stored The code stream and some reference data are far smaller than the size of a frame image, thus effectively reducing the storage space of the reference frame required by the H.264 encoder; at the same time, because no off-chip memory is used, the cost of the entire H.264 encoder And the power consumption of the system is effectively reduced. Moreover, since the read and write performance of on-chip storage is generally much better than that of off-chip storage, when encoding large-size images, the storage data throughput can be greatly improved while ensuring image quality. .

显然,本领域的技术人员可以对发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the invention without departing from the spirit and scope of the invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.

Claims (12)

1. a H.264 encoder, is characterized in that, comprising:
Code-subsystem, for inputting the data of present image, carry out the infra-frame prediction of current macro or inter prediction to obtain the residual error data of described current macro, the code stream of described current macro is exported after dct transform and quantification and entropy code are carried out to described residual error data, wherein, when carrying out inter prediction to current macro, the search window of setting current macro, and in search window, get out the reference data of needs;
Code stream cache module, for buffer memory with reference to code stream, described reference code stream is the code stream of reference frame image after coding;
Decoding sub-system, for carrying out entropy decoding and oppositely dct transform and inverse quantization to described reference code stream, obtains reference data required when described code-subsystem carries out inter prediction;
Reference data cache module for the reference data that decoding sub-system described in buffer memory obtains, and is reference data required in search window when described code-subsystem provides the inter prediction of current macro;
Wherein, described reference data cache module is circulating memory, when the reference data that decoding sub-system described in buffer memory obtains, the reference data of current acquisition covers in described circulating memory the reference data that can not re-use when carrying out inter prediction, described reference data cache module is provided with the memory space of certain macroblock number, and the computing formula of its macroblock number S stored is:
S=Ceil(sw_height_by_pix/16)*pic_width_by_mb-(pic_width_by_mb-Ceil(sw_width_by_pix/16))+1
Wherein, Ceil (x) represents the smallest positive integral being more than or equal to x;
Sw_height_by_pix is the height of the search window represented in units of pixel;
Sw_width_by_pix is the width of the search window represented in units of pixel;
Pic_width_by_mb is the width of the image represented in units of macro block.
2. H.264 encoder as claimed in claim 1, it is characterized in that, described code-subsystem comprises:
Control unit, for inputting current macro data, and provides a macro block enabling signal and is distributed to other unit to notify that other unit starting macro blocks calculate accordingly;
Ask residual error unit, for carrying out infra-frame prediction or the inter prediction of current macro, obtain the residual error data of described current macro, wherein, when carrying out inter prediction to current macro, the search window of setting current macro, and required reference data is got out in described search window, this reference data obtains by decoding to reference code stream;
Forward dct transform and quantifying unit, for carrying out forward dct transform and quantification to described residual error data;
Entropy code unit, for described forward dct transform and the residual error data after quantizing are carried out entropy code, generates the code stream of described current macro;
Reverse dct transform and inverse quantization unit, for carrying out reverse dct transform and inverse quantization to forward dct transform and the residual error data after quantizing;
Reconfiguration unit, for being added the prediction data after the infra-frame prediction of the residual error data after reverse dct transform and inverse quantization and described current macro or inter prediction, obtains reconstruct data, for the infra-frame prediction of next macro block provides reference data.
3. H.264 encoder as claimed in claim 2, is characterized in that, described in ask residual error unit to comprise:
Predictive mode selects module, for according to the size of Coding cost being current macro selection infra-frame prediction or inter-frame forecast mode;
Inter prediction module, under inter-frame forecast mode, is current macro setting search window, and from described reference data cache module, select the reference data of described search window needs, and carries out inter prediction according to described reference data to current macro;
Intra prediction mode selection module, for the reconstruct data obtained according to previously encoded macro block, the predictive mode selecting Coding cost minimum is as the optimum frame inner estimation mode of current macro;
Intra-framed prediction module, for carrying out infra-frame prediction according to described optimum frame inner estimation mode and described reconstruct data to current macro;
Multi-path choice module, for realizing the selection of the prediction data that predictive mode selects module, intra-framed prediction module and Inter prediction module to export.
4. H.264 encoder as claimed in claim 2, it is characterized in that, described decoding sub-system comprises:
Entropy decoding unit, for carrying out entropy decoding to reference code stream;
Reverse dct transform and inverse quantization unit, carry out reverse dct transform and inverse quantization for the residual error coefficient exported described entropy decoding unit;
Intraprediction unit, for carrying out infra-frame prediction according to the described intra prediction mode of entropy decoding unit output and the reconstruct data of previous decoded macro block;
Reconfiguration unit, for being added the prediction data of the reverse dct transform of described decoding sub-system and the residual error data of inverse quantization unit output and intraprediction unit output, obtain reconstruct data, as reference data required in search window during macro block inter prediction.
5. H.264 encoder as claimed in claim 4, is characterized in that, the intraprediction unit of described decoding sub-system and the described intra-framed prediction module of residual error unit of asking are multiplexing same intra predictor generator or two independently intra predictor generator.
6. H.264 encoder as claimed in claim 4, it is characterized in that, the reverse dct transform of the reverse dct transform of described decoding sub-system and inverse quantization unit and described code-subsystem and inverse quantization unit are multiplexing same reverse dct transform/inverse DCT or two independently reverse dct transform/inverse DCT.
7. H.264 encoder as claimed in claim 4, it is characterized in that, described decoding sub-system also comprises: filter unit, and the reference data for obtaining at described decoding sub-system carries out filtering to described reference data before being cached to described reference data cache module.
8. H.264 encoder as claimed in claim 1, it is characterized in that, described decoding sub-system comprises the I frame decoding system of the reference data for providing I frame type, and described I frame decoding system comprises:
First entropy decoding unit, for carrying out entropy decoding to described with reference to the I frame reference code stream in code stream;
First reverse dct transform and inverse quantization unit, carries out reverse dct transform and inverse quantization for the residual error coefficient exported described first entropy decoding unit;
First intraprediction unit, carries out infra-frame prediction for the intra prediction mode exported according to described first entropy decoding unit;
First reconfiguration unit, prediction data for exporting residual error data and first intra-framed prediction module of the described first reverse dct transform and inverse quantization unit output is added, obtain the reconstruct data of described I frame with reference to code stream, for reference data required in its search window when the decoding of P frame with reference to code stream or the inter prediction as current macro;
First filter unit, for carrying out filtering to the reference data of the first reconfiguration unit.
9. H.264 encoder as claimed in claim 8, it is characterized in that, described decoding sub-system also comprises the P frame decoding system of the reference data for providing P frame type, and described P frame decoding system comprises:
Second entropy decoding unit, for carrying out entropy decoding to described with reference to the P frame reference code stream in code stream;
Second reverse dct transform and inverse quantization unit, for carrying out reverse dct transform and inverse quantization to the residual error coefficient of described second entropy decoding unit;
Second intraprediction unit, carries out infra-frame prediction for the intra prediction mode exported according to described second entropy decoding unit;
Second inter prediction unit, carries out inter prediction for the motion vector exported according to reconstruct data and the described second entropy decoding unit of the first described reconfiguration unit;
Second reconfiguration unit, for being added the residual error data of the described second reverse dct transform and inverse quantization unit output and the prediction data of the second intraprediction unit or the output of the second inter prediction unit, obtain described P frame with reference to the reconstruct data of code stream, reference data required in its search window during inter prediction for described current macro;
Second filter unit, for carrying out filtering to the reference data of the second reconfiguration unit.
10. the H.264 coding method using the H.264 encoder according to any one of claim 1 ~ 9 to realize, is characterized in that, comprise the steps:
(1) judging that current macro is the need of carrying out inter prediction, if do not need inter prediction, then encodes to current macro, proceeding to step (4), if need inter prediction, then entering next step;
(2) be current macro setting search window, judge whether the reference data in search window is ready to, if so, then according to reference data, current macro is encoded, proceed to step (4), if not, then enter next step;
(3) reference code stream is decoded, obtain the reference data of a macro block, return step (2);
(4) judge whether to terminate coding, if do not terminated, then process next macro block and return step (1).
11. H.264 coding methods as claimed in claim 10, it is characterized in that, described reference data is the reference data of I frame type.
12. H.264 coding methods as claimed in claim 10, it is characterized in that, described reference data comprises the reference data of P frame type, the reference data of described P frame type be with the reference frame data of I frame type for reference to encoding, decoding obtains.
CN201210272224.9A 2012-08-02 2012-08-02 H264 encoder and coding method Active CN102769753B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210272224.9A CN102769753B (en) 2012-08-02 2012-08-02 H264 encoder and coding method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210272224.9A CN102769753B (en) 2012-08-02 2012-08-02 H264 encoder and coding method

Publications (2)

Publication Number Publication Date
CN102769753A CN102769753A (en) 2012-11-07
CN102769753B true CN102769753B (en) 2015-12-09

Family

ID=47096989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210272224.9A Active CN102769753B (en) 2012-08-02 2012-08-02 H264 encoder and coding method

Country Status (1)

Country Link
CN (1) CN102769753B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104038766A (en) * 2014-05-14 2014-09-10 三星电子(中国)研发中心 Device used for using image frames as basis to execute parallel video coding and method thereof
CN105530517B (en) * 2014-09-29 2018-07-31 炬芯(珠海)科技有限公司 A kind of decoder and the method for damaging decoding video images
JP7224892B2 (en) * 2018-12-18 2023-02-20 ルネサスエレクトロニクス株式会社 MOVING IMAGE ENCODER AND OPERATION METHOD THEREOF, VEHICLE INSTALLING MOVING IMAGE ENCODER
CN110035293B (en) * 2019-04-22 2022-01-11 湖南国科微电子股份有限公司 Electronic equipment and image coded data storage method and device
CN110798684A (en) * 2019-09-30 2020-02-14 武汉兴图新科电子股份有限公司 Image segment peak-shifting coding transmission method
CN115914645A (en) * 2021-08-18 2023-04-04 炬芯科技股份有限公司 Inter-frame prediction method and device
CN114727116A (en) * 2022-04-06 2022-07-08 展讯通信(上海)有限公司 Encoding method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1905677A (en) * 2006-08-07 2007-01-31 清华大学 Data buffer storage method of variable size block motion compensation and implementing apparatus thereof
CN1964495A (en) * 2006-12-08 2007-05-16 北京中星微电子有限公司 A method and device for carrying out buffer control to real time digital video stream
CN101340588A (en) * 2008-08-20 2009-01-07 炬力集成电路设计有限公司 Motion estimation method, device and multimedia processor
CN101502125A (en) * 2006-09-06 2009-08-05 索尼株式会社 Image data processing method, program for image data processing method, recording medium with recorded program for image data processing method and image data processing device
CN101924938A (en) * 2010-08-11 2010-12-22 上海交通大学 Processing Method of Adjacent Block Information in Macroblock Prediction and Boundary Filtering of Video Decoding

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1905677A (en) * 2006-08-07 2007-01-31 清华大学 Data buffer storage method of variable size block motion compensation and implementing apparatus thereof
CN101502125A (en) * 2006-09-06 2009-08-05 索尼株式会社 Image data processing method, program for image data processing method, recording medium with recorded program for image data processing method and image data processing device
CN1964495A (en) * 2006-12-08 2007-05-16 北京中星微电子有限公司 A method and device for carrying out buffer control to real time digital video stream
CN101340588A (en) * 2008-08-20 2009-01-07 炬力集成电路设计有限公司 Motion estimation method, device and multimedia processor
CN101924938A (en) * 2010-08-11 2010-12-22 上海交通大学 Processing Method of Adjacent Block Information in Macroblock Prediction and Boundary Filtering of Video Decoding

Also Published As

Publication number Publication date
CN102769753A (en) 2012-11-07

Similar Documents

Publication Publication Date Title
CN102769753B (en) H264 encoder and coding method
US9807410B2 (en) Late-stage mode conversions in pipelined video encoders
US9473778B2 (en) Skip thresholding in pipelined video encoders
CN106973297A (en) Video coding method and hybrid video coder
CN101072356B (en) A Motion Vector Prediction Method
CN101394560A (en) A Hybrid Pipeline Apparatus for Video Coding
KR20090099234A (en) Image encoding and decoding method and apparatus
WO2009052697A1 (en) A dual prediction video encoding and decoding method and a device
KR20090095317A (en) Method and apparatus for encoding and decoding image
CN102196272B (en) P frame coding method and device
CN108063947B (en) A Lossless Reference Frame Compression Method Based on Pixel Texture
CN102714717A (en) Low-cost video encoder
WO2021196087A1 (en) Video quality improvement method and apparatus
CN106412611B (en) A kind of complexity control method of efficient video coding
CN109391816B (en) Parallel processing method of entropy coding in HEVC based on CPU+GPU heterogeneous platform
CN106063269A (en) Moving image coding device, moving image decoding device, moving image coding method, and moving image decoding method
KR20130006578A (en) Residual coding in compliance with a video standard using non-standardized vector quantization coder
CN102137257A (en) Embedded H.264 coding method based on TMS320DM642 chip
US9077996B2 (en) Predicted motion vectors
KR20070028404A (en) Method of storing pictures in a memory using compression coding and cost function including power consumption
CN116233453B (en) Video coding method and device
JP2007325119A (en) Image processing apparatus and image processing method
CN101262607B (en) Two-folded prediction video coding and decoding method and device
TWI479897B (en) Video signal encoder/decoder with 3d noise reduction function and control method thereof
TW201633786A (en) Multimedia codec, application processor including the same, and method of operating the application processor

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载