CIF to D1 resolution ratio image amplification method based on table look-up method
By using table lookup method and hybrid amplification method on the embedded processor, the problem of large amount of image amplification and invalid edge pixels is solved, and efficient image amplification and improved display effect is achieved.
Patent Information
- Application Number
- CN202411616572.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-28
AI Technical Summary
The prior art has a large amount of calculation when implementing image amplification on an embedded processor, making it difficult to enlarge the standard definition video image within a limited time. A simple double-magnification method will lead to invalid pixels at the edge of the image, affecting the display effect.
The image amplification method based on the table lookup method is adopted, and the double-digit amplification and quadruple amplification are used to expand 8 pixels at the edge of the image. The calculation amount is reduced by the table lookup method, and the bit width of the 32-bit processor is fully utilized.
Image amplification is realized on an embedded ARM processor with a main frequency of 300MHz, reducing the amount of calculation, improving code execution efficiency, solving the problem of invalid pixels at the edge of the image, and improving image display effect and user experience.
Smart Images

Figure CN119728871A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information transmission and processing, and in particular to an image enlargement method from CIF to D1 resolution based on a table lookup method. Background Art
[0002] The interpolation algorithm used in image enlargement generally requires a high amount of computation and is not suitable for implementation on embedded processors. In particular, when enlarging standard-definition video images, the image processing processes such as image decoding, size conversion, and color space conversion must be completed within 40 milliseconds due to the image display limit of 25 frames per second. The time for image size conversion needs to be minimized.
[0003] CIF resolution is 352×288, which is a common resolution for low-speed standard-definition image compression. After compression, the image rate can be as low as several hundred kb / s. The display resolution of standard-definition PAL images is 720×576, that is, D1 resolution. To display low-speed compressed images through the standard-definition display interface, image amplification is required. If the method of simply doubling the resolution to 4CIF (704×576) is adopted, 8 pixels of invalid display data will be retained on both sides of the standard-definition image, affecting the display effect of the low-speed video image. Summary of the invention
[0004] In view of this, the present invention proposes an image magnification method for CIF to D1 resolution based on a table lookup method. The method adopts a mixture of double magnification and quadruple magnification, expands 8 pixel images on both sides, and fills the invalid pixels at the edge of the image. By using the table lookup method in the magnification process, the bit width of the 32-bit processor is fully utilized, and a single table lookup assignment operation of the pixel magnification table is used instead of multiple pixel assignments, which can reduce the amount of calculation in the image magnification process. The image magnification process can be implemented on an embedded ARM processor with a main frequency of 300MHz, realizing the single-channel low-speed image magnification display requirement. And on a high-performance embedded processor, it supports parallel magnification of multiple images to meet the engineering requirements of image monitoring projects.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0006] A method for image enlargement from CIF to D1 resolution based on a table lookup method, for enlarging a YUV420P format image with CIF resolution to a YUV420P format image with D1 resolution; comprising the following steps:
[0007] Step 1, constructing a four-fold pixel magnification table T, wherein the four-fold pixel magnification table T includes 256 entries, each of which occupies 4 bytes of storage; wherein T[n]=n×16843009, n=0, 1, 2, ..., 255, and T[n] represents the value of the n+1th entry in the four-fold pixel magnification table T;
[0008] Constructing a double pixel magnification table F, wherein the double pixel magnification table F includes 256 entries, each of which occupies 2 bytes of storage; wherein F[n]=n×257, n=0, 1, 2, ..., 255, and F[n] represents the value of the n+1th entry in the double pixel magnification table F;
[0009] Step 2, for the YUV420P format image with CIF resolution, the brightness Y component value, the chroma U component value and the chroma V component value are stored respectively, and 288 lines of brightness Y component value data, 144 lines of chroma U component value data and 144 lines of chroma V component value data are obtained, and each line of brightness Y component value data includes 352 bytes of brightness Y component value data, each line of chroma U component value data includes 176 bytes of chroma U component value data, and each line of chroma V component value data includes 176 bytes of chroma V component value data;
[0010] Divide the data into rows and columns according to the bytes, and obtain 352 columns × 288 rows of luminance Y component value data, 176 columns × 144 rows of chrominance U component value data, and 176 columns × 144 rows of chrominance V component value data;
[0011] Step 3, for the brightness Y component value data in the 1st, 2nd, 3rd, 4th, 349th, 350th, 351st, and 352nd columns, record a 1-byte brightness Y component value data value as m1, and amplify it four times. The amplified 4-byte brightness Y component value data value is T[m1];
[0012] For the brightness Y component value data of the 5th, 6th, 7th, ..., 348th columns, a 1-byte brightness Y component value data value is recorded as m2, and it is doubled, and the amplified 2-byte brightness Y component value data value is F[m2];
[0013] The amplified brightness Y component value data is spliced according to the relative position of the original brightness Y component value data, so as to obtain 288 lines of amplified brightness Y component value data, and each line of brightness Y component value data includes 720 bytes of brightness Y component value data;
[0014] Step 4, for the chroma U component value data in the 1st, 2nd, 175th, and 176th columns, record a 1-byte chroma U component value data value as m3, and amplify it four times. The amplified 4-byte chroma U component value data value is T[m3];
[0015] For the chroma U component value data in the 3rd, 4th, 5th, ..., 174th columns, a 1-byte chroma U component value data value is recorded as m4, and it is doubled, and the amplified 2-byte chroma U component value data value is F[m4];
[0016] splicing the amplified chroma U component value data according to the relative position of the original chroma U component value data, thereby obtaining 144 lines of amplified chroma U component value data, each line of chroma U component value data including 360 bytes of chroma U component value data;
[0017] Step 5, for the chroma V component value data in the 1st, 2nd, 175th, and 176th columns, record a 1-byte chroma V component value data value as m5, and amplify it four times. The amplified 4-byte chroma V component value data value is T[m5];
[0018] For the chroma V component value data in the 3rd, 4th, 5th, ..., 174th columns, a 1-byte chroma V component value data value is recorded as m6, and it is doubled, and the amplified 2-byte chroma V component value data value is F[m6];
[0019] splicing the amplified chroma V component value data according to the relative position of the original chroma V component value data, thereby obtaining 144 lines of amplified chroma V component value data, each line of chroma V component value data including 360 bytes of chroma V component value data;
[0020] Step 6, copying the amplified 288 lines of brightness Y component value data line by line, and the copied new line of brightness Y component value data is adjacent to the original line of brightness Y component value data, thereby obtaining 576 lines of brightness Y component value data, and each line of brightness Y component value data includes 720 bytes of brightness Y component value data;
[0021] The amplified 144 lines of chroma U component value data are copied line by line, and a new line of chroma U component value data obtained by copying is adjacent to the original chroma U component value data, thereby obtaining 288 lines of chroma U component value data, and each line of chroma U component value data includes 360 bytes of chroma U component value data;
[0022] The amplified 144 lines of chroma V component value data are copied line by line, and a new line of chroma V component value data obtained by copying is adjacent to the original chroma V component value data, thereby obtaining 288 lines of chroma V component value data, and each line of chroma V component value data includes 360 bytes of chroma V component value data;
[0023] Step 7, based on the 576 lines of luminance Y component value data, 144 lines of chrominance U component value data, and 144 lines of chrominance V component value data obtained after line-by-line copying in step 6, further obtain the YUV420P format image with D1 resolution that is enlarged corresponding to the YUV420P format image with CIF resolution in step 2, thereby completing the image enlargement from CIF to D1 resolution based on the table lookup method.
[0024] Due to the adoption of the above technical solution, the beneficial effects of the present invention compared with the prior art are:
[0025] 1. The present invention has a small amount of calculation and reduces the number of data copies by using a table lookup method. The amount of calculation is linearly related to the image size and only includes assignment operations without floating-point operations. It fully utilizes the bit width of a 32-bit embedded processor, improves code execution efficiency, and is conducive to the efficient implementation of embedded processors.
[0026] 2. The present invention solves the edge pixel filling problem of 4CIF resolution (704×576) and D1 resolution (720×576) by mixing the four-fold pixel magnification table and the two-fold pixel magnification table, thereby improving the image display effect and user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of an enlargement of a row of brightness Y component value data in an embodiment of the present invention.
[0028] Figure 2 It is a schematic diagram of an enlargement of a row of chromaticity U / V component value data in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0030] A method for image enlargement from CIF to D1 resolution based on a table lookup method, for enlarging a YUV420P format image with CIF resolution to a YUV420P format image with D1 resolution; comprising the following steps:
[0031] Step 1, constructing a four-fold pixel magnification table T, wherein the four-fold pixel magnification table T includes 256 entries, each of which occupies 4 bytes of storage; wherein T[n]=n×16843009, n=0, 1, 2, ..., 255, and T[n] represents the value of the n+1th entry in the four-fold pixel magnification table T;
[0032] Specifically, in this embodiment, the table contents of the four-times pixel magnification table T in hexadecimal notation are as follows:
[0033] 00000000H, 01010101H, 02020202H, 03030303H, 04040404H, 05050505H, 06060606H, 07070707H, 08080808H, 09090909H, 0A0A0A0AH, 0B0B0B0BH, 0C0C0C0CH, 0D0D0D0DH, 0E0E0E0EH, 0F0F0F0FH; <h2 style=";text-align:left;direction:ltr">
[0034] <h2 style=";text-align:left;direction:ltr"> 10101010H,11111111H,12121212H,13131313H,14141414H,15151515H,16161616H,17171717H, 18181818H,19191919H,1A1A1A1AH,1B1B1B1BH,1C1C1C1CH,1D1D1D1DH,1E1E1E1EH,1F1F1F1FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0035] <h2 style=";text-align:left;direction:ltr"> 202020H,212121H,2222222H,232323H,242424H,252525H,26262626H,272727H,28282828H,292929H,2A2A2A2AH,2B2B2B2BH,2C2C2C2CH,2D2D2D2DH,2E2E2E2EH,2F2F2F2FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0036] <h2 style=";text-align:left;direction:ltr"> 30303030H,31313131H,32323232H,3333333H,34343434H,353535H,36363636H,37373737H,38383838H,39393939H,3A3A3A3AH,3B3B3B3BH,3C3C3C3CH,3D3D3D3DH,3E3E3E3EH,3F3F3F3FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0037] <h2 style=";text-align:left;direction:ltr"> 40404040H,41414141H,42424242H,43434343H,44444444H,45454545H,46464646H,47474747H, 48484848H,49494949H,4A4A4A4AH,4B4B4B4BH,4C4C4C4CH,4D4D4D4DH,4E4E4E4EH,4F4F4F4FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0038] <h2 style=";text-align:left;direction:ltr"> 50505050H,515151H,52525252H,535353H,54545454H,5555555H,56565656H,57575757H,58585858H,59595959H,5A5A5A5AH,5B5B5B5BH,5C5C5C5CH,5D5D5D5DH,5E5E5E5EH,5F5F5F5FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0039] <h2 style=";text-align:left;direction:ltr">60606060H,616161H,62626262H,636363H,64646464H,656565H,6666666H,67676767H,68686868H,69696969H,6A6A6A6AH,6B6B6B6BH,6C6C6C6CH,6D6D6D6DH,6E6E6E6EH,6F6F6F6FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0040] <h2 style=";text-align:left;direction:ltr"> 70707070H,717171H,72727272H,73737373H,74747474H,757575H,76767676H,7777777H,787878H,79797979H,7A7A7A7AH,7B7B7B7BH,7C7C7C7CH,7D7D7D7DH,7E7E7E7EH,7F7F7F7FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0041] <h2 style=";text-align:left;direction:ltr"> 80808080H,81818181H,82828282H,83838383H,84848484H,85858585H,86868686H,87878787H, 88888888H,89898989H,8A8A8A8AH,8B8B8B8BH,8C8C8C8CH,8D8D8D8DH,8E8E8E8EH,8F8F8F8FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0042] <h2 style=";text-align:left;direction:ltr"> 90909090H,919191H,92929292H,939393H,94949494H,959595H,96969696H,97979797H,98989898H,99999999H,9A9A9A9AH,9B9B9B9BH,9C9C9C9CH,9D9D9D9DH,9E9E9E9EH,9F9F9F9FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0043] <h2 style=";text-align:left;direction:ltr"> A0A0A0A0H,A1A1A1A1H,A2A2A2A2H,A3A3A3A3H,A4A4A4A4H,A5A5A5A5H,A6A6A6A6H,A7A7A7A7H,A8A8A8A8H,A9A9A9A9H,AAAAAAAAH,ABABABH,ACACACACH,ADADADADH,AEAEAEAEH,AFAFAFAFH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0044] <h2 style=";text-align:left;direction:ltr">B0B0B0B0H,B1B1B1H,B2B2B2B2H,B3B3B3B3H,B4B4B4B4H,B5B5B5B5H,B6B6B6B6H,B7B7B7B7H,B8B8B8H,B9B9B9B9H,BABABABAH,BBBBBBBBH,BCBCBCBCH,BDBDBDBDH,BEBEBEBEH,BFBFBFBFH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0045] <h2 style=";text-align:left;direction:ltr"> C0C0C0C0H,C1C1C1C1H,C2C2C2C2H,C3C3C3C3H,C4C4C4C4H,C5C5C5C5H,C6C6C6C6H,C7C7C7C7H, C8C8C8C8H,C9C9C9C9H,CACACACAH,CBCBCBCBH,CCCCCCCCH,CDCDCDCDDH,CECEHCECEH,CFCFCFCFH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0046] <h2 style=";text-align:left;direction:ltr"> D0D0D0D0H,D1D1D1D1H,D2D2D2D2H,D3D3D3D3H,D4D4D4D4H,D5D5D5D5H,D6D6D6D6H,D7D7D7D7H, D8D8D8D8H,D9D9D9D9H,DADADADAH,DBDBDBDBH,DCCDCDCDCH,DDDDDDDDDH,DEDEDEDEH,DFDFDFDFH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0047] <h2 style=";text-align:left;direction:ltr"> E0E0E0E0H,E1E1E1E1H,E2E2E2E2H,E3E3E3E3H,E4E4E4E4H,E5E5E5E5H,E6E6E6E6H,E7E7E7E7H, E8E8E8E8H,E9E9E9E9H,EAEAEAEAH,EBEBEBEBH,ECECECECH,EDEDEDEDH,EEEEEEEEH,EFEFEFEFH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0048] <h2 style=";text-align:left;direction:ltr"> F0F0F0F0H,F1F1F1F1H,F2F2F2F2H,F3F3F3F3H,F4F4F4F4H,F5F5F5F5H,F6F6F6F6H,F7F7F7F7H, F8F8F8F8H,F9F9F9F9H,FAFAFAFAH,FBFBFBFBH,FCFCFCFCH,FDFDFDFDH,FEFEFEFEH,FFFFFFFFH。<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0049] Constructing a double pixel magnification table F, wherein the double pixel magnification table F includes 256 entries, each of which occupies 2 bytes of storage; wherein F[n]=n×257, n=0, 1, 2, ..., 255, and F[n] represents the value of the n+1th entry in the double pixel magnification table F;
[0050] Specifically, in this embodiment, the double pixel magnification table F uses hexadecimal notation to represent the following table entries:
[0051] 0000H, 0101H, 0202H, 0303H, 0404H, 0505H, 0606H, 0707H, 0808H, 0909H, 0A0AH, 0B0BH, 0C0CH, 0D0DH, 0E0EH, 0F0FH;
[0052] 1010H, 1111H, 1212H, 1313H, 1414H, 1515H, 1616H, 1717H, 1818H, 1919H, 1A1AH, 1B1BH, 1C1CH, 1D1DH, 1E1EH, 1F1FH;
[0053] 2020H, 2121H, 2222H, 2323H, 2424H, 2525H, 2626H, 2727H, 2828H, 2929H, 2A2AH, 2B2BH, 2C2CH, 2D2DH, 2E2EH, 2F2FH;
[0054] 3030H, 3131H, 3232H, 3333H, 3434H, 3535H, 3636H, 3737H, 3838H, 3939H, 3A3AH, 3B3BH, 3C3CH, 3D3DH, 3E3EH, 3F3FH;
[0055] 4040H, 4141H, 4242H, 4343H, 4444H, 4545H, 4646H, 4747H, 4848H, 4949H, 4A4AH, 4B4BH, 4C4CH, 4D4DH, 4E4EH, 4F4FH;
[0056] 5050H, 5151H, 5252H, 5353H, 5454H, 5555H, 5656H, 5757H, 5858H, 5959H, 5A5AH, 5B5BH, 5C5CH, 5D5DH, 5E5EH, 5F5FH;
[0057] <h2 style=";text-align:left;direction:ltr">6060H, 6161H, 6262H, 6363H, 6464H, 6565H, 6666H, 6767H, 6868H, 6969H, 6A6AH, 6B6BH, 6C6CH, 6D6DH, 6E6EH, 6F6FH<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0058] <h2 style=";text-align:left;direction:ltr"> 7070H, 7171H, 7272H, 7373H, 7474H, 7575H, 7676H, 7777H, 7878H, 7979H, 7A7AH, 7B7BH, 7C7CH, 7D7DH, 7E7EH, 7F7FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0059] <h2 style=";text-align:left;direction:ltr"> 8080H,8181H,8282H,8383H,8484H,8585H,8686H,8787H, 8888H,8989H,8A8AH,8B8BH,8C8CH,8D8DH,8E8EH,8F8FH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0060] <h2 style=";text-align:left;direction:ltr"> 9090H, 9191H, 9292H, 9393H, 9494H, 9595H, 9696H, 9797H, 9898H, 9999H, 9A9AH, 9B9BH, 9C9CH, 9D9DH, 9E9EH, 9F9FH<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0061] <h2 style=";text-align:left;direction:ltr"> A0A0H,A1A1H,A2A2H,A3A3H,A4A4H,A5A5H,A6A6H,A7A7H,A8A8H,A9A9H,AAAAH,ABABH,ACACH,ADADH,AEAEH,AFAFH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0062] <h2 style=";text-align:left;direction:ltr"> B0B0H,B1B1H,B2B2H,B3B3H,B4B4H,B5B5H,B6B6H,B7B7H,B8B8H,B9B9H,BABAH,BBBBH,BCBCH,BDBDH,BEBEH,BFBFH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0063] <h2 style=";text-align:left;direction:ltr"> C0C0H:<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0064] <h2 style=";text-align:left;direction:ltr"> D0D0H,D1D1H,D2D2H,D3D3H,D4D4H,D5D5H,D6D6H,D7D7H,D8D8H,D9D9H,DADAH,DBDBH,DCDCH,DDDDH,DEDEH,DFDFH;<h2 style=";text-align:left;direction:ltr"> <h2 style=";text-align:left;direction:ltr">
[0065] E0E0H, E1E1H, E2E2H, E3E3H, E4E4H, E5E5H, E6E6H, E7E7H, E8E8H, E9E9H, EEAAH, EBEBH, ECECH, EDEDH, EEEEH, EFEFH;
[0066] F0F0H, F1F1H, F2F2H, F3F3H, F4F4H, F5F5H, F6F6H, F7F7H, F8F8H, F9F9H, FAFAH, FBFBH, FCFCH, FDFDH, FEFEH, FFFFH.
[0067] Step 2, for the YUV420P format image with CIF resolution, the brightness Y component value, the chroma U component value and the chroma V component value are stored respectively, and 288 lines of brightness Y component value data, 144 lines of chroma U component value data and 144 lines of chroma V component value data are obtained, and each line of brightness Y component value data includes 352 bytes of brightness Y component value data, each line of chroma U component value data includes 176 bytes of chroma U component value data, and each line of chroma V component value data includes 176 bytes of chroma V component value data;
[0068] Divide the data into rows and columns according to the bytes, and obtain 352 columns × 288 rows of luminance Y component value data, 176 columns × 144 rows of chrominance U component value data, and 176 columns × 144 rows of chrominance V component value data;
[0069] Step 3, for the brightness Y component value data in the 1st, 2nd, 3rd, 4th, 349th, 350th, 351st, and 352nd columns, record a 1-byte brightness Y component value data value as m1, and amplify it four times. The amplified 4-byte brightness Y component value data value is T[m1];
[0070] For the brightness Y component value data of the 5th, 6th, 7th, ..., 348th columns, a 1-byte brightness Y component value data value is recorded as m2, and it is doubled, and the amplified 2-byte brightness Y component value data value is F[m2];
[0071] The amplified brightness Y component value data is spliced according to the relative position of the original brightness Y component value data, so as to obtain 288 lines of amplified brightness Y component value data, and each line of brightness Y component value data includes 720 bytes of brightness Y component value data;
[0072] Specifically, Figure 1As shown, the number 0 in the CIF image Y component row data is the brightness Y component value data of the first byte of a row in this embodiment, which is amplified four times, and the amplified 4-byte brightness Y component value data is the data labeled 0, 1, 2, and 3 in the D1 image Y component row data; the number 4 in the CIF image Y component row data is the brightness Y component value data of the fifth byte of a row in this embodiment, which is amplified twice, and the amplified 2-byte brightness Y component value data is the data labeled 16 and 17 in the D1 image Y component row data;
[0073] Step 4, for the chroma U component value data in the 1st, 2nd, 175th, and 176th columns, record a 1-byte chroma U component value data value as m3, and amplify it four times. The amplified 4-byte chroma U component value data value is T[m3];
[0074] For the chroma U component value data in the 3rd, 4th, 5th, ..., 174th columns, a 1-byte chroma U component value data value is recorded as m4, and it is doubled, and the amplified 2-byte chroma U component value data value is F[m4];
[0075] splicing the amplified chroma U component value data according to the relative position of the original chroma U component value data, thereby obtaining 144 lines of amplified chroma U component value data, each line of chroma U component value data including 360 bytes of chroma U component value data;
[0076] Step 5, for the chroma V component value data in the 1st, 2nd, 175th, and 176th columns, record a 1-byte chroma V component value data value as m5, and amplify it four times. The amplified 4-byte chroma V component value data value is T[m5];
[0077] For the chroma V component value data in the 3rd, 4th, 5th, ..., 174th columns, a 1-byte chroma V component value data value is recorded as m6, and it is doubled, and the amplified 2-byte chroma V component value data value is F[m6];
[0078] splicing the amplified chroma V component value data according to the relative position of the original chroma V component value data, thereby obtaining 144 lines of amplified chroma V component value data, each line of chroma V component value data including 360 bytes of chroma V component value data;
[0079] Specifically, Figure 2As shown, the number 0 in the U / V component row data of the CIF image is the chrominance U / V component value data of the first byte of a row in this embodiment, which is amplified four times, and the amplified 4-byte chrominance U / V component value data is the data labeled 0, 1, 2, and 3 in the U / V component row data of the D1 image; the number 2 in the U / V component row data of the CIF image is the chrominance U / V component value data of the fifth byte of a row in this embodiment, which is amplified twice, and the amplified 2-byte luminance Y component value data is the data labeled 8 and 9 in the U / V component row data of the D1 image;
[0080] Step 6, copying the amplified 288 lines of brightness Y component value data line by line, and the copied new line of brightness Y component value data is adjacent to the original line of brightness Y component value data, thereby obtaining 576 lines of brightness Y component value data, and each line of brightness Y component value data includes 720 bytes of brightness Y component value data;
[0081] The amplified 144 lines of chroma U component value data are copied line by line, and a new line of chroma U component value data obtained by copying is adjacent to the original chroma U component value data, thereby obtaining 288 lines of chroma U component value data, and each line of chroma U component value data includes 360 bytes of chroma U component value data;
[0082] The amplified 144 lines of chroma V component value data are copied line by line, and a new line of chroma V component value data obtained by copying is adjacent to the original chroma V component value data, thereby obtaining 288 lines of chroma V component value data, and each line of chroma V component value data includes 360 bytes of chroma V component value data;
[0083] Step 7, based on the 576 lines of luminance Y component value data, 144 lines of chrominance U component value data, and 144 lines of chrominance V component value data obtained after line-by-line copying in step 6, further obtain the YUV420P format image with D1 resolution that is enlarged corresponding to the YUV420P format image with CIF resolution in step 2, thereby completing the image enlargement from CIF to D1 resolution based on the table lookup method.
[0084] In summary, the present invention proposes an image magnification method for CIF to D1 resolution based on a table lookup method. The method adopts a mixture of double magnification and quadruple magnification, expands 8 pixel images on both sides, and fills the invalid pixels at the edge of the image. By using the table lookup method in the magnification process, the bit width of the 32-bit processor is fully utilized, and a single table lookup assignment operation of the pixel magnification table is used instead of multiple pixel assignments, which can reduce the amount of calculation in the image magnification process. The image magnification process can be implemented on an embedded ARM processor with a main frequency of 300MHz, realizing the single-channel low-speed image magnification display requirements. And on a high-performance embedded processor, it supports parallel magnification of multiple images to meet the engineering requirements of image monitoring projects.
[0085] Those skilled in the art will appreciate that the embodiments described are intended to help readers understand the principles of the present invention, and should be understood that the scope of protection of the present invention is not limited to the embodiments described. For those skilled in the art, the present invention may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of the claims of the present invention.
Claims
1. A CIF to D1 resolution image enlargement method based on a table lookup method, used to enlarge a CIF resolution YUV420P format image to a D1 resolution YUV420P format image; characterized in that: The steps include: Step 1, constructing a four-fold pixel magnification table T, wherein the four-fold pixel magnification table T includes 256 entries, each of which occupies 4 bytes of storage; wherein T[n]=n×16843009, n=0, 1, 2, ..., 255, and T[n] represents the value of the n+1th entry in the four-fold pixel magnification table T; Constructing a double pixel magnification table F, wherein the double pixel magnification table F includes 256 entries, each of which occupies 2 bytes of storage; wherein F[n]=n×257, n=0, 1, 2, ..., 255, and F[n] represents the value of the n+1th entry in the double pixel magnification table F; Step 2, for the YUV420P format image with CIF resolution, the brightness Y component value, the chroma U component value and the chroma V component value are stored respectively, and 288 lines of brightness Y component value data, 144 lines of chroma U component value data and 144 lines of chroma V component value data are obtained, and each line of brightness Y component value data includes 352 bytes of brightness Y component value data, each line of chroma U component value data includes 176 bytes of chroma U component value data, and each line of chroma V component value data includes 176 bytes of chroma V component value data; Divide the data into rows and columns according to the bytes, and obtain 352 columns × 288 rows of luminance Y component value data, 176 columns × 144 rows of chrominance U component value data, and 176 columns × 144 rows of chrominance V component value data; Step 3, for the brightness Y component value data in the 1st, 2nd, 3rd, 4th, 349th, 350th, 351st, and 352nd columns, record a 1-byte brightness Y component value data value as m1, and amplify it four times. The amplified 4-byte brightness Y component value data value is T[m1]; For the brightness Y component value data of the 5th, 6th, 7th, ..., 348th columns, a 1-byte brightness Y component value data value is recorded as m2, and it is doubled, and the amplified 2-byte brightness Y component value data value is F[m2]; The amplified brightness Y component value data is spliced according to the relative position of the original brightness Y component value data, so as to obtain 288 lines of amplified brightness Y component value data, and each line of brightness Y component value data includes 720 bytes of brightness Y component value data; Step 4, for the chroma U component value data in the 1st, 2nd, 175th, and 176th columns, record a 1-byte chroma U component value data value as m3, and amplify it four times. The amplified 4-byte chroma U component value data value is T[m3]; For the chroma U component value data in the 3rd, 4th, 5th, ..., 174th columns, a 1-byte chroma U component value data value is recorded as m4, and it is doubled, and the amplified 2-byte chroma U component value data value is F[m4]; splicing the amplified chroma U component value data according to the relative position of the original chroma U component value data, thereby obtaining 144 lines of amplified chroma U component value data, each line of chroma U component value data including 360 bytes of chroma U component value data; Step 5, for the chroma V component value data in the 1st, 2nd, 175th, and 176th columns, record a 1-byte chroma V component value data value as m5, and amplify it four times. The amplified 4-byte chroma V component value data value is T[m5]; For the chroma V component value data in the 3rd, 4th, 5th, ..., 174th columns, a 1-byte chroma V component value data value is recorded as m6, and it is doubled, and the amplified 2-byte chroma V component value data value is F[m6]; splicing the amplified chroma V component value data according to the relative position of the original chroma V component value data, thereby obtaining 144 lines of amplified chroma V component value data, each line of chroma V component value data including 360 bytes of chroma V component value data; Step 6, copying the amplified 288 lines of brightness Y component value data line by line, and the copied new line of brightness Y component value data is adjacent to the original line of brightness Y component value data, thereby obtaining 576 lines of brightness Y component value data, and each line of brightness Y component value data includes 720 bytes of brightness Y component value data; The amplified 144 lines of chroma U component value data are copied line by line, and a new line of chroma U component value data obtained by copying is adjacent to the original chroma U component value data, thereby obtaining 288 lines of chroma U component value data, and each line of chroma U component value data includes 360 bytes of chroma U component value data; The amplified 144 lines of chroma V component value data are copied line by line, and a new line of chroma V component value data obtained by copying is adjacent to the original chroma V component value data, thereby obtaining 288 lines of chroma V component value data, and each line of chroma V component value data includes 360 bytes of chroma V component value data; Step 7, based on the 576 lines of luminance Y component value data, 144 lines of chrominance U component value data, and 144 lines of chrominance V component value data obtained after line-by-line copying in step 6, further obtain the YUV420P format image with D1 resolution that is enlarged corresponding to the YUV420P format image with CIF resolution in step 2, thereby completing the image enlargement from CIF to D1 resolution based on the table lookup method.