CN102231836B - Graphics interchange format (GIF) file processing method and device for digital television system - Google Patents

Graphics interchange format (GIF) file processing method and device for digital television system Download PDF

Info

Publication number
CN102231836B
CN102231836B CN 201110175348 CN201110175348A CN102231836B CN 102231836 B CN102231836 B CN 102231836B CN 201110175348 CN201110175348 CN 201110175348 CN 201110175348 A CN201110175348 A CN 201110175348A CN 102231836 B CN102231836 B CN 102231836B
Authority
CN
China
Prior art keywords
rgb
pixel
picture frame
value
transparent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN 201110175348
Other languages
Chinese (zh)
Other versions
CN102231836A (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.)
Shenzhen Ipanel TV Inc
Original Assignee
Shenzhen Ipanel TV Inc
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 Shenzhen Ipanel TV Inc filed Critical Shenzhen Ipanel TV Inc
Priority to CN 201110175348 priority Critical patent/CN102231836B/en
Publication of CN102231836A publication Critical patent/CN102231836A/en
Priority to HK12103366.6A priority patent/HK1162799A1/en
Application granted granted Critical
Publication of CN102231836B publication Critical patent/CN102231836B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a graphics interchange format (GIF) file processing method and a GIF file processing system for a digital television system. The processing method comprises a front-end processing method and a terminal processing method. The front-end processing method comprises the following steps of: decoding a GIF file to obtain a red, green and blue (RGB) image frame and the transparent information of pixels of the RGB image frame; regulating RGB values of the pixels according to the transparent information of the pixels of the RGB image frame, wherein the regulated RGB values are used for reflecting whether corresponding pixels require transparent processing or not; converting the RGB image frame with the regulated RGB values into a luma and chroma (YUV) image frame; performing video coding on the YUV image frame according to a preset video coding standard to obtain video data; and transmitting the video data. The device provided by the invention comprises a front-end processing system and a terminal processing device. By the processing method and the processing device provided by the invention, the finite central processing unit (CPU) resources of a digital television set-top box are saved, the GIF file with a high frame rate and large images can be used, and dynamic images, with transparency effects, of the GIF file can be displayed at a terminal.

Description

Processing method and the device of a kind of gif file in digital television system
Technical field
The present invention relates to the digital television techniques field, particularly processing method and the device of a kind of gif file in digital television system.
Background technology
Along with the popularization of Digital Television use and the development of digital television techniques, digital cable customers is had higher requirement to the picture effect of watching, for example, wish to see HTML (Hyper Text Mark-up Language, the HTML) page that embeds dynamic image.Html page allows to embed the dynamic image of different data format, and these dynamic images are not only lively, and the application of transparent background effect makes dynamic effect rich and varied.In various moving image format, graphic interchange format Graphics Interchange Format, GIF) form is a kind of moving image format that is widely used.
The common way of digital television system processing gif file is central processing unit (the Central Processing Unit by set-top box at present, CPU) gif file is decoded, but this decoding belongs to soft decoding, need to consume a large amount of cpu resources, system loading is high, when especially higher when the gif file frame per second or picture size is larger, can cause the limited resource of set-top box CPU can not satisfy the real-time decoding of image in gif file, the slack phenomenon of animation effect in the time of may occurring showing can be experienced picture and significantly jumps and pause sense when the user watches.Therefore, generally do not support the gif file of high frame per second, large-size images in existing Digital Television html page, or show gif file by the method that reduces frame per second, reduces picture size, but these solutions or can not use gif file, reduce the quality of gif file image and the effect of animation, made the application and development of gif file dynamic image in digital television system be restricted.
Summary of the invention
In view of this, the object of the present invention is to provide processing method and the device of a kind of gif file in digital television system, make the gif file that can show in real time high frame per second, large-size images in terminal, and the picture that shows is with transparent effect.
The invention provides the front-end processing method of a kind of gif file in digital television system, comprising:
The graphic interchange format gif file is decoded, obtain the transparent information of RGB picture frame and RGB picture frame pixel;
Adjust the rgb value of pixel according to the transparent information of described RGB picture frame pixel, wherein, the rgb value after adjustment is used for pixel corresponding to reflection and whether needs to carry out transparent processing;
The RGB picture frame that will carry out after the rgb value adjustment is converted to the YUV picture frame;
According to default video encoding standard, the YUV picture frame is carried out Video coding and obtain video data;
Send described video data.
Preferably, the described rgb value of adjusting pixel according to the transparent information of described RGB picture frame pixel specifically comprises:
If the transparent information of RGB picture frame pixel is transparent, the rgb value of this pixel is adjusted into
(255,255,255);
Otherwise, the rgb value of this pixel is adjusted into (R/2, G/2, B/2).
Preferably, the described RGB picture frame that will carry out after the rgb value adjustment also comprises before being converted to the YUV picture frame:
According to default video encoding standard, the size of having carried out the RGB picture frame after the rgb value adjustment is adjusted.
Preferably, described default video encoding standard is the dynamic image MPEG-2 of expert group video encoding standard or video encoding standard H.264, the default video encoding standard of described basis is adjusted described size of having carried out the RGB picture frame after the rgb value adjustment, comprising: the described wide height that has carried out the RGB picture frame after the rgb value adjustment is extended to and can be divided exactly by 16 pixels.
The terminal processing method of a kind of gif file in digital television system comprises:
The video data that receiving front-end sends in accordance with the method for claim 1;
According to decoding standard corresponding to described video encoding standard, described video data is decoded and obtain the YUV picture frame;
The YUV picture frame is converted to the RGB picture frame;
Obtain the transparent information of pixel according to the rgb value of described RGB picture frame pixel, and adjust the rgb value of pixel;
The rgb value of the pixel that described RGB picture frame is comprised, the rgb value of display position background pixel point carry out ALPHA with the transparent information of RGB picture frame pixel and mix, and output display.
Preferably, the described rgb value of adjusting pixel according to the transparent information of described RGB picture frame pixel, specifically comprise: if the transparent information of RGB picture frame pixel is transparent, the rgb value of this pixel is adjusted into (255,255,255); Otherwise, the rgb value of this pixel is adjusted into (R/2, G/2, B/2);
Described rgb value according to described RGB picture frame pixel obtains the transparent information of pixel, and adjusts the rgb value of pixel, comprising:
If the rgb value of described RGB picture frame pixel be (R〉X, G〉X, B〉X), the transparent information of this pixel is all-transparent, X for the difference transparent and opaque threshold value, value is an integer value between 128 to 255;
Otherwise, the transparent information of pixel is for entirely opaque, and adjust in such a way the rgb value of pixel: take advantage of respectively 2 to process three components of rgb value, the component value and 255 after taking advantage of 2 to process is compared, and the value of general smaller wherein after as the adjustment of respective component.
The front end processing device of a kind of gif file in digital television system comprises:
The gif file decoding unit is used for gif file is decoded, and obtains the transparent information of RGB picture frame and RGB picture frame pixel;
The rgb value adjustment unit is used for the rgb value according to the transparent information adjustment pixel of described RGB picture frame pixel, and wherein, the rgb value after adjustment is used for pixel corresponding to reflection and whether needs to carry out transparent processing;
RGB to YUV converting unit, the RGB picture frame that is used for having carried out after the rgb value adjustment is converted to the YUV picture frame;
Video encoding unit is used for according to default video encoding standard, the YUV picture frame being carried out Video coding and obtains video data;
The structured video data transmitting unit is used for sending described video data.
Preferably, described rgb value adjustment unit is adjusted the rgb value of pixel according to the transparent information of described RGB picture frame pixel, specifically be used for:
If the transparent information of RGB picture frame pixel is transparent, the rgb value of this pixel is adjusted into (255,255,255);
Otherwise, the rgb value of this pixel is adjusted into (R/2, G/2, B/2).
Preferably, described RGB to YUV converting unit further comprises: RGB frame sign adjustment unit is used for according to default video encoding standard, the size of having carried out the RGB picture frame after the rgb value adjustment being adjusted;
Described RGB to YUV converting unit, the RGB picture frame after being used for described size is adjusted is converted to the YUV picture frame.
Preferably, described default video encoding standard is the dynamic image MPEG-2 of expert group video encoding standard or video encoding standard H.264, described RGB frame sign adjustment unit is used for the described wide height that has carried out the RGB picture frame after the rgb value adjustment is extended to and can be divided exactly by 16 pixels.
The terminal processing device of a kind of gif file in digital television system comprises:
The video data receiving element is used for the video data that receiving front-end sends according to device claimed in claim 7;
Video decoding unit, being used for decodes to video data according to decoding standard corresponding to video data encoding standard obtains the YUV picture frame;
YUV to RGB converting unit is used for the YUV picture frame is converted to the RGB picture frame;
Transparent information obtains and the rgb value adjustment unit, obtains the transparent information of pixel according to the rgb value of described RGB picture frame pixel, and adjusts the rgb value of pixel;
Mix the output display unit, the rgb value that is used for rgb value, the display position background pixel point of pixel that described RGB picture frame is comprised carries out ALPHA with the transparent information of RGB picture frame pixel to be mixed, and output display.
Preferably, described rgb value adjustment unit is adjusted the rgb value of pixel according to the transparent information of described RGB picture frame pixel, and specifically comprise: if the transparent information of RGB picture frame pixel is transparent, the rgb value of this pixel is adjusted into (255,255,255); Otherwise, the rgb value of this pixel is adjusted into (R/2, G/2, B/2);
Described transparent information obtains and the rgb value adjustment unit, specifically is used for:
If the rgb value of described RGB picture frame pixel be (R〉X, G〉X, B〉X), the transparent information of this pixel is all-transparent, X for the difference transparent and opaque threshold value, value is an integer value between 128 to 255;
Otherwise, the transparent information of pixel is for entirely opaque, and adjust in such a way the rgb value of pixel: take advantage of respectively 2 to process three components of rgb value, the component value and 255 after taking advantage of 2 to process is compared, and the value of general smaller wherein after as the adjustment of respective component.
According to the specific embodiment that the application provides, the application discloses following technique effect:
by at digital TV front-end, gif file being decoded, obtain the transparent information of RGB picture frame and RGB picture frame pixel, make the rgb value of RGB picture frame pixel reflect the transparent information of RGB picture frame pixel by special processing, and the picture frame that will comprise transparent information carries out Video coding, obtain video data, make digital TV terminal to decode by hardware and restore the rgb value of RGB picture frame pixel and the transparent information of corresponding pixel points with respective handling from video data, avoided using CPU to carry out the gif file decoding at terminal set top box, saved the limited cpu resource of set-top box, and then can use the gif file of high frame per second and large-size images.The rgb value of RGB picture frame pixel, the rgb value of display position background pixel point are undertaken exporting after ALPHA mixes by the terminal set top box first floor system with the transparent information of picture frame pixel, make the gif file dynamic image that demonstrates with transparent effect.Therefore, content supplier can develop the gif file that content is abundanter, picture is more gorgeous, has improved the picture quality of the gif file dynamic image that the user watches, has promoted the application of multimedia digital content in the digital television system field
Description of drawings
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, the below will do to introduce simply to the accompanying drawing of required use in embodiment, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the schematic flow sheet of front-end processing method of the present invention;
Fig. 2 is the schematic flow sheet of terminal processing method of the present invention;
Fig. 3 is the structural representation of front end processing device of the present invention;
Fig. 4 is the structural representation of terminal processing device of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Based on the embodiment in the present invention, the every other embodiment that those of ordinary skills obtain belongs to the scope of protection of the invention.
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
GIF is a kind of bitmaps animation form, can deposit several coloured images in a gif file.One width coloured image is a basic picture frame, if the multiple image frame in gif file is shown on screen continuously, just obtained animation effect, the frame per second of picture frame is higher, and the animation effect that obtains is just more smooth.
The front end of the embodiment of the present invention comprises mainly that to the processing method of gif file the transparent information of gif file decoding, the pixel adjustment of RGB picture frame and pixel is processed, the RGB picture frame turns the steps such as YUV picture frame and Video coding.
With reference to shown in Figure 1, the below is described in detail the front-end processing method of the embodiment of the present invention.
S101) gif file is decoded, obtain the transparent information of RGB image frame data and RGB picture frame pixel.
Gif file include file head, application extension block and end-of-file.Wherein application extension block comprises image control extension blocks and video data block.Gif file is decoded, the RGB picture frame that can obtain comprising in video data block.The transparent information of gif file picture frame pixel is represented by image transparent logos (Transparent Color Flag) field and Transparent color index (the Transparent Color Index) field of Graph Control extension blocks.By being decoded, gif file can obtain the transparent information of RGB picture frame pixel.The transparent information of gif file picture frame pixel is determined jointly by image transparent logos field and Transparent color index field.Image transparent logos field only has 1 bit, and the transparency of gif file picture frame pixel has two kinds: all-transparent or entirely opaque.When the image transparent logos was 1, the indicated color of Transparent color index was transparent.
Therefore, according to the GIF format standard, gif file is decoded, the transparent information of the RGB picture frame that can obtain comprising in video data block and RGB picture frame pixel.
S102) adjust the rgb value of pixel according to the transparent information of described RGB picture frame pixel, wherein, the rgb value after adjustment is used for pixel corresponding to reflection and whether needs to carry out transparent processing.
In an embodiment of the present invention, need to utilize the front end of digital television system that the RGB picture frame is carried out conversion process and carries out Video coding in subsequent step, but conversion process and video coding process are not preserved the transparent information of picture frame pixel, therefore, for demonstrate the gif file dynamic image with transparent effect in terminal, need to carry out special processing to the transparent information of RGB picture frame pixel, make terminal can obtain this transparent information.Characteristics for gif file image transparency, namely only have all-transparent and complete opaque two kinds of situations, front end can be adjusted according to the transparent information of RGB picture frame pixel the rgb value of pixel, make the rgb value after adjustment can reflect whether corresponding pixel needs to carry out transparent processing, and then terminal can obtain by the rgb value of RGB picture frame the transparent information of pixel.
The method of the concrete processing of the rgb value of front end adjustment pixel is as follows:
The transparent information of RGB picture frame pixel is transparent, and namely the image transparent logos is 1, and the rgb value of this pixel is adjusted into (255,255,255);
Otherwise, the rgb value of this pixel is adjusted into (R/2, G/2, B/2).
Certainly, in actual applications, except this method, also can adopt other modes to realize, for example, the rgb value of all transparent pixels points is adjusted into other value, all nontransparent pixels are carried out the similar method of adjustment of above-described embodiment, terminal can be distinguished, will not enumerate here.
The RGB picture frame that S103) will carry out after the rgb value adjustment is converted to the YUV picture frame.
According to the requirement of Video coding, needing the RGB color space conversion before carrying out Video coding is the YUV color space that television system is used, and obtains the YUV picture frame." Y " expression brightness in the YUV picture frame, " U " and " V " represents colourity.For the YUV picture frame, the complete description of a color image is represented by brightness value Y and two chrominance C b, Cr.RGB is to realize according to the conversion formula of standard definition to the conversion of YUV.
Brightness value Y, by R, G, the weighted average of B obtains:
Y=krR+kgG+kbB, kr, kg, kb are weighted factors, by standard code.
Chrominance C b, Cr is represented by different color distinction:
Cb=B-Y
Cr=R-Y
During specific implementation, the RGB picture frame is converted to the YUV picture frame can be calculated by different algorithms the YUV value.For obtaining higher conversion efficiency, also can by pre-establishing conversion table, obtain YUV value corresponding to rgb value by rgb value query conversion table.
In the RGB picture frame is converted to the process of YUV picture frame, usually also need to control YUV picture frame number of repetition according to the delay time of RGB picture frame, make the variation of the YUV picture frame picture after conversion have better continuity.
Before the RGB picture frame is converted to the YUV picture frame, may also need according to video encoding standard, the size of the RGB picture frame before changing to be adjusted, to facilitate Video coding.The video encoding standard that digital television system adopts can be the MPEG-2 video encoding standard that dynamic image expert body (Moving Pictures Experts Group) formulates.The MPEG-2 video encoding standard is also the current widely used video encoding standard of China's digital television system.Because the MPEG2 video image is to do compression take the pixel size of 16*16 as unit, therefore, if the length and width of picture frame can not be divided exactly by 16 pixels, can't obtain an integer units of video.To this, common processing method is that the size of RGB picture frame is adjusted, and the wide height that is about to the RGB picture frame extends to and can be divided exactly by 16 pixels.
Except the MPEG-2 video encoding standard, H.264 video encoding standard is also a kind of video encoding standard that is widely used.H.264 video image is also to do compression take the pixel size of 16*16 as unit, therefore if default video encoding standard is for H.264, also need the size of RGB picture frame is adjusted, method of adjustment is that the wide height with the RGB picture frame extends to and can be divided exactly by 16 pixels.
S104) according to default video encoding standard, the YUV picture frame is carried out Video coding and obtain video data.
Completing the RGB picture frame after the conversion of YUV picture frame, for specific video encoding standard, adopt the Video coding instrument of this standard, produce the encoded video streams that meets this video encoding standard regulation.If default video encoding standard is the MPEG-2 video encoding standard, adopt the MPEG-2 encoder that the YUV picture frame is carried out the MPEG-2 Video coding, obtain the MPEG-2 video flowing.
If default video encoding standard is video encoding standard H.264, can adopt H.264 that encoder carries out H.264 Video coding with the YUV picture frame, obtain H.264 video flowing.
S105) send described video data.
After front end will adopt coding standard to complete coding, the video data after coding is sent to terminal.
In the present embodiment, the video data that end-on is received is mainly completed video data decoding, conversion YUV picture frame is that RGB picture frame, the rgb value adjustment of RGB picture frame pixel and the transparent information of pixel obtain, and the image demonstration etc.
Shown in Figure 2, the below is described in detail the terminal processing method of the embodiment of the present invention.
S201) receiving front-end is according to step S105) video data that sends.
Terminal receives the video data that comprises the gif file dynamic image content that sends according to aforementioned front-end processing method.
S202) according to decoding standard corresponding to described video encoding standard, described video data is decoded and obtain the YUV picture frame.
After receiving video data, can adopt the chip that comprises decoder module to complete to video data decoding, namely adopt hard decoder.The advantage of hard decoder is exactly that efficient is high, and is low in energy consumption, and on the other side be soft decoding, namely carry out video data decoding with CPU.Carry out special processing by the picture frame with gif file, and adopt default video encoding standard to carry out Video coding to the picture frame after processing, make terminal to adopt hard decoder to this video data, reduced the taking of cpu resource, also avoided not enough due to cpu resource and can not the high frame per second of real-time decoding and the dynamic image that causes of large-size images gif file show discontinuous.
For different video encoding standards, having defined with it in standard, the decoding standard of correspondence is used for decode video data.Terminal can adopt the decoder module chip that comprises corresponding decoding standard, and the video data that receives is carried out hard decoder, obtains the YUV picture frame.For using MPEG-2 or the video data of coding standard coding H.264, use respectively and support the decoder module chip of MPEG-2 or H.264 decoding that the video data that receives is decoded.In fact, there has been at present multiple decoder module chip to support simultaneously MPEG-2 and H.264 decoding.
MPEG2 video encoding standard no matter, still video encoding standard H.264, they all belong to lossy coding, so the pixel value of the final video picture frame of decoding out has certain deviation, but this deviation user's naked eyes generally be can't see.
S203) the YUV picture frame is converted to the RGB picture frame.
After obtaining decoded YUV picture frame, the YUV color space conversion need to be returned the RGB color space, obtain the RGB picture frame.The method of conversion is S103) in the inverse process of conversion method.Here no longer describe in detail.
Similarly, during specific implementation, the YUV picture frame is converted to the RGB picture frame can calculates rgb value by different algorithms.For obtaining higher conversion efficiency, also can by pre-establishing conversion table, obtain rgb value corresponding to YUV value by YUV value query conversion table.
S204) obtain the transparent information of pixel according to the rgb value of described RGB picture frame pixel, and adjust the rgb value of pixel.
At front end, the rgb value of RGB picture frame has been carried out special processing, the method for processing is to need the rgb value of the pixel of all-transparent to be adjusted in the RGB picture frame (255,255,255); The rgb value that does not need transparent pixel is adjusted into (R/2, G/2, B/2), and because the numerical value span of rgb value is 0 to 255, the rgb value that therefore obtains is (R<128, G<128, B<128).
No matter adopt MPEG2 video encoding standard or video encoding standard H.264, they all belong to lossy coding, therefore out the go forward side by side rgb value of the RGB picture frame after the circumstances in which people get things ready for a trip color space conversion of video decode has certain deviation, the rgb value of one part of pixel point can appear between 128 and 255, rgb value namely occurs and be (128<R<255,128<G<255,128<B<255) situation.It is the buffering area of a very large pixel value difference between 128 and 255, be in the pixel of this buffering area for rgb value, a part may be for needing the pixel of all-transparent, a part may be for not needing transparent pixel, should get an integer value between 128 to 255 distinguishes the pixel that needs all-transparent and does not need transparent pixel as threshold value X, even the rgb value of pixel is (X<R<255, X<G<255, X<B<255), the transparent information of this pixel is all-transparent; For rgb value be (128<R<X, 128<G<X, the pixel of 128<B<X), the transparent information of this pixel is opaque.When specifically choosing threshold value, can adopt the method for getting median to divide the pixel of two kinds of transparencies, namely get and be in 192 in the middle of 128 and 255 as threshold value.
Whether terminal is to decide this image transparent according to a transparent channel when showing image, and transparent channel is generally 0 to 255,0 for entirely opaque, and 255 is all-transparent, and marginal numerical value is in various degree transparent.Because the transparency of gif file image only has all-transparent and complete opaque two kinds, therefore to obtain the transparent information of RGB picture frame pixel be that the transparent channel value only has two kinds to the rgb value by the RGB picture frame: 0 or 255.
According to above stated specification, obtained the transparent information of pixel by the rgb value of RGB picture frame pixel, and adjust the rgb value of pixel, concrete grammar is as follows:
If the rgb value of RGB picture frame pixel be (R〉X, G〉X, B〉X), the transparent information of this pixel is all-transparent, and namely the transparent channel value is 255, and no matter what value rgb value gets due to this pixel, all will be transparent for being shown as, therefore no longer rgb value is adjusted;
Otherwise, the transparent information of pixel is for entirely opaque, and adjust in such a way the rgb value of pixel: take advantage of respectively 2 to process three components of rgb value, the component value and 255 after taking advantage of 2 to process is compared, and the value of general smaller wherein after as the adjustment of respective component.Why to carry out such adjustment, be because, although front end will not need the rgb value of transparent pixel to be adjusted into (R/2, G/2, B/2), but due to above-mentioned encoding and decoding error, if direct value (R*2, G*2, B*2) adjust reduction, rgb value may appear greater than 255 situation.Because the span of rgb value is 0 to 255, therefore, if rgb value occurs greater than 255 situation in terminal, direct value 255, namely the transparent channel value is 0, the rgb value of adjusting pixel is (min(255, R*2), min(255, G*2), min(255, B*2)), wherein min(x, y) be " getting minimum " function, be also min(x, y) value be smaller in x and y.
Although MPEG2 or H.264 Video coding belong to lossy coding, brought the deviation of image rgb value in the Code And Decode process, but this deviation is within the specific limits, through after above-mentioned processing, make terminal can obtain according to the rgb value of RGB picture frame pixel the transparent information of pixel, and the reduction transparency is the rgb value of complete opaque pixel.
The rgb value of the pixel that S205) the RGB picture frame is comprised, the rgb value of display position background pixel point carry out ALPHA with the transparent information of RGB picture frame pixel to be mixed, and output display.
It is a kind of a kind of image processing techniques of mixing source pixel and object pixel that ALPHA mixes, and the image that picture frame is comprised, the background transparent information corresponding with image of display position carry out ALPHA and mix, and make the image generation transparent effect of demonstration.In the present embodiment, the rgb value of each pixel and the rgb value of this display position background pixel point have been comprised in the RGB picture frame, therefore rgb value that can be by pixel that the RGB picture frame is comprised, the rgb value of display position background pixel point carry out ALPHA with the transparent information of pixel and mix, and output display is with the gif file dynamic image of transparent effect.In specific implementation, can be carried out by the first floor system of set-top box the ALPHA mixed processing of image, and output on color television set or other display equipment and show.
With reference to shown in Figure 3, this figure is the front end processing device of the described gif file of the embodiment of the present application in digital television system.
301 pairs of gif files of gif file decoding unit are decoded, and obtain the transparent information of RGB picture frame and RGB picture frame pixel.The RGB picture frame that gif file decoding unit decodes gif file obtains comprising in video data block in gif file, and Graph Control extension blocks the image transparent logos and the Transparent color index that comprise.Image transparent logos and Transparent color index have represented the transparent information of RGB picture frame pixel jointly.
Rgb value adjustment unit 302 is adjusted the rgb value of pixel according to the transparent information of RGB picture frame pixel, wherein, the rgb value after adjustment is used for pixel corresponding to reflection and whether needs to carry out transparent processing.The concrete method of adjusting of rgb value adjustment unit is as follows: if the transparent information of RGB picture frame pixel is transparent, namely the image transparent logos is 1, and the rgb value of this picture frame is adjusted into (255,255,255); Otherwise, the rgb value of this pixel is adjusted into (R/2, G/2, B/2).
RGB to YUV converting unit 303 is converted to the YUV picture frame with the RGB picture frame of rgb value adjustment unit output.RGB to YUV converting unit realizes according to the conversion formula of standard definition, during specific implementation, can be calculated by different algorithms the YUV value, and perhaps the conversion table by pre-establishing, look into conversion table by rgb value and obtain realizing for the YUV value.In the RGB picture frame was converted to the process of YUV picture frame, RGB to YUV converting unit also needed to control YUV picture frame number of repetition according to the delay time of RGB picture frame, made the variation of the YUV picture frame picture after conversion have better continuity.
Before the RGB picture frame is converted to the YUV picture frame, may also need according to video encoding standard, the size of the RGB picture frame before changing to be adjusted, to facilitate Video coding, therefore, further increase RGB frame sign adjustment unit, be used for according to default video encoding standard, the size of the RGB picture frame of rgb value adjustment unit output being adjusted.If default video encoding standard is MPEG-2, RGB frame sign adjustment unit extends to the wide height of RGB picture frame can be divided exactly by 16 pixels.If use H.264 video encoding standard, according to the characteristics of compression H.264, RGB frame sign adjustment unit method of adjustment is also that the wide height with the RGB picture frame extends to and can be divided exactly by 16 pixels.
Video encoding unit 304 carries out Video coding according to default video encoding standard to the YUV picture frame and obtains video data.Video encoding unit can adopt specific Video coding instrument, produces the encoding stream that meets this video encoding standard regulation.For the MPEG-2 video encoding standard, adopt the MPEG-2 encoder that the YUV picture frame is carried out the MPEG-2 Video coding, obtain the MPEG-2 video flowing.In like manner, for video encoding standard H.264, can adopt H.264 that encoder carries out H.264 Video coding with the YUV picture frame, obtain H.264 video flowing.
Structured video data transmitting unit 305 sends the video data after video encoding unit is encoded according to video encoding standard, so that terminal receives.
In the present embodiment, the terminal of digital television system can be digital TV set-top box.Digital TV set-top box is a kind of conversion equipment that digital television signal is converted to analog signal, is to make the user watch digital television program and digital TV in high resolution program with original simulated television.
Shown in Figure 4, this figure is the terminal processing device of the described gif file of the embodiment of the present application in digital television system.
The video data that video data receiving element 401 receiving front-end processing unit send is sent the video data that receives into video decoding unit 402.
Video decoding unit 402 is decoded to video data according to decoding standard corresponding to video data encoding standard and is obtained the YUV picture frame.In specific implementation, video decoding unit can be for comprising the chip of decoder module.Because front end has carried out special processing to the picture frame of gif file, and adopt video encoding standard to carry out Video coding to the picture frame after processing, make terminal to carry out hard decoder to this video data by video decoding unit, avoided using CPU that gif file decoded and bring to the taking of cpu resource, and cause when the cpu resource deficiency can not real-time decoding and the picture that occurs is discontinuous.For using MPEG-2 and the coding standard video data of encoding H.264, terminal can adopt the decoder module chip that comprises corresponding decoding standard, and the video data that receives is carried out hard decoder, obtains the YUV picture frame.In fact, there has been at present multiple decoder module chip to support simultaneously MPEG-2 and H.264 decoding.
The YUV picture frame that 403 pairs of decodings of YUV to RGB converting unit obtain is afterwards changed, and is converted to the RGB picture frame by the YUV picture frame.During specific implementation, YUV to RGB converting unit can be calculated rgb value by different algorithms, perhaps by pre-establishing conversion table, obtains rgb value by looking into conversion table.
Transparent information obtains and rgb value adjustment unit 404 is exported the RGB picture frame according to YUV to RGB converting unit, obtains the transparent information of pixel from the rgb value of RGB picture frame pixel, and adjusts the rgb value of pixel, specifically is used for:
If the rgb value of described RGB picture frame pixel be (R〉X, G〉X, B〉X), the transparent information of this pixel is all-transparent, X for the difference transparent and opaque threshold value, value is an integer value between 128 to 255;
Otherwise, the transparent information of pixel is for entirely opaque, and adjust in the following manner the rgb value of pixel: take advantage of respectively 2 to process three components of rgb value, the component value and 255 after taking advantage of 2 to process is compared, and the value of general smaller wherein after as the adjustment of respective component.
After obtaining the RGB picture frame, rgb value due to the rgb value that has comprised each pixel in the RGB picture frame and this display position background pixel point, therefore the rgb value that mixes rgb value, the display position background pixel point of the pixel that output display unit 405 comprises the RGB picture frame carries out ALPHA with the transparent information of RGB picture frame pixel to be mixed, and output display.Mixing output display unit can comprise the first floor system module of digital TV set-top box, this module is completed the RGB picture frame, background image mixes with the ALPHA of the transparent information of RGB picture frame pixel, obtain the image with transparent effect, and output display, present to the user with the dynamic image of the gif file of transparent effect.
Above processing method and the device of a kind of gif file provided by the present invention in digital television system is described in detail, used specific case herein principle of the present invention and execution mode are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications.In sum, this description should not be construed as limitation of the present invention.

