CN112734868B - Lossless real-time compression method for 2D OpenGL texture based on tile segmentation principle - Google Patents

Lossless real-time compression method for 2D OpenGL texture based on tile segmentation principle Download PDF

Info

Publication number
CN112734868B
CN112734868B CN202110007289.XA CN202110007289A CN112734868B CN 112734868 B CN112734868 B CN 112734868B CN 202110007289 A CN202110007289 A CN 202110007289A CN 112734868 B CN112734868 B CN 112734868B
Authority
CN
China
Prior art keywords
texture
image
opengl
original image
convolution
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
CN202110007289.XA
Other languages
Chinese (zh)
Other versions
CN112734868A (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.)
Jinling Institute of Technology
Original Assignee
Jinling Institute of Technology
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 Jinling Institute of Technology filed Critical Jinling Institute of Technology
Priority to CN202110007289.XA priority Critical patent/CN112734868B/en
Publication of CN112734868A publication Critical patent/CN112734868A/en
Application granted granted Critical
Publication of CN112734868B publication Critical patent/CN112734868B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

And performing lossless real-time compression on the 2D OpenGL texture based on a tile segmentation principle. Based on the characteristics of large-area blank and large-area single color of the manually drawn image, the invention realizes real-time compression of OpenGL textures in a tile alignment mode, and the compression flow is shown in the attached drawing. The occupied memory is greatly reduced, the compression time is fast, the decompression is real-time, and the compressed image is directly rendered and displayed without decompression. The decompressed and displayed image has no quality loss, and the image which needs to be repeatedly edited can be decompressed and compressed for many times to ensure the original image content. The compression technology is suitable for all kinds of devices based on OpenGL display technology, such as personal computers, workstations, mobile devices, embedded devices and the like. The application environment comprising different programming interfaces of OpenGL, openGL ES, webGL and the like is supported. The algorithm involves that all the calculations can be done in the GPU by multiple renderings, with no data transfer between the GPU and the CPU.

Description

Lossless real-time compression method for 2D OpenGL texture based on tile segmentation principle
Technical Field
The invention relates to the field of lossless real-time compression, in particular to a lossless real-time compression method for 2D OpenGL textures based on a tile segmentation principle.
Background
OpenGL displays complex surfaces often use pictures to express the face details, or the uncompressed texture used in flat drawing software occupies a lot of display memory when supported by multiple layers. For example, a 4096x4096 32-bit texture occupies 64M of memory, considering other overhead, a display device including 2G display memory supports at most 32 layers in the case of non-compressed texture, and a graphic card manufacturer supports some texture compression modes, such as ECT1, PVRTC, ATITC, S3TC, which generally have the following problems in the monocular art: 1) Because of lack of unified specification, the compatibility is poor, and application programs can not be deployed and realized between computers and mobile equipment or mobile equipment of different brands; 2) The real-time performance is poor, real-time conversion between original pictures and compressed textures cannot be supported, and insurmountable use barriers exist for a drawing system which needs to flexibly edit texture contents; 3) Because codes are developed for different interfaces of different hardware devices aiming at different platforms and are compatible at an application layer, the implementation cost is high.
Disclosure of Invention
In order to solve the above-mentioned problems. The invention provides a lossless real-time compression method for 2D OpenGL textures based on a tile segmentation principle, which can be applied to all computers, workstations and mobile terminals based on OpenGL display, and is applicable to application environments of different programming interfaces such as OpenGL, openGL ES, webGL and the like, so as to achieve the purpose:
the invention provides a lossless real-time compression method for 2D OpenGL textures based on a tile segmentation principle, which comprises the following specific steps:
1) Performing tiled detection on image content, and performing 2x2 full convolution on an RGBA image to reduce resolution;
2) Comparing the difference between the value after convolution and the pixel value before convolution, and repeating the step 1) if the change exists;
3) All values have no change or the resolution has been reduced to 1x1, and the convolution process ends;
4) According to the convolution result, the next step of data coding can be carried out, according to the optimal principle, different data of 2 n The size is optimally spliced, combined and encoded into a 2D texture;
encoding into a 2D texture after optimal splicing, wherein the texture is directly used for displaying or decoding the restored original image or editing the original image in a compressed state;
5) The single-value pixels with different colors are coded into 1D textures without repetition;
6)2 n the size, position and index information are encoded into a structure array;
7) Designing a shader supporting display and decoding;
programming a shader, namely receiving texture data as a 2D texture, taking non-repeated color codes as a 1D texture, taking position and size indexes as drawing coordinates, and rendering for one time to realize drawing of an original image;
8) Displaying all or a part of the images in real time by adopting a special shader according to the encoded 2D,1D textures and position index information, and realizing the display process of the original image effect by drawing the original image into a display buffer zone;
9) According to the coded 2D,1D texture and position index information, adopting a special shader to restore all or part of the image, drawing the original image to the off-screen texture, and realizing the decoding process of restoring the original image;
10 2D and 1D textures, locations and indices are saved to a file in compression, providing a compressed texture format that can be saved for a long period of time.
As a further improvement of the present invention, the RGBA image in step 2) is subjected to 2x2 full convolution to reduce resolution, and the formula is as follows:
Figure BDA0002883559380000021
f is the convolution kernel, m, n is the size of the convolution kernel, typically m=n=2 n
G is an original image;
h is the convolved image;
i, j are pixel coordinates.
As a further improvement of the invention, the lossless real-time compression method is realized in a GPU or realized through chip curing algorithm hardware.
The invention discloses a lossless real-time compression method for 2D OpenGL textures based on a tile segmentation principle, which is designed as follows:
platform compatibility: the system can uniformly support computers, workstations and mobile terminals;
language compatibility: c++, java and JavaScript can be uniformly supported;
the method comprises the following steps: the textures can be edited under the condition of being compressed, and can be edited after being expanded in real time;
real-time: compression, decompression and display are realized in millisecond level;
and the quality loss is avoided, and the compression rate of the manually drawn image is high.
Drawings
FIG. 1 is a flow chart of the system of the present application;
FIG. 2 is a schematic diagram of a tile segmentation process of the present application;
FIG. 3 is a schematic representation of a monochrome image conversion according to the present application;
fig. 4 contains a complex content image conversion schematic diagram.
Detailed Description
The invention provides a lossless real-time compression method for 2D OpenGL textures based on a tile segmentation principle, which can be applied to all computers, workstations and mobile terminals based on OpenGL display, and is applicable to application environments of different programming interfaces such as OpenGL, openGL ES, webGL and the like.
The invention will be further described with reference to the following drawings and detailed description, wherein a detailed system flow chart is shown in fig. 1:
1) Encoding;
detecting tiles of image content;
the resolution is reduced by 2x2 full convolution on the RGBA image, expressed as follows:
Figure BDA0002883559380000031
f is the convolution kernel, m, n is the size of the convolution kernel, typically m=n=2 n
G is an original image;
h is the convolved image;
i, j are pixel coordinates.
Comparing the difference between the value after convolution and the pixel value before convolution, and repeating the step 1 when the content of all tiles is unchanged
All values have been changed or the resolution has been reduced to 1x1 and the convolution process is ended;
the tile segmentation process is as shown in fig. 2:
the principle is that the image features of the same pixel (blank, monochromatic, complex pixels) search for as large a square area as possible
The segmentation effect is as shown in fig. 3 and 4, wherein fig. 3 is a single-color image conversion schematic diagram, and fig. 4 is a complex content-containing image conversion schematic diagram;
(original image to be compressed on left side, tile mark image after convolution detection on right side):
the tile-map includes the size and location of three types of tiles: blank tiles (blank areas), monochrome tiles, complex tiles. Based on the convolution result, the next step of data encoding can be performed.
2 n Optimal stitching of large and small tiled images (2D texture);
the content is for different 2 n The complex content tiles with the size are encoded into a two-dimensional texture after optimal splicing, and the texture can be directly used for displaying (GL) or decoding a restored original image or editing the whole in a compressed state;
non-repeating color coding (1D texture);
2 n size, position and index coding (structure array);
2) Decoding:
data:
2 n a full graph after the tiled images of the size and the tile are spliced;
non-repeating color coding;
position and index coding;
a shader:
a special programming shader receives texture data as a two-dimensional texture, nonrepeating color coding as a one-dimensional texture, position and size indexes as drawing coordinates, and primary image drawing can be realized by one-time rendering;
decoding an image;
drawing the original image to an off-screen texture to realize the decoding process of the restored original image;
displaying an image;
drawing the original image to a display buffer area, so that the display process of the original image effect can be realized;
3) Editing;
simple editing;
decoding;
editing (modifying image content);
coding after all editing is completed;
editing the whole;
the whole editing supports linear operations such as rotation, translation, mirroring and the like without changing the content of the image pixels;
the whole editing can be directly realized under the condition of compression coding;
4) Storing;
2D image compression;
color coding compression;
2 n size, location and index compression.
The method involves all or part of the links of the following applications:
1) A complete image compression and decompression process;
2) Convolution dimension reduction in the image compression process is carried out to obtain each data code;
3) Storing the encoded data in a file in various compression modes;
4) Tile size 2 n Compression, decompression and display speeds can be increased, but the method itself can support tiles of arbitrary size;
5) The size of the encoding process is from 2 to 2 n The image dimension is reduced, the method can reach the optimal resolution, but in practical application, any gradient and number of stages from small to large can be selected;
6) The invention relates to an algorithm which is realized in a GPU (graphics processing unit) entirely or by chip curing algorithm hardware.
The above description is only of the preferred embodiment of the present invention, and is not intended to limit the present invention in any other way, but is intended to cover any modifications or equivalent variations according to the technical spirit of the present invention, which fall within the scope of the present invention as defined by the appended claims.

Claims (2)

1. The lossless real-time compression method for the 2D OpenGL texture based on the tile segmentation principle comprises the following specific steps of:
1) Performing tiled detection on image content, and performing 2x2 full convolution on an RGBA image to reduce resolution;
2) Comparing the difference between the value after convolution and the pixel value before convolution, and repeating the step 1) if the change exists;
in the step 1), the RGBA image is subjected to 2x2 full convolution to reduce resolution, and the formula is expressed as follows:
Figure QLYQS_1
f is the convolution kernel, m, n is the size of the convolution kernel, typically m=n=2 n
G is an original image;
h is the convolved image;
i, j is the pixel coordinates;
3) All values have no change or the resolution has been reduced to 1x1, and the convolution process ends;
4) According to the convolution result, the next step of data coding is carried out, and according to the optimal principle, different data of 2 n The size is optimally spliced, combined and encoded into a 2D texture;
encoding into a 2D texture after optimal splicing, wherein the texture is directly used for displaying or decoding the restored original image or editing the original image in a compressed state;
5) The single-value pixels with different colors are coded into 1D textures without repetition;
6)2 n the size, position and index information are encoded into a structure array;
7) Designing a shader supporting display and decoding;
programming a shader, namely receiving texture data as a 2D texture, taking non-repeated color codes as a 1D texture, taking position and size indexes as drawing coordinates, and rendering for one time to realize drawing of an original image;
8) Displaying all or a part of the images in real time by adopting a special shader according to the encoded 2D,1D textures and position index information, and realizing the display process of the original image effect by drawing the original image into a display buffer zone;
9) According to the coded 2D,1D texture and position index information, adopting a special shader to restore all or part of the image, drawing the original image to the off-screen texture, and realizing the decoding process of restoring the original image;
10 2D and 1D textures, locations and indices are saved to a file in compression, providing a compressed texture format that can be saved for a long period of time.
2. The method for lossless real-time compression of 2D OpenGL texture based on tile segmentation principle according to claim 1, wherein:
the lossless real-time compression method is realized in a GPU or realized through chip curing algorithm hardware.
CN202110007289.XA 2021-01-05 2021-01-05 Lossless real-time compression method for 2D OpenGL texture based on tile segmentation principle Active CN112734868B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110007289.XA CN112734868B (en) 2021-01-05 2021-01-05 Lossless real-time compression method for 2D OpenGL texture based on tile segmentation principle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110007289.XA CN112734868B (en) 2021-01-05 2021-01-05 Lossless real-time compression method for 2D OpenGL texture based on tile segmentation principle

Publications (2)

Publication Number Publication Date
CN112734868A CN112734868A (en) 2021-04-30
CN112734868B true CN112734868B (en) 2023-06-23

Family

ID=75589857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110007289.XA Active CN112734868B (en) 2021-01-05 2021-01-05 Lossless real-time compression method for 2D OpenGL texture based on tile segmentation principle

Country Status (1)

Country Link
CN (1) CN112734868B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2001264640A1 (en) * 2000-05-16 2001-11-26 Sun Microsystems, Inc. Graphics system using a blur filter
US8014597B1 (en) * 2006-03-22 2011-09-06 Woodman Labs Method for efficient compression and decoding of single sensor color image data
KR100856211B1 (en) * 2007-02-06 2008-09-03 삼성전자주식회사 High speed image processing scheme based on graphics processing unit
CN103761753B (en) * 2013-12-31 2016-09-07 浙江大学 Decompression method based on texture image similarity
US10810784B1 (en) * 2019-07-22 2020-10-20 Nvidia Corporation Techniques for preloading textures in rendering graphics

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于小波变换的图像纹理特征提取方法及其应用;李亚标;王宝光;李温温;;传感技术学报(第09期);92-95 *

Also Published As

Publication number Publication date
CN112734868A (en) 2021-04-30

Similar Documents

Publication Publication Date Title
US10776997B2 (en) Rendering an image from computer graphics using two rendering computing devices
US10440360B2 (en) Video processing system
US8369629B2 (en) Image processing using resolution numbers to determine additional component values
CN104272740A (en) Color buffer and depth buffer compression
EP2297935B1 (en) High dynamic range texture compression
US20100141670A1 (en) Color Packing Glyph Textures with a Processor
KR20200038171A (en) Methods of variable rate compression and decompression of image data in image pipeline of graphics processing system
US20100289798A1 (en) Image processing method and image processing apparatus
CN111311716A (en) Animation playing method and device, terminal equipment and storage medium
KR20210094054A (en) Bit-plane encoding of data arrays
CN112929705B (en) Texture compression and decompression method and device, computer equipment and storage medium
CN102138158A (en) Unified texture compression framework
EP2145317B1 (en) Multi-mode vector-based image processing
CN115190360B (en) Video receiver and method for generating display data
KR20190120166A (en) Apply video in delta color compression
US8494291B2 (en) Multi-mode processing of texture blocks
US8942474B2 (en) Method and system for interpolating index values of associated tiles in an image
CN112734868B (en) Lossless real-time compression method for 2D OpenGL texture based on tile segmentation principle
CN102164284A (en) Video decoding method and system
US20050219252A1 (en) Two-dimensional buffer, texture and frame buffer decompression
US10375398B2 (en) Lightfield compression for per-pixel, on-demand access by a graphics processing unit
CN106717002A (en) Using free-form deformations in surface reconstruction
KR101748397B1 (en) LUT Generating Method for Around View Monitor using OpenGL
JP4817792B2 (en) Texture-based pixel packing
CN116095250B (en) Method and device for video cropping

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant