CN110740325B - Texture compression method, device, equipment and storage medium - Google Patents

Texture compression method, device, equipment and storage medium Download PDF

Info

Publication number
CN110740325B
CN110740325B CN201810799211.4A CN201810799211A CN110740325B CN 110740325 B CN110740325 B CN 110740325B CN 201810799211 A CN201810799211 A CN 201810799211A CN 110740325 B CN110740325 B CN 110740325B
Authority
CN
China
Prior art keywords
texture
compressed
compression
identifier
type
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
CN201810799211.4A
Other languages
Chinese (zh)
Other versions
CN110740325A (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.)
Tencent Cyber Tianjin Co Ltd
Original Assignee
Tencent Cyber Tianjin Co Ltd
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 Tencent Cyber Tianjin Co Ltd filed Critical Tencent Cyber Tianjin Co Ltd
Priority to CN201810799211.4A priority Critical patent/CN110740325B/en
Publication of CN110740325A publication Critical patent/CN110740325A/en
Application granted granted Critical
Publication of CN110740325B publication Critical patent/CN110740325B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation

Abstract

The embodiment of the application discloses a texture compression method and a related device. If the texture to be compressed is the first type of texture with higher compression quality requirement, the texture to be compressed is compressed by adopting a first compression algorithm capable of obtaining high compression quality, the loss of the obtained compression result is smaller relative to the texture to be compressed, and the due rendering quality is ensured. If the texture to be compressed is the second type of texture with general compression quality requirements, the texture to be compressed is compressed by adopting a second compression algorithm capable of obtaining general compression quality so as to improve the compression efficiency and the rendering efficiency. Therefore, one processing device can be configured with a plurality of compression algorithms, and can automatically select an applicable compression algorithm from the configured plurality of compression algorithms to compress the texture to be compressed according to the type of the texture to be compressed, so that the problems caused by the adoption of a single compression algorithm are avoided, and the texture compression requirement is better met.

Description

Texture compression method, device, equipment and storage medium
Technical Field
The present application relates to the field of data processing, and in particular, to a texture compression method and apparatus.
Background
The texture may be rendered onto the video frame such that the visual effect embodied by the texture is exhibited in the video frame. For example, in the live broadcasting process, by rendering the texture corresponding to the special effect background to the video frame corresponding to the live broadcasting, a user watching the live broadcasting can see that the special effect background is shown in the live broadcasting video.
The texture needs to be buffered before it is rendered onto the video frame, however, the data size of the texture is typically large, which may cause storage stress on the processing device if the texture is fully buffered. The traditional method is to cache the compressed texture, and when rendering is carried out, the compressed texture can be directly rendered into a video frame, so that the cache pressure is relieved.
However, the processing devices are configured with a single compression algorithm to compress the texture, and the single compression algorithm has a problem that some compression algorithms cannot be applied to all types of textures, for example, a large texture loss is caused when compressing a texture with a high compression quality requirement, and some compression algorithms have low compatibility with the processing devices, for example, only are applied to processing devices with high processing capability, so that it is difficult for the processing devices to satisfy the compression requirement of the texture when compressing the texture by using the current single compression algorithm.
Disclosure of Invention
In order to solve the technical problems, the application provides a texture compression method and a texture compression device, the method can identify the type of a texture to be compressed, so that one processing device can configure various compression algorithms, and can automatically select an applicable compression algorithm from the configured various compression algorithms to compress the texture to be compressed according to the identification result of the texture to be compressed, thereby avoiding the problem caused by adopting a single compression algorithm and better meeting the requirement of texture compression.
The embodiment of the application discloses the following technical scheme:
in a first aspect, an embodiment of the present application provides a texture compression method, where the method includes:
determining the type of texture to be compressed according to a preset condition for identifying the compression quality requirement;
if the texture to be compressed is determined to be a first type of texture, compressing the texture to be compressed by adopting a first compression algorithm applicable to the first type of texture;
if the texture to be compressed is determined to be a second type of texture, compressing the texture to be compressed by adopting a second compression algorithm applicable to the second type of texture;
wherein the compression quality requirement of the first type of texture is higher than the compression quality requirement of the second type of texture.
In a second aspect, an embodiment of the present application provides a texture compression apparatus, which includes a first determining unit, a first compression unit, and a second compression unit:
the first determining unit is used for determining the type of the texture to be compressed according to a preset condition for identifying the compression quality requirement;
the first compression unit is configured to compress the texture to be compressed by using a first compression algorithm applicable to the first type of texture if the first determination unit determines that the texture to be compressed is the first type of texture;
the second compression unit is configured to compress the texture to be compressed by using a second compression algorithm applicable to the second type of texture if the first determination unit determines that the texture to be compressed is the second type of texture;
wherein the compression quality requirement of the first type of texture is higher than the compression quality requirement of the second type of texture.
In a third aspect, an embodiment of the present application provides an apparatus for texture compression, where the apparatus includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the texture compression method of any of the first aspect according to instructions in the program code.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium for storing program code for executing the texture compression method according to any one of the first aspect.
According to the technical scheme, when the texture to be compressed is obtained, the type of the texture to be compressed can be determined according to the preset condition for identifying the compression quality requirement, for example, the first type of texture with relatively high compression quality requirement or the second type of texture with relatively low compression quality requirement. If the texture to be compressed is the first type of texture, it can be clear that the requirement on the compression quality of the texture to be compressed is high, the texture to be compressed needs to be compressed by adopting a first compression algorithm capable of obtaining high compression quality, the loss of an obtained compression result is small relative to the texture to be compressed, and due rendering quality can be ensured when the texture to be compressed is rendered by adopting the compression result. If the texture to be compressed is the second type of texture, the requirement on the compression quality of the texture to be compressed can be definitely low, and the texture to be compressed can be compressed by adopting a second compression algorithm capable of obtaining general compression quality, so that the compression efficiency and the rendering efficiency are improved. By identifying the type of the texture to be compressed, one processing device can configure various compression algorithms, and can automatically select an applicable compression algorithm from the configured various compression algorithms to compress the texture to be compressed according to the identification result of the texture to be compressed, so that the problem caused by the adoption of a single compression algorithm is avoided, and the texture compression requirement can be better met.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic view of an application scenario of a texture compression method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a texture compression method according to an embodiment of the present disclosure;
FIG. 3 is a schematic flowchart of a texture compression method according to an embodiment of the present disclosure;
fig. 4 is a schematic flowchart of a texture compression method according to an embodiment of the present application;
fig. 5 is a schematic view of an application scenario of a texture compression method according to an embodiment of the present application;
fig. 6 is a schematic flowchart of a texture compression method according to an embodiment of the present application;
FIG. 7a is a block diagram of a texture compression apparatus according to an embodiment of the present application;
FIG. 7b is a block diagram of a texture compression apparatus according to an embodiment of the present application;
FIG. 7c is a block diagram of a texture compression apparatus according to an embodiment of the present application;
FIG. 8 is a block diagram of an apparatus for texture compression according to an embodiment of the present disclosure;
fig. 9 is a block diagram of an apparatus for texture compression according to an embodiment of the present disclosure.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the traditional texture compression method, one processing device can only configure a single compression algorithm to compress textures, and as some compression algorithms cannot be suitable for all types of textures, for example, texture loss is caused when the textures with high compression quality requirements are compressed, so that the processing devices configured with the compression algorithms cannot compress the textures with high compression quality requirements; alternatively, some compression algorithms are not compatible with the processing device, and are only suitable for processing devices with high processing capacity, so that the compression algorithms can only be configured on the processing device with high processing capacity. Therefore, when the texture is compressed by adopting a single compression algorithm, the conventional method is difficult to meet the compression requirement of the texture.
To this end, the embodiments of the present application provide a texture compression method, which may configure multiple compression algorithms on a processing device, and different compression algorithms may be suitable for compressing different kinds of textures. The determination of which kind of texture the compression algorithm is suitable for needs depends on the texture compression capability of the compression algorithm for different types of textures, i.e. the compression result obtained by compressing the texture is less lost than the texture before compression, and if the compression result obtained by compressing one kind of texture by one compression algorithm is less lost, the viewing experience of the user is not affected after rendering, the compression algorithm suitable for the kind of texture by the compression algorithm can be determined. On the basis, the compression texture efficiency, the storage space occupied by the compression result, the consumption of system resources or the texture rendering speed of rendering by using the compression result and the like can be used as the basis for determining the compression algorithm applicable to one type of texture. The compression algorithm suitable for one kind of texture is superior to other algorithms in any one or more of texture compression efficiency, storage space occupied by a compression result, consumption of system resources or texture rendering speed of rendering by using the compression result.
For example, the processing device is configured with a compression algorithm a and a compression algorithm B, and the compression algorithm a and the compression algorithm B are respectively used to compress the textures of the type C to obtain their corresponding compression results, and if the quality of the compression result corresponding to the compression algorithm a is higher than that of the compression result corresponding to the compression algorithm B, the compression algorithm a may be considered as the compression algorithm to which the textures of the type C are applied.
For another example, a compression algorithm a and a compression algorithm B are configured on the processing device, and the respective compression results can be obtained by respectively compressing D types of textures by using the compression algorithm a and the compression algorithm B. If the quality of the compression result corresponding to the compression algorithm a is similar to the quality of the compression result corresponding to the compression algorithm B, but compared with the compression algorithm a, when the D-type texture is compressed by using the compression algorithm B, the consumed system resources are less, the storage space occupied by the obtained compression result is smaller, and the rendering speed of rendering the compression result onto the video frame is faster, then the compression algorithm B can be considered as the compression algorithm applicable to the D-type texture.
Therefore, when the texture to be compressed is obtained, the texture to be compressed can be classified according to the compression quality requirement, so that the applicable compression algorithm can be automatically selected from the configured multiple compression algorithms according to the classification result to compress the texture to be compressed, the problem caused by the adoption of a single compression algorithm is avoided, and the texture compression requirement can be better met.
It can be understood that the texture compression method provided by the embodiment of the present application can be applied to scenes in which textures need to be rendered on video frames, such as live broadcasting, video chat, games, and the like.
For example, during the use of a game, in order to improve the experience of a player, a large amount of texture rendering may be required in the game, and in this case, the compression efficiency and the rendering efficiency in the game can be improved by the texture compression method provided by the embodiment. Specifically, the texture compression method provided by the embodiment can be implemented by providing a compression plug-in for the cocosverator development engine of the game.
The texture compression method provided by the embodiment of the application can be applied to processing equipment with texture compression capability, and the processing equipment can be terminal equipment or a server. The terminal device may be, for example, a smart terminal, a computer, a Personal Digital Assistant (PDA), a tablet computer, or the like.
If the processing device is a server, the server may obtain the texture to be compressed from the terminal device, thereby executing the texture compression method. When the server obtains the compression result by using the texture compression method, the compression result can be sent to the terminal device, so that the terminal device renders the compression result onto the video frame.
In order to facilitate understanding of the technical solution of the present application, the texture compression method provided in the embodiment of the present application is described below with reference to an actual application scenario.
Referring to fig. 1, fig. 1 is a schematic view of an application scenario of a texture compression method according to an embodiment of the present application. The application scenario is introduced by taking an example that the texture compression method is applied to a terminal device (a processing device is a terminal device), the application scenario includes the terminal device 101, a plurality of compression algorithms are configured in the terminal device 101, and different compression algorithms can be applied to compressing different types of textures. For example, the terminal device 101 is configured with a first compression algorithm and a second compression algorithm, where the first compression algorithm and the second compression algorithm are two different compression algorithms, the first compression algorithm is used for compressing a first type of texture, and the second compression algorithm is used for compressing a second type of texture, and a compression quality requirement of the first type of texture is higher than a compression quality requirement of the second type of texture.
When the terminal device 101 acquires the texture to be compressed, the terminal device 101 may classify the texture to be compressed according to the preset condition for identifying the compression quality requirement, so that the applicable compression algorithm may be automatically selected from the configured multiple compression algorithms for the different types of texture to be compressed to compress the texture to be compressed. For example, if the terminal device 101 determines that the texture to be compressed is the first type of texture according to the preset condition for identifying the compression quality requirement, the texture to be compressed is compressed by using a first compression algorithm applicable to the first type of texture; and if the texture to be compressed is determined to be the second type of texture, compressing the texture to be compressed by adopting a second compression algorithm applicable to the second type of texture.
The texture mentioned in the embodiment of the application can be used for embodying the content included in the object which needs to be rendered on the video frame; the texture to be compressed can be the texture to be compressed, the compression result is obtained by compressing the texture to be compressed, the storage space occupied by the compression result in the processing equipment is small, and the storage pressure of the processing equipment can be reduced. In addition, rendering the compression result into a video frame can improve the texture rendering speed.
For example, the storage space occupied by the texture to be compressed is 100M, and the storage space occupied by the compression result obtained by compressing the texture to be compressed is 50M, which means that the storage space occupied by the compression result is obviously smaller than the storage space occupied by the texture to be compressed. In addition, the time taken to render 50M of the compression results onto the video frame is obviously less than the time taken to render 100M of the texture to be compressed onto the video frame, thereby increasing the texture rendering speed.
According to the method provided by the embodiment of the application, when the texture to be compressed is obtained, the texture to be compressed can be classified, and multiple compression algorithms aiming at different types of compressed textures are configured on the processing equipment, so that when the type corresponding to the texture to be compressed is determined according to the compression quality requirement, an applicable compression algorithm can be automatically selected from the multiple configured compression algorithms to compress the texture to be compressed.
The classes to which the texture to be compressed may belong may include at least two classes, that is, the texture to be compressed may belong to other classes in addition to the first class of texture and the second class of texture, and have corresponding compression algorithms for different classes of textures, and the first class of texture and the second class of texture mentioned in the embodiments of the present application are only two examples of classes. Accordingly, the compression algorithms configured in the terminal device 101 may include at least two compression algorithms, that is, other compression algorithms may be configured besides the first compression algorithm and the second compression algorithm, and the first compression algorithm and the second compression algorithm mentioned in the embodiments of the present application are only two examples of the compression algorithms.
It should be noted that, after the texture to be compressed is compressed, a texture loss may occur in the compression result with respect to the texture to be compressed. When the compression algorithm is used for compressing the texture to be compressed, the compression quality requirement is required, and the compression quality requirement can be used for reflecting the texture loss degree of the compression result acceptable for a user. In general, the texture loss of the compression result is required to be difficult for a user to detect by naked eyes, so that the visual effect of rendering the compression result on the video frame is not much different from the visual effect of rendering the texture to be compressed on the video frame. If texture loss is large, when the compression result is rendered on a video frame, a user may see bad visual effects, such as distortion, color difference, mosaic, etc. of the rendered video. At this time, it indicates that the compression quality of the texture to be compressed by using a certain compression algorithm is not good, and the compression result may not meet the compression quality requirement.
Therefore, in order to ensure that textures to be compressed with different compression quality requirements are all compressed to obtain compression results meeting the quality requirements by adopting corresponding compression algorithms, when the textures to be compressed are classified, the preset conditions are specific preset conditions, and the preset conditions can be used for identifying the compression quality requirements for the compression results, namely the preset conditions can reflect the texture loss degree of the compression results acceptable by users, so that for the textures to be compressed with different compression quality requirements, a proper compression algorithm can be selected to compress the textures to be compressed to obtain the compression results meeting the compression quality requirements.
It can be understood that, in the embodiment of the present application, the textures to be compressed are classified according to the preset condition for identifying the compression quality requirement, and the classes of the textures obtained through the classification include at least two classes, for example, a first class of textures and a second class of textures, and thus the first class of textures and the second class of textures are two classes of textures having different compression quality requirements, where the compression quality requirement of the first class of textures is higher than that of the second class of textures. The terminal device 101 is configured with compression algorithms that are applicable to textures to be compressed having different compression quality requirements.
It should be noted that the scene shown in fig. 1 is only an example, and no specific limitation is imposed on an application scene of the texture compression method provided in the embodiment of the present application.
The texture compression method provided by the present application is described below by way of example.
Referring to fig. 2, fig. 2 is a schematic flowchart of a texture compression method according to an embodiment of the present disclosure. For convenience of description, the present embodiment is described with a terminal device as an execution subject, and it should be understood that the execution subject of the texture compression method is not limited to the terminal device, and may also be applied to other devices having a texture compression function, such as a server. As shown in fig. 2, the texture compression method includes:
s201, determining the type of texture to be compressed according to a preset condition for identifying the compression quality requirement, if the texture to be compressed is determined to be a first type of texture, executing S202, and if the texture to be compressed is determined to be a second type of texture, executing S203.
The texture to be compressed acquired by the terminal device may have a corresponding preset condition, and the preset condition may identify a compression quality requirement corresponding to the texture to be compressed, that is, reflect a compression quality that a compression result obtained by compressing the texture to be compressed by using a compression algorithm should achieve. The terminal equipment can classify the texture to be compressed according to the preset condition, and selects a proper compression algorithm to compress the texture to be compressed according to the type of the texture to be compressed.
Next, possible forms of the preset condition will be described. It will be appreciated that the textures that need to be rendered onto the video frame may have different size requirements, which embody the size of the texture. For example, in a live video, a video interface may include a background, and the size of the texture corresponding to the background is generally larger, and generally, the size of the texture corresponding to the background may be the same as the size of the video frame. Because the size of the texture corresponding to the background is larger, even if some texture loss occurs in the compression result of the texture corresponding to the background, the compression result is rendered on the video frame, and the visual effect observed by the naked eyes of the user is not greatly influenced. Thus, textures of relatively large size generally have relatively low compression quality requirements.
However, some textures are relatively small in size, such as buttons on a presentation interface for a live video. The sizes of the textures are small, and if the compression result of the texture corresponding to the button has more texture loss, the compression result is rendered on a video frame, so that the originally smaller button observed by the naked eye of a user may have larger distortion. Therefore, smaller sized textures typically have higher compression quality requirements.
It follows that the size requirement of a texture may reflect the compression quality requirement, the larger the size of a texture the lower its compression quality requirement, and the smaller the size of a texture the higher its compression quality requirement. The size requirement of the texture has the characteristic of representing the compression quality requirement, so the size requirement of the texture can be used as a preset condition, namely, the type of the texture to be compressed can be determined according to the size requirement of the texture.
It will be appreciated that the textures that need to be rendered onto the video frame may have different color channels in addition to different size requirements. The color channels can be used for storing color information embodied by the texture, and colors in all the color channels are superposed and mixed to generate a color corresponding to the texture. The texture may have at least one color channel, for example, may include a red channel, a yellow channel, a blue channel, a translucent channel, etc., such that a user may see rich colors when rendering the texture onto the video frame. However, when compressing textures with different color channels, some textures are compressed by some compression algorithms, and the obtained compression result is prone to have a large texture loss on a specified color channel, so that the compression quality requirement is high for the textures with the specified color channel.
For example, when a PVR compression algorithm is used to compress a texture having a transparent or semi-transparent channel, the texture loss of the obtained compression result on the channel is large, and when the compression result is rendered on a video frame, it may be difficult for a user to see the visual effect embodied by the texture on the channel. Therefore, when the texture with the transparent or semitransparent channel is compressed, the compression quality requirement is high, so that the texture loss on the transparent or semitransparent channel is reduced, and the visual effect embodied by the texture on the transparent or semitransparent channel can be ensured to be seen by a user. Wherein, the transparent or semi-transparent channel can be used as the appointed color channel. PVR is a texture compression algorithm, known collectively as Power VR.
Therefore, whether the texture has the specified color channel or not can reflect the compression quality requirement, if the texture has the specified color channel, the compression quality requirement can be higher, otherwise, the compression quality requirement can be lower. Whether the texture has the characteristic that the specified color channel can express the compression quality requirement or not can be used as a preset condition, namely, the type of the texture to be compressed can be determined according to whether the texture has the specified color channel or not.
Of course, the size requirement of the texture and whether the texture has the designated color channel may be jointly used as the preset condition, that is, the type of the texture to be compressed may also be determined according to the size requirement of the texture and whether the texture has the designated color channel.
S202, compressing the texture to be compressed by adopting a first compression algorithm applicable to the first type of texture.
S203, compressing the texture to be compressed by adopting a second compression algorithm applicable to the second type of texture.
In this embodiment, a terminal device is configured with a first compression algorithm and a second compression algorithm as an example, where the first compression algorithm is a compression algorithm applied to a first type of texture, and the second compression algorithm is a compression algorithm applied to a second type of texture. In this embodiment, a corresponding relationship between the type of texture and a compression algorithm applicable to the type of texture may be established in the terminal device, and if it is determined that the texture to be compressed is the first type of texture according to a preset condition for identifying a compression quality requirement, it is determined to compress the texture to be compressed by using the first compression algorithm according to the corresponding relationship; and if the texture to be compressed is determined to be the second type of texture according to the preset condition for identifying the compression quality requirement, determining to compress the texture to be compressed by adopting a second compression algorithm according to the corresponding relation.
It should be noted that, in actual use, the terminal device may be a higher-configured terminal device or a lower-configured terminal device, and the configuration of the terminal device is different, and the multiple compression algorithms configured thereon may be different. Next, a compression algorithm configured by a terminal device of a different configuration will be described.
If the terminal device is configured with a higher terminal device, the terminal device can configure a compression algorithm with higher texture compression capability, wherein the texture compression capability may refer to the capability of the compression algorithm to compress a texture to be compressed to obtain a compression result meeting the quality requirement. In order to ensure that the terminal device can obtain a compression result meeting the compression quality requirement when the compression quality requirement is high, and can improve the rendering speed on the premise of ensuring the compression quality when the compression quality requirement is low, the first compression algorithm can be a compression algorithm which can be configured on the terminal device with high configuration and has strong texture compression capability, and the second compression algorithm can be a compression algorithm which has weak compression capability, high compatibility, high texture rendering speed and low occupied storage space. Therefore, the first compression algorithm and the second compression algorithm are simultaneously configured on the terminal equipment, the applicable compression algorithm can be selected according to the type of the texture for texture compression, the advantages of the first compression algorithm and the second compression algorithm are fully utilized, and the mixed use of the compression algorithms on one terminal equipment is realized.
Specifically, the first compression algorithm configured on the terminal device with higher configuration may be a compression algorithm with texture compression capability higher than a first preset condition, and the second compression algorithm may be a compression algorithm with compatibility higher than a second preset condition. Wherein the first preset condition and the second preset condition are set according to actual experience.
For example, the terminal device is a terminal device configured with an apple operating System (IOS) 7 or more, then the first Compression algorithm in the terminal device may be an Ericsson Texture Compression2 (ETC 2) algorithm with higher Texture Compression capability than a first preset condition, and the second Compression algorithm may be a PVR Texture Compression algorithm with higher compatibility than a second preset condition. Thus, when the texture to be compressed is the first type of texture, the ETC2 algorithm with higher texture compression capacity suitable for the first type of texture can be adopted to compress the texture to be compressed, so that the compression quality is ensured; when the texture to be compressed is the second type of texture, the texture to be compressed can be compressed by adopting a PVR texture compression algorithm with higher compatibility and suitable for the second type of texture, so that the rendering speed is increased on the premise of ensuring the compression quality.
The ETC2 algorithm has no limitation on the specification of a texture to be compressed, the ETC2 algorithm is one of standards of an Embedded Open Graphics Library (OpenGLES for Embedded Systems) 3.0, and as long as the terminal device supports OpenGLES3.0, the terminal device necessarily supports ETC 2. ETC2 implements Texture Compression primarily using the Marie Texture Compression Tool (Mali Texture Compression Tool).
The PVR texture compression algorithm has high requirements on the specification of textures to be compressed, the textures to be compressed must be squares and the side length is the nth power of 2. The PVR texture compression algorithm is recommended by apple authorities, the rendering speed is high by adopting the PVR texture compression algorithm, and the occupied memory is extremely small. The PVR texture compression algorithm mainly uses the pvrtextol, which is a PVR texture compression tool.
If the terminal device is a terminal device with a low configuration, it is difficult for the terminal device to configure a compression algorithm with a high texture compression capability, and therefore, when the first type of texture is compressed on the terminal device with a low configuration, a compression algorithm with a high texture compression capability, such as ETC2, cannot be used. However, in order to ensure that the terminal device can reduce the storage space occupied by the texture to be compressed and ensure that a compression result meeting the compression quality requirement is obtained when the compression quality requirement of the texture to be compressed is high, the first compression algorithm configured on the terminal device may be a texture reduction algorithm, which is different from a compression algorithm with high texture compression capability, such as ETC2, and the texture reduction algorithm may be used to reduce the size of the texture to be compressed and/or reduce the precision of the texture to be compressed; correspondingly, in order to ensure that the rendering speed is increased without affecting the compression quality when the compression quality requirement is low, the second compression algorithm configured on the terminal device with low configuration may be a compression algorithm with compatibility higher than a second preset condition.
When the texture reduction algorithm is used to reduce the size of the texture to be compressed, the texture reduction algorithm may reduce the size of the texture to be compressed according to a certain ratio, and the size of the texture to be compressed may be represented by a resolution. For example, the size of the texture to be compressed may be represented as 1280 × 960, and if the size of the texture to be compressed is reduced to one-half of the original size, the size of the resulting compression result is 640 × 480.
The size of the texture to be compressed is reduced through the texture reduction algorithm, so that the size of the texture to be compressed can be reduced in an equal ratio, the storage space of a corresponding ratio can be saved, the texture quality is not particularly influenced, and a compression result meeting the requirement of high compression quality can be obtained.
When the texture reduction algorithm is used to reduce the precision of the texture to be compressed, the precision of the texture to be compressed can be represented by the number of bits of the stored information of a single pixel in the texture to be compressed, and in general, the precision of the texture to be compressed is 32 bits, and when the precision of the texture to be compressed is reduced by the texture reduction algorithm, the precision of the texture to be compressed can be reduced from 32 bits, for example, the precision of the texture to be compressed can be reduced from 32 bits to 24 bits. The precision of the texture to be compressed is reduced from 32 bits to smaller bits, and the texture loss of the obtained compression result is probably larger, so that the precision of the texture to be compressed can be reduced to proper bits according to the compression quality requirement, and the storage space is saved on the premise of not particularly influencing the texture quality.
In general, a convert command is used in a terminal device to implement a texture reduction algorithm, for example, to reduce the size of the texture to be compressed to one half, the texture reduction algorithm may be expressed as follows:
convert${infile}’-resize 50%’${outfile}
wherein, convert is the command used for carrying on the shrinking of the texture to treat the compressed texture; $ infile represents the input file read, i.e., the texture to be compressed; resize 50% means that the specific action of the texture reduction algorithm is to reduce the size of the texture to be compressed to 50%; $ outfile represents the output file read, i.e., the read compression result.
It should be noted that the texture reduction algorithm can be supported by the terminal device with a lower configuration, so that the texture to be compressed with a lower compression quality requirement can be compressed in the terminal device with a lower configuration, and the texture to be compressed with a higher compression quality requirement can also be compressed.
According to the technical scheme, when the texture to be compressed is obtained, the type of the texture to be compressed can be determined according to the preset condition for identifying the compression quality requirement, for example, the first type of texture with relatively high compression quality requirement or the second type of texture with relatively low compression quality requirement. If the texture to be compressed is the first type of texture, it can be clear that the requirement on the compression quality of the texture to be compressed is high, the texture to be compressed needs to be compressed by adopting a first compression algorithm capable of obtaining high compression quality, the loss of an obtained compression result is small relative to the texture to be compressed, and due rendering quality can be ensured when the texture to be compressed is rendered by adopting the compression result. If the texture to be compressed is the second type of texture, the requirement on the compression quality of the texture to be compressed can be definitely low, and the texture to be compressed can be compressed by adopting a second compression algorithm capable of obtaining general compression quality, so that the compression efficiency and the rendering efficiency are improved. By identifying the type of the texture to be compressed, one processing device can configure various compression algorithms, and can automatically select an applicable compression algorithm from the configured various compression algorithms to compress the texture to be compressed according to the identification result of the texture to be compressed, so that the problem caused by the adoption of a single compression algorithm is avoided, and the texture compression requirement can be better met.
The embodiment corresponding to fig. 2 describes how to compress the texture to be compressed, but not all textures may need to be texture compressed.
In some cases, the storage space occupied by some textures is small, and even if the textures are compressed, the storage space is not saved obviously. For example, in the live video broadcasting process, some fixed buttons may exist on a live video broadcasting interface, and storage space occupied by textures corresponding to the fixed buttons is relatively small, so that the textures corresponding to the fixed buttons may not be compressed.
Or, some textures are fragile, even if the compression is performed by using a compression algorithm with high compression capability, the compression result has a large texture loss, and the rendering of the compression result on the video frame may affect the visual effect seen by the user compared with the rendering of the texture to be compressed on the video frame. For example, the texture with the transparent color channel is compressed, and then a large texture loss is likely to occur, and the transparent color channel may be lost, so that the texture which is likely to occur texture loss may not be compressed.
Since which textures do not need to be compressed or which textures with which characteristics need to be known in advance and the textures may have corresponding identifiers, in this embodiment, identifiers corresponding to textures that do not need to be compressed may form an uncompressed identifier set, and whether the texture to be compressed is determined by determining whether the identifier of the texture to be compressed is in the uncompressed identifier set, specifically, referring to fig. 3, in the case that whether the texture to be compressed needs to be compressed is determined, the texture compression method may include:
s301, obtaining the identifier of the texture to be compressed.
The texture to be compressed may have a corresponding identifier, which may be used to distinguish between different textures, each texture having a unique corresponding identifier. The identifier may be a Message Digest Algorithm 5 (MD 5), or may be a number, a symbol, or the like set for different textures.
After the terminal device obtains the texture to be compressed, the identifier of the texture to be compressed can be obtained, so that whether the texture to be compressed needs to be compressed or not can be determined according to the identifier.
S302, determining whether the identifier of the texture to be compressed is in the uncompressed identifier set, if so, executing S303, and if not, executing S304.
The uncompressed identification set comprises at least one identification of texture which does not need to be compressed, the identification of the texture to be compressed is compared with the identification of the texture which does not need to be compressed and is contained in the uncompressed identification set, if the identification of the texture to be compressed is the same as the identification of any texture which does not need to be compressed and is contained in the uncompressed identification set, the identification of the texture to be compressed is in the uncompressed identification set, and at the moment, S303 is executed; otherwise, executing S304-S306 to compress the texture to be compressed.
Wherein, S304-S306 correspond to S201-S203 in sequence, and are not described herein again.
And S303, not compressing the texture to be compressed.
S304, determining the type of texture to be compressed according to a preset condition for identifying the compression quality requirement; if the texture to be compressed is determined to be the first type of texture, S305 is executed, and if the texture to be compressed is determined to be the second type of texture, S306 is executed.
S305, compressing the texture to be compressed by adopting a first compression algorithm applicable to the first type of texture.
S306, compressing the texture to be compressed by adopting a second compression algorithm applicable to the second type of texture.
By determining whether the texture to be compressed needs to be compressed, the texture to be compressed can be guaranteed to be compressed under necessary conditions, and not all the texture to be compressed, so that unnecessary texture compression methods are avoided, and the texture rendering speed is increased.
The corresponding embodiment of fig. 3 describes how to determine whether a texture to be compressed needs to be compressed, which enables that the texture to be compressed is not compressed without compressing the texture to be compressed, so that the texture to be compressed can be rendered itself onto a video frame. Next, another method of determining whether or not a texture to be compressed needs to be compressed will be described.
In some cases, a texture has been previously compressed and the corresponding compressed texture is obtained. If the texture that needs to be rendered onto the video frame at this time still includes the texture, the texture is not modified or otherwise changed from the previous texture, and for the texture, since the compressed texture corresponding to the texture has been obtained by compression before, in order to increase the rendering speed of the texture and avoid unnecessary data processing, the texture compression method of S201-S203 does not need to be re-executed to re-compress the texture to obtain the compression result of the texture, and the previously obtained compressed texture can be directly used as the compression result of the texture at this time.
To this end, each time a texture is compressed, the identity of the texture when uncompressed may be saved to form a set of compressed identities. After the compressed texture is obtained, the corresponding relationship between the compressed texture and the identifier of the texture corresponding to the compressed texture when the compressed texture is not compressed can be stored, so that when the texture to be compressed is obtained next time, whether the texture to be compressed is recompressed can be determined by whether the identifier of the texture to be compressed is matched with any identifier in the compressed identifier set. Specifically, referring to fig. 4, in the case that it needs to be determined whether the texture to be compressed needs to be compressed, the texture compression method may include:
s401, obtaining the identifier of the texture to be compressed.
The texture to be compressed may have a corresponding identifier, which may be used to distinguish between different textures, each texture having a unique corresponding identifier. In this embodiment, the compressed texture may be used as a compression result of the texture to be compressed on the premise that the texture to be compressed and the corresponding texture of the compressed texture when uncompressed should be completely consistent, and no modification or other change should occur, so that the identifier in this embodiment may be MD5, and MD5 may reflect whether the texture to be compressed is modified relative to the compressed texture when uncompressed, and once the modification occurs, the MD5 of the texture to be compressed and the MD5 of the texture to be compressed when uncompressed may be different, so that it may be accurately determined whether the texture to be compressed has been previously compressed.
For example, texture A, i.e., the texture of the compressed texture when uncompressed, is compressed to obtain compressed texture B, and MD5 of texture A, i.e., MD5 of the compressed texture when uncompressed. For texture C to be compressed, if texture C to be compressed is modified relative to texture a, MD5 of texture C to be compressed is different from MD5 of texture a, i.e., MD5 of texture C to be compressed is different from MD5 of the compressed texture when uncompressed; if texture C to be compressed is identical to texture A, then MD5 of texture C to be compressed is identical to MD5 of texture A, i.e., MD5 to be compressed is identical to MD5 of the compressed texture when uncompressed.
S402, matching the identifier of the texture to be compressed with a compressed identifier set, if the identifier of the texture to be compressed is matched with a target identifier in the compressed identifier set, executing S403, otherwise, executing S404.
The compressed identification set comprises an identification of at least one compressed texture when uncompressed. Matching the identifier of the texture to be compressed with the identifier of the compressed texture in the compressed identifier set when the texture is not compressed, and if the identifier of the texture to be compressed matches with the identifier of the compressed texture in the compressed identifier set when the texture is not compressed, for example, matches with the target identifier, it indicates that the texture to be compressed has been compressed before and the corresponding compressed texture is obtained, at this time, executing S403; otherwise, executing S404-S406 to compress the texture to be compressed.
S404-S406 correspond to S201-S203 in sequence, and are not described herein again.
S403, if the identifier of the texture to be compressed is matched with the target identifier in the compressed identifier set, taking the compressed texture corresponding to the target identifier as the compression result of the texture to be compressed.
The compression result is also a compressed texture, the compression result is used to represent the texture obtained by this texture compression, and the compressed texture is used to represent the texture obtained by the previous texture compression.
S404, determining the type of texture to be compressed according to a preset condition for identifying the compression quality requirement, executing S405 if the texture to be compressed is determined to be a first type of texture, and executing S406 if the texture to be compressed is determined to be a second type of texture.
S405, compressing the texture to be compressed by adopting a first compression algorithm applicable to the first type of texture.
S406, compressing the texture to be compressed by adopting a second compression algorithm applicable to the second type of texture.
By determining whether the texture to be compressed needs to be compressed or not, the texture compression can be directly used as the compression result of the texture to be compressed without performing the texture compression again under the condition that the compressed texture corresponding to the texture to be compressed is obtained through the texture compression, so that the texture compression method is prevented from being performed again, the texture rendering speed is increased, and the time consumption for repeatedly performing the texture compression is reduced.
Next, the texture compression method will be described with reference to a specific application scenario. In the scene, the types of textures include a first type of texture and a second type of texture, wherein the first type of texture is a texture with a high compression quality requirement, the second type of texture is a texture with a low compression quality requirement, the first compression algorithm is an ETC2 algorithm or a texture reduction algorithm, the texture reduction algorithm is used for reducing the size of the texture to be compressed by half, and the second compression algorithm is a PVR compression algorithm. At this time, a schematic view of an application scenario of the texture compression method is shown in fig. 5.
In a scenario corresponding to fig. 5, referring to fig. 6, the method includes:
s601, determining the type of texture to be compressed according to a preset condition for identifying the compression quality requirement.
And S602, if the texture to be compressed is determined to be the texture with higher compression quality requirement and the terminal equipment is configured with higher terminal equipment, compressing the texture to be compressed by adopting an ETC2 algorithm to obtain an ETC2 texture.
S603, if the texture to be compressed is determined to be the texture with higher compression quality requirement and the terminal equipment is configured with lower terminal equipment, compressing the texture to be compressed by adopting a texture reduction algorithm to obtain the texture with half the size.
S604, if the texture to be compressed is determined to be the texture with lower compression quality requirement, compressing the texture to be compressed by adopting a PVR compression algorithm to obtain the PVR texture.
According to the technical scheme, when the texture to be compressed is obtained, the type of the texture to be compressed can be determined according to the preset condition for identifying the compression quality requirement, for example, the first type of texture with relatively high compression quality requirement or the second type of texture with relatively low compression quality requirement. If the texture to be compressed is the first type of texture, it can be clear that the requirement on the compression quality of the texture to be compressed is high, the texture to be compressed needs to be compressed by adopting a first compression algorithm capable of obtaining high compression quality, the loss of an obtained compression result is small relative to the texture to be compressed, and due rendering quality can be ensured when the texture to be compressed is rendered by adopting the compression result. If the texture to be compressed is the second type of texture, the requirement on the compression quality of the texture to be compressed can be definitely low, and the texture to be compressed can be compressed by adopting a second compression algorithm capable of obtaining general compression quality, so that the compression efficiency and the rendering efficiency are improved. By identifying the type of the texture to be compressed, one processing device can configure various compression algorithms, and can automatically select an applicable compression algorithm from the configured various compression algorithms to compress the texture to be compressed according to the identification result of the texture to be compressed, so that the problem caused by the adoption of a single compression algorithm is avoided, and the texture compression requirement can be better met.
Based on the texture compression method provided by the foregoing embodiment, the present embodiment provides a texture compression apparatus 700, and referring to fig. 7a, the apparatus 700 includes a first determining unit 701, a first compression unit 702, and a second compression unit 703:
the first determining unit 701 is configured to determine a type of a texture to be compressed according to a preset condition for identifying a compression quality requirement;
the first compressing unit 702 is configured to compress the texture to be compressed by using a first compression algorithm applicable to the first type of texture if the first determining unit 701 determines that the texture to be compressed is the first type of texture;
the second compressing unit 703 is configured to compress the texture to be compressed by using a second compression algorithm applicable to the second type of texture if the first determining unit 701 determines that the texture to be compressed is the second type of texture;
wherein the compression quality requirement of the first type of texture is higher than the compression quality requirement of the second type of texture.
In one implementation, the preset condition includes a size requirement of the texture and/or whether there is a specified color channel.
In one implementation, referring to fig. 7b, the apparatus 700 further includes a first obtaining unit 704, a second determining unit 705, and a non-compressing unit 706:
the first obtaining unit 704 is configured to obtain an identifier of the texture to be compressed;
the second determining unit 705 is configured to determine whether an identifier of the texture to be compressed is in an uncompressed identifier set, where the uncompressed identifier set includes at least one identifier of a texture that does not need to be compressed;
the uncompressing unit 706 is configured to determine, by the second determining unit 705, that the identifier of the texture to be compressed is in the uncompressed identifier set, and uncompress the texture to be compressed.
In one implementation, referring to fig. 7c, the apparatus 700 further includes a second obtaining unit 707, a matching unit 708, and a third determining unit 709:
the second obtaining unit 707, configured to obtain an identifier of the texture to be compressed;
the matching unit 708 is configured to match the identifier of the texture to be compressed with a compressed identifier set, where the compressed identifier set includes an identifier of at least one compressed texture when the texture is not compressed;
the third determining unit 709 is configured to, if the matching unit determines that the identifier of the texture to be compressed matches the target identifier in the compressed identifier set, use the compressed texture corresponding to the target identifier as the compression result of the texture to be compressed.
In one implementation, the first compression algorithm is a compression algorithm with texture compression capability higher than a first preset condition; the second compression algorithm is a compression algorithm with the compatibility higher than a second preset condition;
alternatively, the first and second electrodes may be,
the first compression algorithm is a texture reduction algorithm and is used for reducing the size of the texture to be compressed and/or reducing the precision of the texture to be compressed; the second compression algorithm is a compression algorithm with compatibility higher than the second preset condition.
It can be seen from the foregoing technical solutions that, when obtaining a texture to be compressed, the first determining unit 701 may determine a type of the texture to be compressed according to a preset condition for identifying a compression quality requirement, for example, whether the texture is a first type of texture with a relatively high compression quality requirement or a second type of texture with a relatively low compression quality requirement. If the first determining unit 701 determines that the texture to be compressed is the first-class texture, it may be clear that the requirement on the compression quality of the texture to be compressed is relatively high, and the first compressing unit 702 needs to compress the texture to be compressed by using the first compression algorithm capable of obtaining high compression quality, so that the loss of the obtained compression result is relatively small compared with that of the texture to be compressed, and the due rendering quality can be ensured when rendering is performed by using the compression result. If the first determining unit 701 determines that the texture to be compressed is the second type of texture, it may be clear that the requirement on the compression quality of the texture to be compressed is not high, and the second compressing unit 703 may compress the texture to be compressed by using a second compression algorithm capable of obtaining a general compression quality, thereby improving the compression efficiency and the rendering efficiency. By identifying the type of the texture to be compressed, one processing device can configure various compression algorithms, and can automatically select an applicable compression algorithm from the configured various compression algorithms to compress the texture to be compressed according to the identification result of the texture to be compressed, so that the problem caused by the adoption of a single compression algorithm is avoided, and the texture compression requirement can be better met.
The embodiment of the present application further provides an apparatus for texture compression, which is described below with reference to the accompanying drawings. Referring to fig. 8, an embodiment of the present application provides a device 800 for texture compression, where the device 800 may be a server, may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 822 (e.g., one or more processors) and a memory 832, and one or more storage media 830 (e.g., one or more mass storage devices) storing an application 842 or data 844. Memory 832 and storage medium 830 may be, among other things, transient or persistent storage. The program stored in the storage medium 830 may include one or more modules (not shown), each of which may include a series of instruction operations for the server. Still further, the central processor 822 may be configured to communicate with the storage medium 830 to execute a series of instructional operations on the storage medium 830 on the device 800 for athletic performance.
The apparatus 800 for athletic performance demonstration may also include one or more power supplies 826, one or more wired or wireless network interfaces 850, one or more input-output interfaces 858, and/or one or more operating systems 841, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The steps performed by the server in the above embodiments may be based on the server structure shown in fig. 8.
The CPU 822 is configured to execute the following steps:
determining the type of texture to be compressed according to a preset condition for identifying the compression quality requirement;
if the texture to be compressed is determined to be a first type of texture, compressing the texture to be compressed by adopting a first compression algorithm applicable to the first type of texture;
if the texture to be compressed is determined to be a second type of texture, compressing the texture to be compressed by adopting a second compression algorithm applicable to the second type of texture;
wherein the compression quality requirement of the first type of texture is higher than the compression quality requirement of the second type of texture.
Referring to fig. 9, an embodiment of the present application provides an apparatus 900 for texture compression, where the apparatus 900 may also be a terminal apparatus, and the terminal apparatus may be any terminal apparatus including a mobile phone, a tablet computer, a Personal Digital Assistant (PDA), a Point of Sales (POS), a vehicle-mounted computer, and the terminal apparatus is a mobile phone:
fig. 9 is a block diagram illustrating a partial structure of a mobile phone related to a terminal device provided in an embodiment of the present application. Referring to fig. 9, the handset includes: a Radio Frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, a processor 980, and a power supply 990. Those skilled in the art will appreciate that the handset configuration shown in fig. 9 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 9:
the RF circuit 910 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, for receiving downlink information of a base station and then processing the received downlink information to the processor 980; in addition, data for designing uplink is transmitted to the base station. In general, RF circuit 910 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuit 910 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), and the like.
The memory 920 may be used to store software programs and modules, and the processor 980 may execute various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 920. The memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 920 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 930 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 930 may include a touch panel 931 and other input devices 932. The touch panel 931, also referred to as a touch screen, may collect a touch operation performed by a user on or near the touch panel 931 (e.g., a user's operation on or near the touch panel 931 using a finger, a stylus, or any other suitable object or accessory), and drive a corresponding connection device according to a preset program. Alternatively, the touch panel 931 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 980, and can receive and execute commands sent by the processor 980. In addition, the touch panel 931 may be implemented by various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 930 may include other input devices 932 in addition to the touch panel 931. In particular, other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 940 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The Display unit 940 may include a Display panel 941, and optionally, the Display panel 941 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 931 may cover the display panel 941, and when the touch panel 931 detects a touch operation on or near the touch panel 931, the touch operation is transmitted to the processor 980 to determine the type of the touch event, and then the processor 980 provides a corresponding visual output on the display panel 941 according to the type of the touch event. Although in fig. 9, the touch panel 931 and the display panel 941 are two independent components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 931 and the display panel 941 may be integrated to implement the input and output functions of the mobile phone.
The handset may also include at least one sensor 950, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 941 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 941 and/or backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the posture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
Audio circuitry 960, speaker 961, microphone 962 may provide an audio interface between a user and a cell phone. The audio circuit 960 may transmit the electrical signal converted from the received audio data to the speaker 961, and convert the electrical signal into a sound signal for output by the speaker 961; on the other hand, the microphone 962 converts the collected sound signal into an electrical signal, converts the electrical signal into audio data after being received by the audio circuit 960, and outputs the audio data to the processor 980 for processing, and then transmits the audio data to, for example, another mobile phone through the RF circuit 910, or outputs the audio data to the memory 920 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 970, and provides wireless broadband Internet access for the user. Although fig. 9 shows the WiFi module 970, it is understood that it does not belong to the essential constitution of the handset, and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 980 is a control center of the mobile phone, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 920 and calling data stored in the memory 920, thereby integrally monitoring the mobile phone. Alternatively, processor 980 may include one or more processing units; preferably, the processor 980 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 980.
The handset also includes a power supply 990 (e.g., a battery) for supplying power to the various components, which may preferably be logically connected to the processor 980 via a power management system, thereby providing management of charging, discharging, and power consumption via the power management system.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
In this embodiment, the processor 980 included in the terminal device further has the following functions:
determining the type of texture to be compressed according to a preset condition for identifying the compression quality requirement;
if the texture to be compressed is determined to be a first type of texture, compressing the texture to be compressed by adopting a first compression algorithm applicable to the first type of texture;
if the texture to be compressed is determined to be a second type of texture, compressing the texture to be compressed by adopting a second compression algorithm applicable to the second type of texture;
wherein the compression quality requirement of the first type of texture is higher than the compression quality requirement of the second type of texture.
The embodiment of the present application further provides a computer-readable storage medium for storing a program code, where the program code is configured to execute any one implementation of the texture compression method described in the foregoing embodiments.
The terms "first," "second," "third," "fourth," and the like in the description of the application and the above-described figures, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method of texture compression, the method comprising:
determining the type of texture to be compressed according to a preset condition for identifying the compression quality requirement;
if the texture to be compressed is determined to be a first type of texture, compressing the texture to be compressed by adopting a first compression algorithm applicable to the first type of texture;
if the texture to be compressed is determined to be a second type of texture, compressing the texture to be compressed by adopting a second compression algorithm applicable to the second type of texture;
wherein the compression quality requirement of the first type of texture is higher than the compression quality requirement of the second type of texture;
the first compression algorithm is a compression algorithm with texture compression capacity higher than a first preset condition; the second compression algorithm is a compression algorithm with the compatibility higher than a second preset condition;
alternatively, the first and second electrodes may be,
the first compression algorithm is a texture reduction algorithm and is used for reducing the size of the texture to be compressed and/or reducing the precision of the texture to be compressed; the second compression algorithm is a compression algorithm with compatibility higher than the second preset condition.
2. The method of claim 1, wherein the predetermined condition comprises a size requirement of the texture and/or whether there is a designated color channel.
3. The method of claim 1, further comprising:
acquiring an identifier of the texture to be compressed;
determining whether the identifier of the texture to be compressed is in an uncompressed identifier set, wherein the uncompressed identifier set comprises at least one identifier of the texture which does not need to be compressed;
and if so, not compressing the texture to be compressed.
4. The method of claim 1, further comprising:
acquiring an identifier of the texture to be compressed;
matching the identifier of the texture to be compressed with a compressed identifier set, wherein the compressed identifier set comprises identifiers of at least one compressed texture when the texture is not compressed;
and if the identifier of the texture to be compressed is matched with the target identifier in the compressed identifier set, taking the compressed texture corresponding to the target identifier as a compression result of the texture to be compressed.
5. A texture compression apparatus, characterized in that the apparatus comprises a first determining unit, a first compressing unit, and a second compressing unit:
the first determining unit is used for determining the type of the texture to be compressed according to a preset condition for identifying the compression quality requirement;
the first compression unit is configured to compress the texture to be compressed by using a first compression algorithm applicable to the first type of texture if the first determination unit determines that the texture to be compressed is the first type of texture;
the second compression unit is configured to compress the texture to be compressed by using a second compression algorithm applicable to the second type of texture if the first determination unit determines that the texture to be compressed is the second type of texture;
wherein the compression quality requirement of the first type of texture is higher than the compression quality requirement of the second type of texture;
the first compression algorithm is a compression algorithm with texture compression capacity higher than a first preset condition; the second compression algorithm is a compression algorithm with the compatibility higher than a second preset condition;
alternatively, the first and second electrodes may be,
the first compression algorithm is a texture reduction algorithm and is used for reducing the size of the texture to be compressed and/or reducing the precision of the texture to be compressed; the second compression algorithm is a compression algorithm with compatibility higher than the second preset condition.
6. The apparatus of claim 5, wherein the predetermined condition comprises a size requirement of the texture and/or whether there is a designated color channel.
7. The apparatus of claim 5, further comprising a first obtaining unit, a second determining unit, and an uncompressing unit:
the first obtaining unit is used for obtaining the identifier of the texture to be compressed;
the second determining unit is configured to determine whether the identifier of the texture to be compressed is in an uncompressed identifier set, where the uncompressed identifier set includes at least one identifier of a texture that does not need to be compressed;
and the uncompressing unit is configured to uncompress the texture to be compressed if the second determining unit determines that the identifier of the texture to be compressed is in the uncompressed identifier set.
8. The apparatus according to claim 5, further comprising a second obtaining unit, a matching unit, and a third determining unit:
the second obtaining unit is used for obtaining the identifier of the texture to be compressed;
the matching unit is used for matching the identifier of the texture to be compressed with a compressed identifier set, wherein the compressed identifier set comprises identifiers of at least one compressed texture when the texture is not compressed;
and the third determining unit is configured to, if the matching unit determines that the identifier of the texture to be compressed matches the target identifier in the compressed identifier set, use the compressed texture corresponding to the target identifier as the compression result of the texture to be compressed.
9. An apparatus for texture compression, the apparatus comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the texture compression method of any one of claims 1-4 according to instructions in the program code.
10. A computer-readable storage medium for storing a computer program according to which a processor performs the texture compression method of any one of claims 1-4.
CN201810799211.4A 2018-07-19 2018-07-19 Texture compression method, device, equipment and storage medium Active CN110740325B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810799211.4A CN110740325B (en) 2018-07-19 2018-07-19 Texture compression method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810799211.4A CN110740325B (en) 2018-07-19 2018-07-19 Texture compression method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110740325A CN110740325A (en) 2020-01-31
CN110740325B true CN110740325B (en) 2022-07-08

Family

ID=69235300

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810799211.4A Active CN110740325B (en) 2018-07-19 2018-07-19 Texture compression method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110740325B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6959110B1 (en) * 2000-08-17 2005-10-25 Nvidia Corporation Multi-mode texture compression algorithm
CN103886623A (en) * 2012-12-19 2014-06-25 华为技术有限公司 Image compression method and equipment, and system
CN104025561A (en) * 2012-11-23 2014-09-03 华为技术有限公司 Image compression method and image processing apparatus

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9665951B2 (en) * 2007-12-20 2017-05-30 Telefonaktiebolaget Lm Ericsson (Publ) Unified compression/decompression graphics architecture
US9159114B2 (en) * 2013-11-08 2015-10-13 Qualcomm Incorporated Texture decompression for graphics processors

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6959110B1 (en) * 2000-08-17 2005-10-25 Nvidia Corporation Multi-mode texture compression algorithm
CN104025561A (en) * 2012-11-23 2014-09-03 华为技术有限公司 Image compression method and image processing apparatus
CN103886623A (en) * 2012-12-19 2014-06-25 华为技术有限公司 Image compression method and equipment, and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于混合编码的图像纹理压缩方法;韩培友等;《微电子学与计算机》;20061220(第11期);第1,3,4节 *

Also Published As

Publication number Publication date
CN110740325A (en) 2020-01-31

Similar Documents

Publication Publication Date Title
CN111544886B (en) Picture display method and related device
CN110138769B (en) Image transmission method and related device
CN110021256B (en) Display brightness adjusting method and related product
US9697622B2 (en) Interface adjustment method, apparatus, and terminal
US20190080120A1 (en) Unlocking methods and related products
CN106569910B (en) Data backup and transmission method and mobile terminal
CN106844580B (en) Thumbnail generation method and device and mobile terminal
CN106911848B (en) Method for outputting prompt message and terminal equipment
CN109922539B (en) Network connection method and related product
CN108108137B (en) Display control method and related product
CN108200421B (en) White balance processing method, terminal and computer readable storage medium
CN106445970B (en) Loading processing method and device for placeholder map
CN108460769B (en) image processing method and terminal equipment
CN106339894B (en) Screen-locked magazine pushing method, screen-locked magazine playing method and related equipment
CN112019929A (en) Volume adjusting method and device
CN107864299B (en) Picture display method and related product
CN110851350A (en) Method and device for monitoring white screen of web page interface
US10515613B2 (en) Method of processing images and apparatus
CN108877733B (en) Color temperature adjusting method and related device
CN112691363A (en) Cross-terminal switching method and related device for cloud games
CN108121583B (en) Screen capturing method and related product
CN107292833B (en) Image processing method and device and mobile terminal
CN106293407B (en) Picture display method and terminal equipment
CN107835336B (en) Dual-camera frame synchronization method and device, user terminal and storage medium
CN110740325B (en) Texture compression method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40020192

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant