Embodiment
For the purpose, technical scheme and the advantage that make embodiment of the present invention is clearer, embodiments of the present invention are described in further detail below in conjunction with accompanying drawing.
First embodiment of the invention relates to a kind of color space changover method, is used for first color space is converted to second color space, and wherein, first color space is YC
RC
BColor space, second color space is a rgb color space, the value of each color component can be through extension or without the value of upholding.
Following elder generation describes the theoretical foundation of present embodiment.In the prior art, can realize YC according to formula (2) or formula (3)
RC
BColor space is done some conversion to (2) and formula (3) in the present embodiment to the conversion of rgb color space, and to obtain the color space conversion formula of present embodiment, change procedure is described below:
At first, formula (2) or (3) are expressed as
Wherein, the y (n) in the formula (5) is set { R, G, n element among the B}, n=1,2,3 (corresponding R, G, B).
x
k(n) be input variable set { Y, the C of corresponding y (n)
R, C
BIn k element, k=1,2,3 (corresponding Y, C
R, C
B).
A
kBe k weight factor of input variable, it is a constant.
Then, with x
k(n) be expressed as binary form, it expresses as the formula (6) (because the derivation here relates to n, n can be omitted), wherein, and x
KbBe x under the binary form
k(n) bit of b position in, its value only are 0 or 1.
Derivation afterwards no longer needs markers n.Formula (6) substitution (5) is obtained:
By formula (7) as can be seen
Be 3 input variable x
k(Y, C
R, C
B) b bit and constant A
kAll bit step-by-steps with the operation after do the arithmetic add operation.This shows that formula (7) can be constructed by the computing of a non-multiplication structure.Specifically, can precompute x
KbVarious combination gained and the value, be stored in random access memory (Random Access Memory, be called for short " RAM ") or read-only memory (Read Only Memory, be called for short " ROM ") in, or by combinational logic realization table lookup function, table look-at draws the calculated product sum during calculating, does then and value adds up.Whole thus calculating operation is for to be made of addition and shifting function.
Formula (7) can further be transformed to,
Thus, when realizing, reduces by hardware the needed adder of additive constant C than formula (7), in the formula (8)
Can precompute, because the human eye resolution capability allows certain error, present embodiment constitutes look-up table with the floating point result fixed point that precomputes, and guarantees to realize that error only for ± 1, improves the precision of conversion.
Below the flow path switch of realizing according to formula (8) is specifically described, in this flow process, YC
RC
BEach color component of color space is divided into M fragment, and each fragment comprises a bit, comprises following key step:
(1) respectively with YC
RC
BThe synthetic slice groups of the slice groups of correspondence position obtains M slice groups altogether in each color component of color space;
(2) table look-up according to the value of each slice groups respectively, obtain M group checking result altogether, comprise 3 values in every group of checking result, correspond respectively to 3 color components of rgb color space;
(3) according to the fragment in each slice groups at YC
RC
BPosition in the color space color component is shifted respectively to 3 values in the checking result of this slice groups;
(4) will obtain 3 transformation results corresponding to the value addition of the same color component of rgb color space in the M of shifting processing group checking result, correspond respectively to 3 color components of rgb color space.
In order to accelerate conversion speed, reduce shifting function, in the present embodiment 4 steps of above-mentioned steps are overlapped and carry out, be about to import, table look-up, be shifted overlap and carry out, as shown in Figure 2 with add operation mutually.
Specifically, at first respectively with YC
RC
BThe slice groups of correspondence position obtains M slice groups altogether as a slice groups in each color component of color space, and M can be YC in the present embodiment
RC
BThe bit number of each color component of color space, each fragment only comprises 1 bit like this.Below with YC
RC
BEach color component of color space all is that 8 bits are that example is specifically described.
Because YC in the present embodiment
RC
BEach color component of color space is 8 bits, and can establish the Y component is a
0a
1a
2a
3a
4a
5a
6a
7, C
RComponent is b
0b
1b
2b
3b
4b
5b
6b
7, C
BComponent is c
0c
1c
2c
3c
4c
5c
6c
7, respectively with Y component, C
RComponent, C
BThe fragment a of correspondence position in the component
0, b
0, c
0a
1, b
1, c
1... a
7, b
7, c
7Be combined into a slice groups, obtain 8 slice groups altogether.Y, C in the present embodiment
R, C
BThree components are the serial input, and as shown in Figure 3, in the process of serial input, bit of three every inputs of component can be formed a slice groups.
In step 201,, import Y, C successively respectively according to the order of big-endian
R, C
BA bit of component is formed a slice groups.Input is highest order (the 7th 's) bit first.
Then, enter step 202, table look-up, obtain one group of checking result, comprise 3 values in this checking result, correspond respectively to 3 color components of rgb color space according to the value of the slice groups of being imported in the step 201.
Wherein, this look-up table comprises slice groups 8 (2
3) plant possible values and multiply each other again and constant with coefficient matrix earlier
The result of addition promptly calculates all possible
Its result is stored in the look-up table.Because look-up table is to calculate in advance, when calculating in advance, can use very high precision, realize and the loss of significance of introducing so in transformation flow, removed floating point multiplication addition calculating fixed point, obtained higher precision property.Only comprise a look-up table in the present embodiment, as shown in Figure 3,8 slice groups that each component serial input back forms are searched this table successively according to the priority of input.
Then, enter step 203, with 3 values in the checking result of this slice groups (being the checking result of epicycle) respectively with 3 value additions of last round of displacement back (step 205), obtain the end value after 3 additions of epicycle.First slice groups (is a
7b
7c
7) checking result 3 values respectively with 0 addition.
Then, enter step 204, judge whether input finishes, and whether the slice groups of promptly current participation addition is last slice groups, if then enter step 206, with the output of the end value after 3 additions of epicycle, as 3 components of rgb color space; Otherwise then enter step 205.
In step 205, the end value after 3 additions of epicycle is shifted respectively, move to left one respectively.Then enter step 201, carry out input, finding, addition and the displacement of next round, 3 end values that obtain after the displacement of the step 205 of epicycle participate in the addition step (step 203) of next rounds, promptly with the lookup result of next round in 3 value additions respectively.
Such as, import YC first
RC
BThe 7th bit a of 3 components of color space
7, b
7And c
7, form a slice groups a
7b
7c
7, to table look-up according to the value of this slice groups, the checking result that obtains comprises 3 value Y
7, C
R7And C
B7, because input first, these 3 values can only be respectively and 0 addition, because input finishes, so the result after the addition moves to left 1; Then carry out the input of next round, input YC
RC
BThe 6th bit a of 3 components of color space
6, b
6And c
6, form a slice groups a
6b
6c
6, to table look-up according to the value of this slice groups, the checking result that obtains comprises 3 value Y
6, C
R6And C
B6, with these 3 values respectively with move to left after Y
7, C
R7And C
B7Addition obtains 3 end values, because input does not finish, therefore respectively these 3 end values is moved to left 1, and carries out input, finding, addition and the displacement of next round; Next round input YC
RC
BThe 5th bit a of 3 components of color space
5, b
5And c
5, form a slice groups a
5b
5c
5, to table look-up according to the value of this slice groups, the checking result that obtains comprises 3 value Y
5, C
R5And C
B5, (3 end values after these 3 values are moved to left with previous round respectively promptly move to left 2 Y
7With move to left 1 Y
6And, 2 C moves to left
R7With move to left 1 C
R6And, 2 C moves to left
B7With move to left 1 C
B6And) addition, obtain 3 end values, same therefore respectively these 3 end values moved to left 1, and carry out input, finding, addition and the displacement of next round because input finishes, up to importing last bit respectively, form slice groups a
0b
0c
0, with slice groups a
0b
0c
0Checking result Y
5, C
R5And C
B5With last round of 3 shift result values addition, the result who obtains is as 3 components of rgb color space.
In the present embodiment, can also the result of step 206 output be rounded off, finally obtain the transformation result of 3 color components of rgb color space.The span of each component of RGB all is 0~255, and 3 transformation results that addition is obtained round off and are: the result that addition is obtained judges that if greater than 255, then value 255; If less than 0, then value 0.
As seen, required matrix multiplication when present embodiment has realized the color space conversion by adopting look-up table and adder to substitute multiplier, because look-up table and adder chip area when realizing is less, thereby can reduce the big problem of chip area that the use because of multiplier causes effectively, reduce computation complexity and reduced power consumption.
And present embodiment is undertaken by addition and displacement are overlapped, and can significantly reduce the number of times of displacement, reduces the energy consumption of equipment and changes the required time.With above-mentioned YC
RC
BEach color component of color space all is that 8 bits are example, if earlier according to the fragment in each slice groups at YC
RC
BPosition in the color space color component is shifted respectively to 3 values in the checking result of this slice groups, the results added after will being shifted again, and then for the component of 8 bit lengths, a
7b
7c
7Corresponding checking result Y
7, C
R7, C
B7Need move to left respectively 7 times; a
6b
6c
6Corresponding checking result Y
6, C
R6, C
B6Need move to left respectively 6 times; Y
5, C
R5, C
B5Need move to left respectively 5 times; ..., 1 the operation of need carrying out altogether moving to left for 63 times, and in the present embodiment, by addition and displacement overlapping are carried out, 1 the operation of only need carrying out altogether moving to left for 21 times, when reducing chip area, reducing computation complexity, significantly reduce the number of times of displacement, reduce the energy consumption of equipment and change the required time.
Among Fig. 3, only need one 3 input look-up table (LUT), 3 adders and 3 shift units can realize YC
RC
BThe conversion of color space and rgb color space, be applicable to area requirements little, in the not high application of rate request.The shortcoming that adopts the input of 1 Bits Serial is to need the number of times of more execution cycle and addition still more, and power consumption is still bigger, for example at Y, C
R, C
BBe under the situation of 8 bits, need 8 clock cycle inputs to table look-up, obtain 8 groups of checking result (every group of lookup result comprises 3 values of corresponding 3 components), each component all needs 7 displacement additions can obtain final value.
Present embodiment is with YC
RC
BIt is example that each color component of color space is 8 bits, to YC
RC
BThe transfer process of color space and rgb color space is illustrated, and in actual applications, each color component also can be other length, and as 16 bits, no matter how many bit lengths is, all can realize conversion by present embodiment.
Second embodiment of the invention relates to a kind of color space changover method, the difference of the present embodiment and first execution mode is, in the first embodiment, and to each slice groups serial process, each slice groups is looked into same table successively, summation again after checking result is shifted; Because serial process only needs a look-up table, implements the simplest.And in the present embodiment, to each slice groups parallel processing, different slice groups is looked into different tables, checking result is sued for peace again; Parallel processing makes can finish conversion in a clock cycle, obtain higher throughput.
In the present embodiment, first color space of changing is YC equally
RC
BSpace, second color space are rgb space equally, and two each color components of color space all are 8 bits, and two color spaces all have 3 color components.In the present embodiment, YC
RC
BEach color component of color space is divided into 4 fragments, 2 bits of each fragment bag.
Following elder generation describes the theoretical foundation of present embodiment.Need in the present embodiment formula (8) is carried out conversion, obtain:
X in the formula (9)
Kbx
K (b+1)B position and b+1 bit for input variable.
The concrete flow path switch of realizing according to formula (9) as shown in Figure 4.In step 401, respectively with YC
RC
BThe synthetic slice groups of the slice groups of correspondence position obtains 4 slice groups altogether in each color component of color space.
Specifically, first fragment is the 0th and the 1st of color component, by YC
RC
BThe slice groups 1 that first fragment is formed in each color component of color space comprises Y component, C
RComponent, C
BThe the 0th and the 1st of component (be called for short Y[1:0], C
R[1:0], C
B[1:0]); Second fragment is the 2nd and the 3rd of color component, by YC
RC
BThe slice groups 2 that second fragment is formed in each color component of color space comprises Y component, C
RComponent, C
BThe the 2nd and the 3rd of component (be called for short Y[3:2], C
R[3:2], C
B[3:2]); The 3rd fragment is the 4th and the 5th of color component, by YC
RC
BThe slice groups 3 that the 3rd fragment is formed in each color component of color space comprises Y component, C
RComponent, C
BThe the 4th and the 5th of component (be called for short Y[5:4], C
R[5:4], C
B[5:4]); The 4th fragment is the 6th and the 7th of color component, by YC
RC
BThe slice groups 4 that the 3rd fragment is formed in each color component of color space comprises Y component, C
RComponent, C
BThe the 6th and the 7th of component (be called for short Y[7:6], C
R[7:6], C
B[7:6]), as shown in Figure 5.
In step 402,4 slice groups use 4 different look-up tables to carry out table lookup operation respectively, obtain 4 groups of checking result, comprise 3 values in every group of checking result, correspond respectively to 3 color components of rgb color space.
Specifically, slice groups 1 is used first look-up table that is output as 5 bits; Slice groups 2 is used the second look-up table that is output as 7 bits; Slice groups 3 is used the 3rd look-up table that is output as 9 bits; Slice groups 4 is used the 4th look-up table that is output as 11 bits, as shown in Figure 5.
The output valve of searching item corresponding to the individual color component of rgb color space L (L is 1 or 2 or 3) in N look-up table (N is 1,2,3,4) is
X wherein
Kbx
K (b+1)Be YC
RC
BColor space k (k is 1 or 2 or 3) individual color component b and b+1 bit, A
kWith C is to change the constant that relates to.
Respectively each look-up table is described below.
The structure of the first look-up table LUT1 as shown in Figure 6.
LUT1 is input as YC
RC
BY component, C in the color space
RComponent and C
BThe the 1st and the 0th bit of component, obtain checking result lut_r0_0[4:0 by three sub-look-up tables that are respectively 16X5 bit, 64X5 bit and 16X5 bit], lut_g0_o[4:0], lut_b0_o[4:0], as the output of R, G, B result's the 0th component.
According in formula (2) or (3) with Y, C
R, C
BThe matrix parameter that component multiplies each other can be found out, comprises 20 elements in this matrix parameter, thereby in three sub-look-up tables, a sub-look-up table can need not to import C
RThe the 1st and the 0th bit of component (is called for short C
R[1:0]), only according to Y[1:0] and C
B[1:0] obtains checking result; A sub-look-up table (the sub-look-up table of 16X5 bit) can need not to import C
B[1:0] is only according to Y[1:0] and C
R[1:0] obtains checking result.Above-mentioned two sub-look-up tables are owing to have only two inputs (4 bit), thereby comprise 16 possible results (being the sub-look-up table of 16X5 bit); Another sub-look-up table is owing to exist three inputs (6 bit), thereby comprises 64 possible results (being the sub-look-up table of 64X5 bit).The output of above-mentioned 3 sub-look-up tables is 5 bits.
Being calculated as follows of each list item in the sub-look-up table (being possible result).
Y, C in input
R, C
BComponent is without under the situation about upholding, i.e. Y, C
R, C
BSpan do not uphold under 0~255 the situation from 16~240, can obtain list item calculating formula (10), (11) and (12) of each sub-look-up table among the LUT1 by formula (2) and formula (9):
And the Y, the C that import
R, C
BThe span of component is upheld under 0~255 the situation, can be obtained list item calculating formula (13), (14) and (15) of each sub-look-up table of LUT1 by formula (3) and formula (9):
According to computing needs (only needing 5 bits to participate in computing), formula (10) is only got low 5 to the result of formula (15).
The structure of second look-up table LUT2 as shown in Figure 7.
LUT2 is input as YC
RC
BY component, C in the color space
RComponent and C
BThe the 3rd and the 2nd bit of component, obtain checking result lut_r1_0[6:0 by three sub-look-up tables that are respectively 16X7 bit, 64X7 bit and 16X7 bit], lut_g1_o[6:0], lut_b1_o[6:0], as the output of R, G, B result's the 1st component.
Equally, in above-mentioned three sub-look-up tables, a sub-look-up table (the sub-look-up table of 16X7 bit) can need not to import C
R[3:2]), only according to Y[3:2] and C
B[3:2] obtains checking result; A sub-look-up table can need not to import C
B[3:2] is only according to Y[3:2] and C
R[3:2] obtains checking result.Above-mentioned two sub-look-up tables are owing to have only two inputs (4 bit), thereby comprise 16 possible results (being the sub-look-up table of 16X7 bit); Another sub-look-up table is owing to exist three inputs (6 bit), thereby comprises 64 possible results (being the sub-look-up table of 64X7 bit).The output of above-mentioned 3 sub-look-up tables is 7 bits.
Being calculated as follows of each list item in the above-mentioned sub-look-up table.
Y, C in input
R, C
BComponent can be obtained list item calculating formula (16), (17) and (18) of each sub-look-up table among the LUT2 without under the situation about upholding by formula (2) and formula (9):
And the Y, the C that import
R, C
BThe span of component is upheld under 0~255 the situation, can be obtained list item calculating formula (19), (20) and (21) of each sub-look-up table of LUT2 by formula (3) and formula (9):
According to computing needs (only needing 7 bits to participate in computing), formula (16) is only got low 7 to the result of formula (21).
The structure of the 3rd look-up table LUT3 as shown in Figure 8.
LUT3 is input as YC
RC
BY component, C in the color space
RComponent and C
BThe the 5th and the 4th bit of component, obtain checking result lut_r2_0[8:0 by three sub-look-up tables that are respectively 16X9 bit, 64X9 bit and 16X9 bit], lut_g2_o[8:0], lut_b2_o[8:0], as the output of R, G, B result's the 2nd component.
Equally, in above-mentioned three sub-look-up tables, a sub-look-up table (the sub-look-up table of 16X9 bit) can need not to import C
R[5:4]), only according to Y[5:4] and C
B[5:4] obtains checking result; A sub-look-up table can need not to import C
B[5:4] is only according to Y[5:4] and C
R[5:4] obtains checking result.Above-mentioned two sub-look-up tables are owing to have only two inputs (4 bit), thereby comprise 16 possible results (being the sub-look-up table of 16X9 bit); Another sub-look-up table is owing to exist three inputs (6 bit), thereby comprises 64 possible results (being the sub-look-up table of 64X9 bit).The output of above-mentioned 3 sub-look-up tables is 9 bits.
Being calculated as follows of each list item in the above-mentioned sub-look-up table.
Y, C in input
R, C
BComponent can be obtained list item calculating formula (22), (23) and (24) of each sub-look-up table among the LUT3 without under the situation about upholding by formula (2) and formula (9):
And the Y, the C that import
R, C
BThe span of component is upheld under 0~255 the situation, can be obtained list item calculating formula (25), (26) and (27) of each sub-look-up table of LUT3 by formula (3) and formula (9):
According to computing needs (only needing 9 bits to participate in computing), formula (22) is only got low 9 to the result of formula (27).
The structure of the 4th look-up table LUT4 as shown in Figure 9.
LUT4 is input as YC
RC
BY component, C in the color space
RComponent and C
BThe the 7th and the 6th bit of component, obtain checking result lut_r3_0[10:0 by three sub-look-up tables that are respectively 16X11 bit, 64X11 bit and 16X11 bit], lut_g3_o[10:0], lut_b3_o[10:0], as the output of R, G, B result's the 3rd component.
Equally, in above-mentioned three sub-look-up tables, a sub-look-up table (the sub-look-up table of 16X11 bit) can need not to import C
R[7:6]), only according to Y[7:6] and C
B[7:6] obtains checking result; A sub-look-up table can need not to import C
B[7:6] is only according to Y[7:6] and C
R[7:6] obtains checking result.Above-mentioned two sub-look-up tables are owing to have only two inputs (4 bit), thereby comprise 16 possible results (being the sub-look-up table of 16X11 bit); Another sub-look-up table is owing to exist three inputs (6 bit), thereby comprises 64 possible results (being the sub-look-up table of 64X11 bit).The output of above-mentioned 3 sub-look-up tables is 11 bits.
Being calculated as follows of each list item in the above-mentioned sub-look-up table.
Y, C in input
R, C
BComponent can be obtained list item calculating formula (28), (29) and (30) of each sub-look-up table among the LUT4 without under the situation about upholding by formula (2) and formula (9):
And the Y, the C that import
R, C
BThe span of component is upheld under 0~255 the situation, can be obtained list item calculating formula (31), (32) and (33) of each sub-look-up table of LUT4 by formula (3) and formula (9):
According to computing needs (only needing 11 bits to participate in computing), formula (28) is only got low 11 to the result of formula (33).
In the present embodiment, the list item of LUT1, LUT2, LUT3, LUT4 all is to calculate in advance, that is to say that formula (16) all is to use the software realization and is kept in the look-up table software realization flow such as Figure 10, Figure 11 and shown in Figure 12 to the computational process of formula (33).Wherein, Figure 10 is the computed in software flow chart of searching list item corresponding to components R.Figure 11 is the computed in software flow chart of searching list item corresponding to component G.Figure 12 is the computed in software flow chart of searching list item corresponding to component B.
Map parameter A
I, j(i=0,1,2; J=0,1,2) the constant coefficient matrix element in corresponding (2) or the formula (3) respectively.Y, C
R, C
BComponent is without parameters C under the situation about upholding
1Corresponding constant coefficient
C
2Corresponding constant coefficient
C
3Corresponding constant coefficient
Y, C
R, C
BComponent is through parameters C under the situation about upholding
1Corresponding constant coefficient
C
2Corresponding constant coefficient
C
3Corresponding constant coefficient
C among the LUT4
1, C
2, C
3Adding 2 is in order to be used to do 5 processing of going into of 4 houses.
Specifically, the account form of the item of tabling look-up of components R as shown in figure 10, at first value and two of the possible Y component value with the 0th row the 0th row of the constant coefficient matrix in formula (2) or the formula (3) multiplies each other, again value and possible C that the 0th row the 2nd of this matrix is listed as
RTwo of components multiply each other, and afterwards, with two multiplication result additions, and addition result are moved to right 8, result and parameters C after will moving to right at last
1Addition is made the item of tabling look-up that shift left operation can obtain components R with addition result.
The account form that of component G tables look-up as shown in figure 11, value and two of the possible Y component value with the 1st row the 0th row of the constant coefficient matrix in formula (2) or the formula (3) multiplies each other at first respectively, value and a possible C that the 1st row the 1st of this matrix is listed as
BTwo of components multiply each other, with value and possible C of the 1st row the 2nd row of this matrix
RTwo of components multiply each other, and afterwards, with three multiplication result additions, and addition result are moved to right 8, and result and parameters C at last will move to right
2Addition is made the item of tabling look-up that shift left operation can obtain component G with addition result.
The account form that of component B tables look-up as shown in figure 12, at first value and two of the possible Y component value with the 2nd row the 0th row of the constant coefficient matrix in formula (2) or the formula (3) multiplies each other, again value and possible C that the 2nd row the 1st of this matrix is listed as
BTwo of components multiply each other, and afterwards, with two multiplication result additions, and addition result are moved to right 8, and result and parameters C at last will move to right
3Addition is made the item of tabling look-up that shift left operation can obtain component B with addition result.
After the end of tabling look-up, then, enter step 403, with in 4 groups of checking result corresponding to the value addition of the same color component of rgb color space, obtain 3 transformation results, correspond respectively to 3 color components of rgb color space,, get its least-significant byte as final RGB transformation result to the processing of rounding off respectively of 3 transformation results.
The addition of each component is shown in formula (34), (35), (36).
R=(lut_r3_o of the lut_r2_o+ sign bit expansion of the lut_r1_o+ sign bit expansion of the lut_r0_o+ sign bit expansion of sign bit expansion)>>1; (34)
G=(lut_g3_o of the lut_g2_o+ sign bit expansion of the lut_g1_o+ sign bit expansion of the lut_g0_o+ sign bit expansion of sign bit expansion)>>1; (35)
B=(lut_b3_o of the lut_b2_o+ sign bit expansion of the lut_b1_o+ sign bit expansion of the lut_b0_o+ sign bit expansion of sign bit expansion)>>1; (36)
Present embodiment is passed through each slice groups parallel processing, and different slice groups is looked into different tables, again to the checking result summation, makes and can finish conversion in a clock cycle, obtains higher throughput.In addition, for YC
RC
BEach color component of color space is the situation of 8 bits, each color component respectively can be divided into 4 fragments, each fragment 2 bit, handle with parallel mode, thereby between look-up table area and addition number of times, obtain balance preferably, make the area of look-up table less, the addition number of times is also less, reduced power consumption effectively.
And, since the additivity constant C that will relate in will changing in the present embodiment be integrated in the item of tabling look-up (suc as formula 8 and formula 9 shown in), in look-up table, realize, thereby reduced by a sub-addition, simplified calculating.Certainly, in actual applications, also can directly finish this flow path switch, be about to constant C and be integrated in the item of tabling look-up, and realize this conversion by adder of many employings according to formula (7).
Need to prove, because Y, C
R, C
BComponent exists through upholding and without upholding two kinds, in the present embodiment, one group of look-up table and adder can being set, according to Y, the C of input
R, C
BThe value of component is selected one group of corresponding formula; Two groups of look-up tables and adder can be set, one group of processing that is used for input through upholding, another group is used for the processing without the input of upholding, select the result of which group of output with a multiplexed selector, thereby can finish processing with same device, as shown in figure 13 to dissimilar inputs.Select to table look-up output by the extend_en signal, when extend_en equals 0, select not have the look-up table LUT that upholds to search and export, when extend_en equals 1, select look-up table LUT_extend to search and export through upholding.
What deserves to be mentioned is that present embodiment is with YC
RC
BEach color component of color space is 8 bits, and each color component respectively is divided into 4 fragments, and each fragment 2 bit is an example, specify, but this situation is an example, and present embodiment can be applied to YC equally
RC
BEach color component of color space is other number of bits, or the situation of each color component being carried out other division.
Look-up table in the present embodiment (LUT) is realized by combinational logic, also can use RAM or ROM storage to search this look-up table of realization in actual applications.
In addition, the first embodiment of the invention and second execution mode specify the input of 1 Bits Serial and two kinds of situations of 8 Bits Serial input (promptly parallel input), these two kinds of situations only are indivedual examples of the present invention, in an embodiment of the present invention, can be input as the basis with any serial of 1 to 8 equally and import conversion, as 2 Bits Serial input conversion, be about to 8 bits and be divided into 4 groups, per two bit serials input, parallel input between each group, or the like.Certainly the figure place of input is also not necessarily 8, can also be 16 etc.The mode and first or second execution mode of the conversion of input back are similar, do not repeat them here.
Third embodiment of the invention relates to a kind of color space conversion apparatus.In the present embodiment, each color component of first color space is divided into M fragment, and each fragment comprises at least one bit.This device comprises:
Look-up table, be used for tabling look-up according to input, this input is the slice groups that the fragment combination of correspondence position in each color component of first color space forms, and exports one group of checking result, this checking result comprises X value, and each value corresponds respectively to second a color space X color component; Total M slice groups, each slice groups is input to corresponding look-up table respectively and handles, and obtains M group checking result altogether;
Adder unit is used for M is organized the value addition of checking result corresponding to the same color component of second color space, obtains X transformation result, corresponds respectively to second a color space X color component; Wherein M, X are positive integer.
Required matrix multiplication when present embodiment adopts look-up table and adder unit to substitute multiplier to have realized the color space conversion, look-up table and adder unit chip area when realizing is less, reduced the big problem of chip area that the use because of multiplier causes effectively, reduced computation complexity and reduced power consumption.Because look-up table is to calculate in advance, realize and the loss of significance of introducing so in this device, removed floating point multiplication addition calculating fixed point, obtained higher precision property.
This look-up table realized by combinational logic, or searched by the RAM storage and to realize, or searched by the ROM storage and to realize.
In this device, above-mentioned adder unit has X, corresponds respectively to the addition process of a color component of second color space; Above-mentioned look-up table is one, is input to this look-up table with one in M the slice groups serially successively in the different clock cycle, and this look-up table outputs to X adder unit respectively with the value of the X in the checking result; This device also comprises X shift unit, and each shift unit and an adder unit are used in combination, and is used for the output result of this adder unit is shifted the back as the input of next clock cycle of this adder unit, as shown in figure 14.This device can be to each slice groups serial process, and each slice groups is looked into same table successively, summation again after checking result is shifted.Owing to only need a look-up table, implement the simplest.
Perhaps, in this device, above-mentioned look-up table has M, and M look-up table tabled look-up to M slice groups concurrently; Above-mentioned adder unit has X, comprises at least one adder in each adder unit, is used for the checking result of M look-up table output is carried out addition corresponding to the value of the same color component of second color space, as shown in figure 15.The device that carries out above-mentioned setting can be to each slice groups parallel processing, and different slice groups is looked into different tables, checking result is sued for peace again.Parallel processing can be finished conversion in a clock cycle, obtain higher throughput.
Because Y, C
R, C
BComponent exists through extension with without upholding two kinds, in the present embodiment, two groups of above-mentioned look-up tables and adder unit can be set in this device, first group of look-up table and adder unit are used to handle each color component of first color space through upholding, second group of look-up table and adder unit are used to handle each color component of first color space without upholding, and two groups of look-up tables and adder unit obtain input from same source; This device also road comprises a multiplexed selector, is used for selecting one group of output from two groups of look-up tables and adder unit, thereby can finishes processing to dissimilar inputs (comprise uphold and without two kinds of inputs of extension) with same device.
In sum, in embodiments of the present invention, required matrix multiplication when adopting look-up table and adder to substitute multiplier to have realized the color space conversion, look-up table and adder chip area when realizing is less, reduced the big problem of chip area that the use because of multiplier causes effectively, reduced computation complexity and reduced power consumption.Because look-up table is to calculate in advance, when calculating in advance, can use very high precision, realize and the loss of significance of introducing so in transformation flow, removed floating point multiplication addition calculating fixed point, obtained higher precision property.
Each color component of first color space is divided into several fragments, and the fragment combination of correspondence position becomes slice groups, and each bit in the slice groups is gone to table look-up as input.Can be to each slice groups serial process, each slice groups is looked into same table successively, summation again after checking result is shifted.Serial process only needs a look-up table, implements the simplest.Also can be to each slice groups parallel processing, different slice groups is looked into different tables, checking result is sued for peace again.Parallel processing can be finished conversion in a clock cycle, obtain higher throughput.
For each color component of first color space is the situation of 8 bits, each color component respectively can be divided into 4 fragments, each fragment 2 bit, handle with parallel mode, thereby between look-up table area and addition number of times, obtain balance preferably, make the area of look-up table less, the addition number of times is also less, reduced power consumption effectively.
For the additivity constant (as the constant C in the enforcement mode) that relates in the conversion, can in look-up table, realize, thereby reduce by a sub-addition, simplified calculating.
Two groups of look-up tables and adder can be set, one group of processing that is used for input through upholding, another group is used for the processing without the input of upholding, and selects to export the result of which group with a multiplexed selector, thereby can finish processing to dissimilar inputs with same device.
Though pass through with reference to some of the preferred embodiment of the invention, the present invention is illustrated and describes, but those of ordinary skill in the art should be understood that and can do various changes to it in the form and details, and without departing from the spirit and scope of the present invention.