CN102750928B - One kind of fade-out processing based on the graphic image fade sse2 - Google Patents

One kind of fade-out processing based on the graphic image fade sse2 Download PDF

Info

Publication number
CN102750928B
CN102750928B CN 201110127388 CN201110127388A CN102750928B CN 102750928 B CN102750928 B CN 102750928B CN 201110127388 CN201110127388 CN 201110127388 CN 201110127388 A CN201110127388 A CN 201110127388A CN 102750928 B CN102750928 B CN 102750928B
Authority
CN
Grant status
Grant
Patent type
Prior art keywords
parallel
graphic image
rgb
fade
data
Prior art date
Application number
CN 201110127388
Other languages
Chinese (zh)
Other versions
CN102750928A (en )
Inventor
廖健
吕精华
郑培枫
饶文辉
Original Assignee
新奥特(北京)视频技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Grant date

Links

Abstract

本发明公开了一种基于SSE2的图形图像淡入淡出处理方法,包括:读取待处理图形图像数据,选取待处理图形图像数据像素点,对其并行处理;利用RGB Mask方法得到并行计算数据的Alpha值部分,并对所述Alpha值部分进行并行计算,得到Alpha值并行结果;利用RGB Mask方法,合并原有数据的RGB部分和并行计算后的Alpha并行结果,得到完整RGBA值结果。 The present invention discloses a graphic image based SSE2 fade processing method, comprising: reading data to be processed graphic image, graphic image data to be processed selected pixels, its parallel processing; calculation data obtained using the parallel method RGB Mask Alpha value portion, and the parallel portion Alpha value calculations, Alpha value obtained results parallel; Alpha rear portion and an RGB RGB Mask using parallel computation method, the original data in parallel combined result, the complete result RGBA values. 通过本发明提供的方法,提高了并行计算数据量,每次操作4个像素,大大提高了效率,采用了RGB Mask分离与合并像素点RGB部分方法,大幅度减少了不必要计算,从而提高了运算速度;舍弃了查表计算方法,更高效的利用了CPU的性能,从而提高了计算速度,缩短了计算时间。 By the methods provided by the invention, increases the amount of data parallel computing, four pixels each operation, greatly improving the efficiency, the use of a combined RGB pixels Mask RGB separation part of the method, considerably reducing unnecessary calculation, thereby increasing the computing speed; abandon the look-up table calculation method, more efficient use of CPU performance, thereby increasing the speed of calculation, the calculation time shortens.

Description

一种基于SSE2的图形图像淡入淡出处理方法 Fade-out process based on one kind of graphic image fade SSE2

技术领域 FIELD

[0001]本发明涉及广播电视领域,特别是涉及一种基于SSE2的图形图像淡入淡出处理方法。 [0001] The present invention relates to the field of television broadcasting, particularly to a graphic image based SSE2 fade processing method.

背景技术 Background technique

[0002]多媒体技术中会根据需要对图形图像做各种处理,其中淡入淡出就是比较常用的一种。 [0002] Display technologies do various kinds of processing required graphic image, wherein a fade is commonly used as a comparison. 图形图像的淡入淡出,是一种图形图像的渐显、渐隐的显示方法。 Fade graphic image fade, fade is a graphical method of displaying an image, the fade. 图形图像由亮转暗,以至完全隐没,这个过程的末尾叫淡出,也叫渐隐;图形图像由暗变亮,最后完全清晰,这个过程的开端叫淡入,又叫渐显。 Graphic image turned dark from light, or even completely hidden, fade out at the end of this process is called, also known as fade; graphic images from dark to light, and finally completely clear, the beginning of this process is called a fade, also known as fade. 淡出淡入是图形图像处理中表示时间、空间转换的一种技巧。 Fade graphic image processing is a technique represents time, space conversion.

[0003]而在彩色屏幕上,硬件装置使屏幕上的每个像素发射不同数量的红、绿和蓝光。 [0003] In a color screen, a hardware device for each pixel on the screen so that a different number of emission of red, green and blue light. 这几种颜色的数量分别被称为R、6和8值。 Number of the colors are referred to as R, 6 and 8 values. 和它们常常包装在一起的还有第四个透明度值,称为Alpha,即用A表示。 They are often packaged together and there is a fourth transparency value, called Alpha, i.e., is represented by A. Alpha值对屏幕所显示的颜色并没有直接的效果,但它有许多用途,包括混合和透明等等。 Alpha screen displayed color value and has no direct effect, but it has many uses, including blending and transparency and the like.

[0004]中国专利文献CN1664865A是本发明最接近的现有技术,发明人在实现本发明的过程中,发现现有技术至少存在以下问题:现有技术中,每次淡入淡出操作所处理像素点数量为1-2个,函数调用开销较大以及处理效率较低;淡入淡出操作中间参与数据多数以查表方式给出,从而大大增加了缓存缺失的发生,降低了处理速度及效率。 [0004] Chinese patent CN1664865A is the closest prior art to the present invention, In the process of implementing the present invention finds that the prior art at least has the following problems: the prior art, pixels processed per operation fade fade in an amount of 1-2, the function call large overhead and low efficiency; fade intermediate operations involved in most data given in table lookup, thereby greatly increasing the cache miss occurs, which reduces processing speed and efficiency.

发明内容 SUMMARY

[0005]本发明实施例要解决的问题是提供一种基于SSE2的图形图像淡入淡出处理方法,提高数据并行处理的效率,每次混合操作4个像素点,降低缓存缺失的发生次数,用直接计算代替查表法。 [0005] Problems to be solved by embodiments of the present invention to provide a fade-out processing based on the graphic image fade SSE2, to improve the efficiency of parallel processing, the number of occurrences per four pixels mixing operation, reducing cache misses, direct calculation instead of the lookup table.

[0006]为达到上述目的,本发明提供了一种基于数据流单指令多数据扩展指令集2SSE2的图形图像淡入淡出处理方法,包括: [0006] To achieve the above object, the present invention provides a stream-based SIMD extended instruction set 2SSE2 graphic image fade fade processing method comprising:

[0007]读取待处理图形图像数据,选取待处理图形图像数据像素点,对其并行处理; [0007] processing graphics image data to be read, select graphics image data to be processed pixel, its parallel processing;

[0008] 利用RGB Mask方法得到并行计算数据的Alpha值部分,并对所述Alpha值部分进行并行计算,得到Alpha值并行结果; [0008] The method of using the RGB Mask data obtained parallel computing portion Alpha value, the Alpha value portion and parallel computation, the results obtained in parallel Alpha value;

[0009]利用RGB Mask方法,合并原有数据的RGB部分和并行计算后的Alpha并行结果,得到完整RGBA值结果。 [0009] Mask using the RGB method, the original data of the combined RGB Alpha portion and the parallel calculation results of the parallel, full RGBA values ​​obtained results.

[0010]本发明实施例的技术方案具有以下优点,(I)提高了并行计算数据量,每次操作4个像素,大大提高了效率;(2)采用了RGB Mask分离与合并像素点RGB部分方法,大幅度减少了不必要计算,从而提高了运算速度;(4)舍弃了查表计算方法,更高效的利用了CPU的性能,从而提高了计算速度,缩短了计算时间。 [0010] Technical solutions of the embodiments of the present invention has the advantage, (the I) increases the amount of data parallel computing, four pixels each operation, greatly improving the efficiency; (2) the separation of the combined RGB Mask RGB pixel portion the method of greatly reducing unnecessary calculation, thereby increasing the operation speed; (4) a look-up table discard calculation method, more efficient use of CPU performance, thereby increasing the speed of calculation, the calculation time shortens.

附图说明 BRIEF DESCRIPTION

[0011]图1是本发明中一种基于SSE2的图形图像淡入淡出处理方法的流程图。 [0011] FIG. 1 is a flowchart illustrating the present invention method of one of fade-out processing based SSE2 graphic image fade.

具体实施方式 detailed description

[0012]下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,需要指出的是,所描述的实施例仅仅是本发明的一部分实施例,而不是全部的实施例。 The combined [0012] Next, the present invention in the accompanying drawings, technical solutions in the embodiments will be apparent to the present invention, a complete description, it is noted that the described embodiments are merely part of the present embodiment of the invention, and not all embodiments. 基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。 Based on the embodiments of the present invention, all other embodiments of ordinary skill in the art without any creative effort shall fall within the scope of the present invention.

[0013]下面结合附图和实施例,对本发明的具体实施方式作进一步详细描述: [0013] The following embodiments and the accompanying drawings, specific embodiments of the present invention will be further described in detail:

[0014]本发明提供了一种基于SSE2的图形图像淡入淡出处理方法,如图1所示,包括以下步骤: [0014] The present invention provides a graphic image based SSE2 fade processing method shown in Figure 1, comprising the steps of:

[0015]步骤SlOl,读取待处理图形图像数据,选取待处理图形图像数据像素点,对其并行处理。 [0015] Step the SLOL, graphics image data to be processed is read, select the graphic image data to be processed pixel, its parallel processing.

[0016]首先,要读取待处理的图形图像数据,从中任意选择4个相邻像素点。 [0016] First, the graphic image data to be read to be processed, arbitrarily selected from four adjacent pixels. 现有技术中只能同时处理1-2个像素,而由于本发明实施例是基于SSE2提供的128位寄存器,而每个像素点的RGBA值为3 2位,所以本发明实施例提供的方法可以支持对4个像素点的处理。 The prior art can simultaneously process pixels 1-2, but since the embodiment of the present invention is based on the 128-bit register provided SSE2, the value of each pixel RGBA 32 bits, the method provided in the embodiment of the present invention support processing of four pixels. 对选择出的4个相邻像素点对其进行并行处理,即同时对选择出的4个相邻像素点进行处理,通过一个操作命令实现单指令多数据操作。 Of the selected four pixels adjacent parallel processing thereof, i.e. simultaneously selected four adjacent pixels for processing, single instruction multiple data operation command by one operation.

[0017] 步骤S102,利用RGB Mask方法得到并行计算数据的Alpha值部分,并对所述Alpha值部分进行并行计算,得到Alpha值并行结果。 [0017] step S102, obtained using the method of RGB Mask Alpha value calculating section parallel data, and said parallel portion Alpha value calculations, Alpha value obtained parallel results.

[0018]对步骤SlOl选择出的4个相邻像素点,通过RGB MASK得到并行的4个相邻像素点的各自的AI pha值部分,继而得到AI pha值并行结果。 [0018] step SlOl four selected adjacent pixels, to give 4 adjacent pixels in parallel by the respective AI pha RGB MASK value portion, followed by the results obtained in parallel AI pha value.

[0019] (I)每个像素点有RGBA值,排列如下: [0019] (I) have each pixel RGBA values, arranged as follows:

[0020] A|R|G|B每个值占8个Bit位 [0020] A | R | G | B values ​​each representing 8 bits Bit

[0021] (2)方法中每次处理四个连续的像素点(0、1、2、3像素点),那么排列如下: [0021] (2) Method of processing each consecutive four pixels (pixels 0, 1), then arranged as follows:

[0022] RGBA=A3 | R3 | G3 | B3 | A2 | R2 | G2 | B2 | Al | Rl | Gl | BI | AO | RO | GO | BO [0022] RGBA = A3 | R3 | G3 | B3 | A2 | R2 | G2 | B2 | Al | Rl | Gl | BI | AO | RO | GO | BO

[0023] (3)方法中避免不了乘法等等的运算,例如:像素点的A值,A*X使得结果大于2的8次方,也就是不能存储在原有的8bit中,造成运算的结果失真,RGB Mask方法分离就是解决这一问题。 [0023] (3) The method can not be avoided like the multiplication operation, for example: A value of the pixel point, A * X 8 so that the result is greater than the power of two, is not stored in the original 8bit, the result of the operation causing distortion, RGB Mask separation method is to solve this problem.

[0024] (4)RGB Mask方法分离像素点值原理如下: [0024] (4) RGB Mask pixel value method of separating principle is as follows:

[0025] (FF = 11111111; 00 = 00000000,十六进制) [0025] (FF = 11111111; 00 = 00000000, hex)

[0026]定义常量RGB MASK = FFOOOOOO | FFOOOOOO | FFOOOOOO | FF000000RGB MASK与RGBA值做逻辑与运算,得到 [0026] defined constant RGB MASK = FFOOOOOO | FFOOOOOO | FFOOOOOO | FF000000RGB MASK RGBA values ​​with logical AND operation, to give

[0027] A3 IOIOIO IA2 | O | O | O | Al | O | OIO IAO IOIOIO, [0027] A3 IOIOIO IA2 | O | O | O | Al | O | OIO IAO IOIOIO,

[0028]这样每个像素A值都有足够bit位可用,保证运算的正常进行。 [0028] A pixel value so that each bit has enough bits available to ensure normal operations.

[0029] 步骤S103,利用RGB Mask方法,合并原有数据的RGB部分和并行计算后的Alpha并行结果,得到完整RGBA值结果。 [0029] Step S103, the RGB Mask using the method, combined the original RGB data Alpha portion parallel and parallel computing results, the results obtained complete RGBA values.

[0030]在对当前选取的4个像素点进行运算得到完整的RGBA值结果后,判断当前数据中是否还有未处理的像素点,如果有则直接选取像素点;如果没有则继续读取其他未做处理的图形图像数据。 [0030] After the four pixels currently selected complete calculates RGBA values ​​obtained result, current data to determine whether there is an unprocessed pixel, if the pixel selected directly; if not then continue reading the other graphic image data without making processing. [0031 ]通过本发明的实施例,提高了并行计算数据量,每次操作4个像素,大大提高了效率,采用了RGB Mask分离与合并像素点RGB部分方法,大幅度减少了不必要计算,从而提高了运算速度;舍弃了查表计算方法,更高效的利用了CPU的性能,从而提高了计算速度,缩短了计算时间。 [0031] Examples of the present invention, increases the amount of data parallel computing, four pixels each operation, greatly improving the efficiency, a method using a portion of the combined RGB Mask isolated pixels RGB, significantly reduce unnecessary calculations, thereby increasing the operation speed; abandon the look-up table calculation method, more efficient use of CPU performance, thereby increasing the speed of calculation, the calculation time shortens.

[0032]通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本发明可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。 [0032] By the above described embodiments, those skilled in the art may clearly understand that the present invention may be implemented by software plus a necessary universal hardware platform, also be implemented by hardware, but the former is in many cases more good embodiments. 基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台终端设备(可以是手机,个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。 Based on such understanding, the technical solutions of the present invention in essence or the part contributing to the prior art may be embodied in a software product, which computer software product is stored in a storage medium and includes several instructions to enable a terminal devices (which may be a mobile phone, a personal computer, a server, or network device) to execute the methods according to embodiments of the present invention.

[0033]以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视本发明的保护范围。 [0033] The above are only preferred embodiments of the present invention, it should be noted that those of ordinary skill in the art, in the present invention without departing from the principles of the premise, can make various improvements and modifications, such modifications and modifications should also depend on the scope of the present invention.

Claims (4)

  1. 1.一种基于SSE2的图形图像淡入淡出处理方法,其特征在于,包括: 读取待处理图形图像数据,选取待处理图形图像数据像素点,对其并行处理; 利用RGB Mask方法得到并行计算数据的Alpha值部分,并对所述Alpha值部分进行并行计算,得到Alpha值并行结果; 利用RGB Mask方法,合并原有数据的RGB部分和并行计算后的Alpha并行结果,得到完整RGBA值结果; 所述选取待处理图形图像数据像素点具体为从所述待处理的图形图像数据中任意选择4个相邻像素点; 所述从所述待处理的图形图像数据中任意选择4个相邻像素点后同时对选择出的4个相邻像素点进行处理,通过一个操作命令实现单指令多数据操作; RGB Mask方法分离像素点值原理如下: 定义常量RGB MASK = FFOOOOOO | FFOOOOOO | FF000000 | FF000000, RGB MASK与RGBA值做逻辑与运算。 A fade-out processing based on the graphic image fade SSE2, characterized by comprising: reading data to be processed graphic image, graphic image data to be processed selected pixel, its parallel processing; calculation data obtained using the parallel method RGB Mask the Alpha value portion, and the parallel portion Alpha value calculations, Alpha value obtained results parallel; Mask method using RGB, RGB Alpha parallel portion and the result of merging the original data parallel computing, complete RGBA values ​​obtained result; as selecting said graphic image data to be processed to select specific pixels adjacent four pixels from said graphic image data to be processed in any of; the selection from the four neighboring pixels of said graphic image data to be processed in any At the same time of the selected four adjacent pixels for processing, single instruction multiple data operation command by one operation; RGB Mask pixel value method of separating principle is as follows: define constants RGB MASK = FFOOOOOO | FFOOOOOO | FF000000 | FF000000, RGB MASK RGBA values ​​with logical aND operation.
  2. 2.如权利要求1所述的基于SSE2的图形图像淡入淡出处理方法,其特征在于,所述合并原有数据的RGB部分和并行计算后的Alpha并行结果后还判断当前数据中是否有未处理的像素点。 2. Based SSE2 fade graphic image processing method, wherein, after the combined RGB Alpha portion and parallel computation of the original data after the parallel results also determines whether the current data unprocessed claimed in claim 1, the pixels.
  3. 3.如权利要求2所述的基于SSE2的图形图像淡入淡出处理方法,其特征在于,当有未处理的像素点时,直接继续选取4个相邻像素点进行处理。 As claimed in claim 2 based SSE2 fade graphic image processing method, wherein, when the unprocessed pixel, proceed directly to four neighboring pixels selected for processing.
  4. 4.如权利要求2所述的基于SSE2的图形图像淡入淡出处理方法,其特征在于,当没有未处理的像素点时,则读取其他未作处理的图形图像数据,从中选取像素点进行处理。 As claimed in claim 2 based SSE2 fade graphic image processing method, wherein, when there is no unprocessed pixel, the image data is read other graphics have not been processed, processing pixels selected from .
CN 201110127388 2011-05-17 2011-05-17 One kind of fade-out processing based on the graphic image fade sse2 CN102750928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110127388 CN102750928B (en) 2011-05-17 2011-05-17 One kind of fade-out processing based on the graphic image fade sse2

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110127388 CN102750928B (en) 2011-05-17 2011-05-17 One kind of fade-out processing based on the graphic image fade sse2

Publications (2)

Publication Number Publication Date
CN102750928A true CN102750928A (en) 2012-10-24
CN102750928B true CN102750928B (en) 2016-08-17

Family

ID=47031057

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110127388 CN102750928B (en) 2011-05-17 2011-05-17 One kind of fade-out processing based on the graphic image fade sse2

Country Status (1)

Country Link
CN (1) CN102750928B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5940080A (en) * 1996-09-12 1999-08-17 Macromedia, Inc. Method and apparatus for displaying anti-aliased text
CN1664865A (en) * 2004-02-18 2005-09-07 哈曼贝克自动系统股份有限公司 Image processor
CN101753912A (en) * 2008-12-22 2010-06-23 康佳集团股份有限公司 Method and device for displaying picture of embedded set top box

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5940080A (en) * 1996-09-12 1999-08-17 Macromedia, Inc. Method and apparatus for displaying anti-aliased text
CN1664865A (en) * 2004-02-18 2005-09-07 哈曼贝克自动系统股份有限公司 Image processor
CN101753912A (en) * 2008-12-22 2010-06-23 康佳集团股份有限公司 Method and device for displaying picture of embedded set top box

Also Published As

Publication number Publication date Type
CN102750928A (en) 2012-10-24 application

Similar Documents

Publication Publication Date Title
US5923316A (en) Optimized color space conversion
US6903753B1 (en) Compositing images from multiple sources
US20060282604A1 (en) Methods and apparatus for processing graphics data using multiple processing circuits
US20010014175A1 (en) Method for rapid color keying of color video images using individual color component look-up-tables
US5936683A (en) YUV-to-RGB conversion without multiplies using look-up tables and pre-clipping
US20030227462A1 (en) Graphics texture processing methods, apparatus and computer program products using texture compression, block overlapping and/or texture filtering
US6587117B1 (en) Apparatus and method for adaptive transformation of fractional pixel coordinates for calculating color values
US6940523B1 (en) On the fly data transfer between RGB and YCrCb color spaces for DCT interface
US7643032B2 (en) Texture-based packing, such as for packing 8-bit pixels into two bits
US20090310947A1 (en) Apparatus and Method for Processing and Blending Multiple Heterogeneous Video Sources for Video Output
US20070237391A1 (en) Device and method for image compression and decompression
JP2005316369A (en) Image processing method of tft-lcd
CN103886808A (en) Display method and display device
US20030164842A1 (en) Slice blend extension for accumulation buffering
US20110080519A1 (en) System and method for efficiently processing digital video
US20050001856A1 (en) Method and device providing enhanced characters
US20080239157A1 (en) Memory Efficient Gamma Correction For Multiple Display Devices
CN101499172A (en) ActiveX drafting method and device
JP2008107507A (en) Video data converter and video display apparatus
US20060092169A1 (en) Texture-based packing, such as for packing 8-bit pixels into one bit
US20040247178A1 (en) Fast software rotation of video for portrait mode displays
US5590254A (en) Displaying multiple video streams using a bit map and a single frame buffer
US20120127185A1 (en) System and method for an optimized on-the-fly table creation algorithm
CN202363037U (en) Color display screen
CN101009851A (en) Image processing method and its device

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
C14 Grant of patent or utility model