Method key color being shown based on user interface
[technical field]
The present invention relates to video processing technique, relate in particular to a kind of method key color being shown based on user interface.
[background technology]
TV BOX(intelligent television box) built-in android(Android) operating system, video playback adopts Overlay(to cover) pattern shows, video data shows on Overlay layer; Data cached frame buffer layer (the Frame Buffer that be finally presented at that user interface UI is corresponding, be called for short FB) on, FB layer covers Overlay layer top, and user interface data is in (above the data of the dialog box user interface with advancing, retreat with Pause key at video) above video data.The key color (Color Key) of the display screen LCD pixel of general intelligence TV box is to be set to black, be that black (0x0000) is as crossing colour filter, when intelligent television box displaying video, FB is set to black, and the user interface UI of simultaneous display is designed to non-black, by the mechanism of Overlay pattern, user can see video and be superimposed upon the user interface UI data on video.The overhead of simultaneous display user interface in video display process has been simplified in this design greatly, but the problem of thereupon bringing is user interface UI can not there is black region, because black region can be considered to key color region, thereby by video playback interface, extremely seen through, the data that are filtered such user interface just show not out.For example: in video display process, when user operates video, TV box can eject the dialog box (as shown in Figure 1) with user interactions, and it is black that dialog box has subregion, and now this black is when not also being set to key color; As shown in Figure 2, when black being set being key color, the user interface data of black region just cannot normally show so, is used as colour filter; Can only see video data, user just cannot operate in user interface like this.
A kind of " carrying out processing method and the processing unit of image blend " is provided in prior art, and publication number is: CN102281381A; Within open day, be: the Chinese patent of 2011.12.14, its processing method comprises: by user interface, select the colour of predetermined color of the first picture format as key color colour; By described key color colour, calculate the colour of described predetermined color in the second picture format, as key color conversion value; According to described key color conversion value, obtain key color region and non-key look region in the figure layer of the second picture format, default image blend computing is carried out in described key color region, obtain the result in described key color region, and described result and described non-key look region are superimposed upon on the figure layer of the first picture format, obtain image blend result.When this invention is processed in the same color to different-format, the trouble of the colour of can avoiding converting, improves treatment effeciency.But this invention can show the key color of its user interface after the color in the key color region of user interface being processed yet, but can not block the video data of bottom.
[summary of the invention]
The technical problem to be solved in the present invention, is to provide a kind of method key color being shown based on user interface.
The present invention is achieved in that a kind of method key color being shown based on user interface, comprises the steps:
Step 10, TV box are when video broadcasting condition, and the video data in the user interface data in media player and Overlay pattern need mix; When the black region in user interface need to be seen through by the video data in Overlay pattern, each pixel ARGB value of this black region is set to black level value, and the Alpha value in each pixel ARGB of black region is also set to 0 simultaneously; When the black region in user interface sees through without the video data by Overlay pattern, each pixel ARGB value of this black region is set to black level value, and the Alpha value in each pixel ARGB of black region is set to non-zero simultaneously;
Each pixel of the image of the CPU pointwise traversal user interface of step 20, TV box, judges whether the Alpha value in each pixel ARGB equals 0; Be, do not operate, flow process finishes; No, enter step 30;
The image data format that the frame buffer layer of step 30, judgement TV box is supported is RGB888 or RGB565, is RGB888 form, and the B component value of the point that is 0 by the B component of all image slices vegetarian refreshments of the user interface in frame buffer layer is all set to 1; Be RGB565 form, the B component value that the B component of all image slices vegetarian refreshments of the user interface in frame buffer layer is less than to 8 point is all set to 8, thereby the black region at completing user interface also can show on video playback interface.
Further, between step 10 and step 20, further comprising: the video of step 11, TV box is when broadcast state, the view data of user interface is stored in a buffer area, when user carries out vision operation, on video, eject user interface, now by the image data transmission of user interface to frame buffer this layer.
Tool of the present invention has the following advantages: whether the present invention needs to show according to the black region in user interface, each pixel ARGB value and the Alpha value of black region is set; Each pixel of the image of the CPU pointwise traversal user interface of TV box, the Alpha value of finding out in each pixel ARGB is not equal to 0 point; The form of supporting according to frame buffer layer, the B component of image slices vegetarian refreshments is processed, thereby the black region at completing user interface also can show on video image simultaneously.When the present invention has realized video playback, when the black region of part appears in user interface, can not be filtered, can show, improve user's experience.
[accompanying drawing explanation]
Fig. 1 be when in prior art, black is not set to key color in TV box Overlay layer and FB layer show the schematic diagram of data.
Fig. 2 be when in prior art, black is set to key color in TV box Overlay layer and FB layer show the schematic diagram of data.
Fig. 3 is schematic flow sheet of the present invention.
[embodiment]
Refer to shown in Fig. 1, method key color being shown based on user interface, comprises the steps:
Step 10, TV box are when video broadcasting condition, and the video data in the user interface data in media player and Overlay pattern need mix; When the black region in user interface need to be seen through by the video data in Overlay pattern, it is RGB=0 that each pixel ARGB value of this black region is set to black level value, and the Alpha value in each pixel ARGB of black region is also set to 0 simultaneously; When the black region in user interface sees through without the video data by Overlay pattern, each pixel ARGB value of this black region is set to black level value, and the Alpha value in each pixel ARGB of black region is set to non-zero simultaneously;
The video of step 11, TV box is when broadcast state, and the view data of user interface is stored in a buffer area, when user carries out vision operation, ejects user interface on video, now by the image data transmission of user interface to frame buffer this layer;
Each pixel of the image of the CPU pointwise traversal user interface of step 20, TV box, judges whether the Alpha value in each pixel ARGB equals 0; Be, do not operate, flow process finishes; No, enter step 30;
The image data format that the frame buffer layer of step 30, judgement TV box is supported is RGB888 or RGB565, is RGB888 form, and the B component value of the point that is 0 by the B component of all image slices vegetarian refreshments of the user interface in frame buffer layer is all set to 1; It is RGB565 form, the B component value that the B component of all image slices vegetarian refreshments of the user interface in frame buffer layer is less than to 8 point is all set to 8, being set to 8 way can avoid being converted in RGB565 process because of ARGB, low 3 of B component is truncated and causes pixel value to revise invalid problem, guarantees that the black region of UI normally shows.Thereby the black region at completing user interface also can show on video playback interface.
The present invention is further illustrated in conjunction with the embodiments with reference to the accompanying drawings.
For example: the video of TV box is when broadcast state, when user carries out vision operation, on video, eject user interface, now to process and make its each pixel point value become (ARGB is 0x00000008) the black region of the user interface of FB layer (ARGB is 0xff000000), and then carry out ARGB(32bits) to RGB565(16bits) conversion, low three of the B component of each pixel RGB are cut out like this, the color value of each pixel that finally the FB layer (RGB565) of output is corresponding is 0x01, close to black, human eye is difficult for differentiating.So the data of user interface can not exist the problem of black region to solve.
The foregoing is only preferred embodiment of the present invention, all equalizations of doing according to the present patent application the scope of the claims change and modify, and all should belong to covering scope of the present invention.