Claims (2)

1. the terminal processing method of a gif file in digital television system, is characterized in that, comprising:
Receiving video data, described video data are to process in the following manner to obtain:
The graphic interchange format gif file is decoded, obtain the transparent information of RGB picture frame and RGB picture frame pixel;
Adjust the rgb value of pixel according to the transparent information of described RGB picture frame pixel, wherein, rgb value after adjustment is used for pixel corresponding to reflection and whether needs to carry out transparent processing, specifically comprise: if the transparent information of RGB picture frame pixel is transparent, the rgb value of this pixel is adjusted into (255,255,255); Otherwise, the rgb value of this pixel is adjusted into (R/2, G/2, B/2);
The RGB picture frame that will carry out after the rgb value adjustment is converted to the YUV picture frame;
According to default video encoding standard, the YUV picture frame is carried out Video coding and obtain video data;
According to decoding standard corresponding to described video encoding standard, described video data is decoded and obtain the YUV picture frame;
The YUV picture frame is converted to the RGB picture frame;
obtain the transparent information of pixel according to the rgb value of described RGB picture frame pixel, and the rgb value of adjustment pixel, specifically comprise: if the rgb value of described RGB picture frame pixel is (R>X, G>X, B>X), the transparent information of this pixel is all-transparent, X is the transparent and opaque threshold value of difference, value is an integer value between 128 to 255, otherwise, the transparent information of pixel is for entirely opaque, and adjust in such a way the rgb value of pixel: take advantage of respectively 2 to process three components of rgb value, component value and 255 after taking advantage of 2 to process is compared, and the value of smaller that will be wherein after as the adjustment of respective component,
The rgb value of the pixel that described RGB picture frame is comprised, the rgb value of display position background pixel point carry out ALPHA with the transparent information of RGB picture frame pixel and mix, and output display.
2. the terminal processing device of a gif file in digital television system, is characterized in that, comprising:
The video data receiving element is used for receiving video data, and described video data is processed in the following manner and obtained: the graphic interchange format gif file is decoded, obtain the transparent information of RGB picture frame and RGB picture frame pixel;
Adjust the rgb value of pixel according to the transparent information of described RGB picture frame pixel, wherein, rgb value after adjustment is used for pixel corresponding to reflection and whether needs to carry out transparent processing, specifically comprise: if the transparent information of RGB picture frame pixel is transparent, the rgb value of this pixel is adjusted into (255,255,255); Otherwise, the rgb value of this pixel is adjusted into (R/2, G/2, B/2);
The RGB picture frame that will carry out after the rgb value adjustment is converted to the YUV picture frame;
According to default video encoding standard, the YUV picture frame is carried out Video coding and obtain video data;
Video decoding unit, being used for decodes to video data according to decoding standard corresponding to video data encoding standard obtains the YUV picture frame;
YUV to RGB converting unit is used for the YUV picture frame is converted to the RGB picture frame;
Transparent information obtains and the rgb value adjustment unit, obtains the transparent information of pixel according to the rgb value of described RGB picture frame pixel, and adjusts the rgb value of pixel, specifically is used for:
If the rgb value of described RGB picture frame pixel is (R>X, G>X, B>X), the transparent information of this pixel is all-transparent, X is the transparent and opaque threshold value of difference, value is an integer value between 128 to 255, otherwise, the transparent information of pixel is for entirely opaque, and adjust in such a way the rgb value of pixel: take advantage of respectively 2 to process three components of rgb value, component value and 255 after taking advantage of 2 to process is compared, and the value of general smaller wherein after as the adjustment of respective component; Mix the output display unit, the rgb value that is used for rgb value, the display position background pixel point of pixel that described RGB picture frame is comprised carries out ALPHA with the transparent information of RGB picture frame pixel to be mixed, and output display.
CN 201110175348 2011-06-27 2011-06-27 Graphics interchange format (GIF) file processing method and device for digital television system Active CN102231836B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN 201110175348 CN102231836B (en) 2011-06-27 2011-06-27 Graphics interchange format (GIF) file processing method and device for digital television system
HK12103366.6A HK1162799A1 (en) 2011-06-27 2012-04-05 A processing method and device for gif files in a digital television system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110175348 CN102231836B (en) 2011-06-27 2011-06-27 Graphics interchange format (GIF) file processing method and device for digital television system

Publications (2)

Publication Number Publication Date
CN102231836A CN102231836A (en) 2011-11-02
CN102231836B true CN102231836B (en) 2013-06-26

Family

ID=44844361

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110175348 Active CN102231836B (en) 2011-06-27 2011-06-27 Graphics interchange format (GIF) file processing method and device for digital television system

Country Status (2)

Country Link
CN (1) CN102231836B (en)
HK (1) HK1162799A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102364441B (en) * 2011-10-24 2017-12-05 中兴通讯股份有限公司 The display methods of GIF pictures, apparatus and system
CN109151503B (en) * 2017-04-08 2022-03-15 腾讯科技(深圳)有限公司 Picture file processing method and equipment
CN110213504B (en) * 2018-04-12 2021-10-08 腾讯科技(深圳)有限公司 Video processing method, information sending method and related equipment
CN112689197B (en) * 2019-10-18 2022-07-08 腾讯科技(深圳)有限公司 File format conversion method and device and computer storage medium
CN111603771B (en) * 2020-05-22 2023-06-23 腾讯科技(深圳)有限公司 Animation generation method, device, equipment and medium
CN114928730B (en) * 2022-06-23 2023-08-22 湖南国科微电子股份有限公司 Image processing method and image processing apparatus
CN116596736B (en) * 2023-06-01 2024-03-22 中建三局信息科技有限公司 Hidden watermark generation method, device and equipment of webpage system and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101742317A (en) * 2009-12-31 2010-06-16 北京中科大洋科技发展股份有限公司 Video compressing and encoding method with alpha transparent channel
CN101945273A (en) * 2009-07-01 2011-01-12 雅马哈株式会社 Compression-encoding device and Visual Display control device
CN102036059A (en) * 2009-09-25 2011-04-27 腾讯科技(深圳)有限公司 Method, device and system for compressing and decompressing transparent images
CN102103463A (en) * 2011-02-17 2011-06-22 杭州华三通信技术有限公司 Processing method and equipment of user interface information with transparency

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8189908B2 (en) * 2005-09-02 2012-05-29 Adobe Systems, Inc. System and method for compressing video data and alpha channel data using a single stream

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101945273A (en) * 2009-07-01 2011-01-12 雅马哈株式会社 Compression-encoding device and Visual Display control device
CN102036059A (en) * 2009-09-25 2011-04-27 腾讯科技(深圳)有限公司 Method, device and system for compressing and decompressing transparent images
CN101742317A (en) * 2009-12-31 2010-06-16 北京中科大洋科技发展股份有限公司 Video compressing and encoding method with alpha transparent channel
CN102103463A (en) * 2011-02-17 2011-06-22 杭州华三通信技术有限公司 Processing method and equipment of user interface information with transparency

Also Published As

Publication number Publication date
CN102231836A (en) 2011-11-02
HK1162799A1 (en) 2012-08-31

Similar Documents

Publication Publication Date Title
CN102231836B (en) Graphics interchange format (GIF) file processing method and device for digital television system
JP6808725B2 (en) Improved color remapping information Supplemental enhancement information Message processing
AU2016212243B2 (en) A method and apparatus of encoding and decoding a color picture
US10511803B2 (en) Video signal transmission method and device
EP3341918B1 (en) Coding and decoding method and corresponding devices
KR102523233B1 (en) Method and device for decoding a color picture
CN102761738A (en) Image compression method and device on basis of mixed chromaticity sampling rate
EP3586503B1 (en) Method and device for reconstructing an hdr image
US20200193573A1 (en) Method and device for color gamut mapping
WO2020135357A1 (en) Data compression method and apparatus, and data encoding/decoding method and apparatus
CN102497388A (en) Mobile network terminal and method for wireless screen content transmission between such terminal and TV
US20190130546A1 (en) Method and device for obtaining a second image from a first image when the dynamic range of the luminance of said first image is greater than the dynamic range of the luminance of said second image
CN110234010B (en) Video encoding method/apparatus and video decoding method/apparatus
EP3562165B1 (en) Custom data indicating nominal range of samples of media content
CN102231834A (en) Animated portable network graphics (APNG) file processing method and device for digital television system
CN110719484B (en) Image processing method
CN114827620A (en) Image processing method, apparatus, device and medium
US20180014024A1 (en) Method and apparatus of encoding and decoding a color picture
CN113450293A (en) Video information processing method, device and system, electronic equipment and storage medium
CN103237225A (en) Method for correcting video encoding and decoding errors through utilizing luma and chroma (YUV) and red, green and blue (RGB) space union
CN102075750B (en) Method, device and system for encoding and decoding videos of red green and blue (RGB) space
CN116489132A (en) Virtual desktop data transmission method, server, client and storage medium
CN117956172A (en) Video transmission display method and system
CN115460413A (en) Method for solving multiple displays of high-bit-rate video

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 1162799

Country of ref document: HK

C14 Grant of patent or utility model
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: GR

Ref document number: 1162799

Country of ref document: HK