CN114897662A - Thumbnail generation method based on GPU acceleration and storage medium - Google Patents

Thumbnail generation method based on GPU acceleration and storage medium Download PDF

Info

Publication number
CN114897662A
CN114897662A CN202210297448.9A CN202210297448A CN114897662A CN 114897662 A CN114897662 A CN 114897662A CN 202210297448 A CN202210297448 A CN 202210297448A CN 114897662 A CN114897662 A CN 114897662A
Authority
CN
China
Prior art keywords
thumbnail
gpu
picture
client
resolution
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.)
Pending
Application number
CN202210297448.9A
Other languages
Chinese (zh)
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.)
Jinqianmao Technology Co ltd
Original Assignee
Jinqianmao Technology 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 Jinqianmao Technology Co ltd filed Critical Jinqianmao Technology Co ltd
Priority to CN202210297448.9A priority Critical patent/CN114897662A/en
Publication of CN114897662A publication Critical patent/CN114897662A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/04Protocols for data compression, e.g. ROHC

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a thumbnail generation method based on GPU acceleration and a storage medium, wherein a server receives a picture uploading request, and acquires and stores an original picture in the picture uploading request; calling GPU resources of a storage server, and generating and storing a thumbnail by the GPU through a thumbnail generation algorithm; acquiring a picture browsing request of a client, and returning a thumbnail according to the picture browsing request; after receiving the pictures uploaded by the user, the server remarkably accelerates the generation speed of the thumbnail by means of the computing power of the GPU, and the operation tasks of the thumbnail generation part are completed on the GPU, so that a multi-core computing power optimization program of the GPU can be fully utilized, the computing efficiency is improved, and the display of a network disk front-end user has a better real-time effect.

Description

Thumbnail generation method based on GPU acceleration and storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a thumbnail generation method based on GPU acceleration and a storage medium.
Background
With the use of the mobile internet, the network disk is used more and more, and data, pictures and files of users are stored in the network disk, wherein the pictures occupy the most part of the capacity of the network disk. A GMP picture of size 800 × 600 occupies about 1.4MB of file size 800 × 600 × 3 — 1440000 bytes, and the pure data portion is reduced to about 200KB after JPEG compression. For some network disk systems, some network disk servers may not perform thumbnail processing on pictures, generate thumbnails in real time during browsing, but when too many pictures are available, the required waiting time is too long; meanwhile, if too many pictures are uploaded at the same time, the real-time generation speed of the network disk server is influenced, and further the user experience is influenced.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the thumbnail generation method and the storage medium based on GPU acceleration are provided, the thumbnail generation speed is effectively improved, and user experience is improved.
In order to solve the technical problems, the invention adopts the technical scheme that:
a thumbnail generation method based on GPU acceleration comprises the following steps:
s1, receiving a picture uploading request, and acquiring and storing an original picture therein;
s2, calling GPU resources of the storage server, and generating and storing a thumbnail through a thumbnail generation algorithm by the GPU;
and S3, acquiring a picture browsing request of the client, and returning the thumbnail according to the picture browsing request.
Further, the step S2 specifically includes:
s21, calling GPU resources of the storage server, and generating more than one thumbnail by the GPU through a thumbnail generation algorithm, wherein each thumbnail can be adapted to the size or resolution of one client type;
s22, storing the thumbnail and the original picture in a related mode;
the step S3 specifically includes:
and acquiring a picture browsing request of a client, selecting a scaling chart with a corresponding size or resolution according to client state information contained in the picture browsing request, and returning.
Further, the step S2 is specifically:
calling GPU resources of a storage server, judging whether the resolution of the original picture is smaller than a preset threshold value, if so, processing the thumbnail through an image enhancement algorithm of a GPU, and otherwise, generating the thumbnail through a thumbnail generation algorithm by the GPU;
and storing the thumbnail and the original picture in a correlated manner.
Further, the client state information includes client type, resolution, or wire speed information.
As can be seen from the above description, the consideration for selecting the thumbnail includes the client type, resolution or network speed, and is selected according to the display condition of the client, and a smaller picture return can be selected for faster browsing when the network speed of the client is poor.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
s1, receiving a picture uploading request, and acquiring and storing an original picture therein;
s2, calling GPU resources of the storage server, and generating and storing a thumbnail through a thumbnail generation algorithm by the GPU;
and S3, acquiring a picture browsing request of the client, and returning the thumbnail according to the picture browsing request.
Further, the step S2 specifically includes:
s21, calling GPU resources of the storage server, and generating more than one thumbnail by the GPU through a thumbnail generation algorithm, wherein each thumbnail can be adapted to the size or resolution of one client type;
s22, storing the thumbnail and the original picture in a related mode;
the step S3 specifically includes:
and acquiring a picture browsing request of a client, selecting a scaling chart with a corresponding size or resolution according to client state information contained in the picture browsing request, and returning.
Further, the step S2 is specifically:
calling GPU resources of a storage server, judging whether the resolution of the original picture is smaller than a preset threshold value, if so, processing the thumbnail through an image enhancement algorithm of the GPU, otherwise, generating the thumbnail through a thumbnail generation algorithm by the GPU;
and storing the thumbnail and the original picture in a correlated manner.
Further, the client state information includes client type, resolution, or wire speed information.
As can be seen from the above description, the consideration for selecting the thumbnail includes the client type, resolution or network speed, and is selected according to the display condition of the client, and a smaller picture return can be selected for faster browsing when the network speed of the client is poor.
The invention has the beneficial effects that: according to the thumbnail generation method and the storage medium based on GPU acceleration, after the server receives the pictures uploaded by the user, the generation speed of the thumbnail is remarkably accelerated by means of the computing power of the GPU, and especially the user experience during batch picture uploading is met. By putting the operation tasks of the thumbnail generation part on the GPU for completion, the multi-core operation capability optimization program of the GPU can be fully utilized, the calculation efficiency is improved, and the display of a network disk front-end user has a better real-time effect.
Drawings
Fig. 1 is a flowchart of a thumbnail generation method based on GPU acceleration according to an embodiment of the present invention;
fig. 2 is a schematic diagram of an architecture of a thumbnail generation method based on GPU acceleration according to an embodiment of the present invention;
fig. 3 is a detailed flowchart of a thumbnail generation method based on GPU acceleration according to an embodiment of the present invention.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
Referring to fig. 1, a thumbnail generation method based on GPU acceleration includes the steps of:
s1, receiving a picture uploading request, and acquiring and storing an original picture therein;
s2, calling GPU resources of the storage server, and generating and storing a thumbnail through a thumbnail generation algorithm by the GPU;
and S3, acquiring a picture browsing request of the client, and returning the thumbnail according to the picture browsing request.
From the above description, the beneficial effects of the present invention are: according to the thumbnail generation method based on GPU acceleration and the server, after the picture uploaded by the user is received, the generation speed of the thumbnail is remarkably accelerated by means of the computing power of the GPU, the operation task of the thumbnail generation part is completed on the GPU, the multi-core operation power optimization program of the GPU can be fully utilized, the computing efficiency is improved, and the display of the user at the front end of the network disk has a better real-time effect.
Further, the step S2 specifically includes:
s21, calling GPU resources of the storage server, and generating more than one thumbnail by the GPU through a thumbnail generation algorithm, wherein each thumbnail can be adapted to the size or resolution of one client type;
s22, storing the thumbnail and the original picture in a related mode;
the step S3 specifically includes:
and acquiring a picture browsing request of a client, selecting a scaling chart with a corresponding size or resolution according to client state information contained in the picture browsing request, and returning.
According to the description, after the user uploads the picture, the thumbnail which is corresponding to the picture and is adaptive to various client types, sizes or resolutions is generated, even though the client viewed by the user each time is possibly different, the appropriate thumbnail can be returned in time for the user to view, and the use experience of the user is improved.
Further, the step S2 is specifically:
calling GPU resources of a storage server, judging whether the resolution of the original picture is smaller than a preset threshold value, if so, processing the thumbnail through an image enhancement algorithm of the GPU, otherwise, generating the thumbnail through a thumbnail generation algorithm by the GPU;
and storing the thumbnail and the original picture in a correlated manner.
According to the description, when the pictures uploaded by the client are not clear enough, the generated thumbnails can be more fuzzy, and viewing is influenced, so that the thumbnails are processed through an image enhancement algorithm of the GPU and then stored, the thumbnails are clearer, and the use experience of a user is improved.
Further, the client state information includes client type, resolution, or wire speed information.
As can be seen from the above description, the consideration for selecting the thumbnail includes the client type, resolution or network speed, and is selected according to the display condition of the client, and a smaller picture return can be selected for faster browsing when the network speed of the client is poor.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
s1, receiving a picture uploading request, and acquiring and storing an original picture therein;
s2, calling GPU resources of the storage server, and generating and storing a thumbnail through a thumbnail generation algorithm by the GPU;
and S3, acquiring a picture browsing request of the client, and returning the thumbnail according to the picture browsing request.
From the above description, the beneficial effects of the present invention are: according to the thumbnail generation method based on GPU acceleration and the server, after the picture uploaded by the user is received, the generation speed of the thumbnail is remarkably accelerated by means of the computing power of the GPU, the operation task of the thumbnail generation part is completed on the GPU, the multi-core operation power optimization program of the GPU can be fully utilized, the computing efficiency is improved, and the display of the user at the front end of the network disk has a better real-time effect.
The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
Further, the step S2 specifically includes:
s21, calling GPU resources of the storage server, and generating more than one thumbnail by the GPU through a thumbnail generation algorithm, wherein each thumbnail can be adapted to the size or resolution of one client type;
s22, storing the thumbnail and the original picture in a related mode;
the step S3 specifically includes:
and acquiring a picture browsing request of a client, selecting a scaling chart with a corresponding size or resolution according to client state information contained in the picture browsing request, and returning.
According to the description, after the user uploads the picture, the thumbnail which is corresponding to the picture and is adaptive to various client types, sizes or resolutions is generated, even though the client viewed by the user each time is possibly different, the appropriate thumbnail can be returned in time for the user to view, and the use experience of the user is improved.
Further, the step S2 is specifically:
calling GPU resources of a storage server, judging whether the resolution of the original picture is smaller than a preset threshold value, if so, processing the thumbnail through an image enhancement algorithm of the GPU, otherwise, generating the thumbnail through a thumbnail generation algorithm by the GPU;
and storing the thumbnail and the original picture in a correlated manner.
According to the description, when the pictures uploaded by the client are not clear enough, the generated thumbnails can be more fuzzy, and the viewing is influenced, so that the thumbnails are processed through the image enhancement algorithm of the GPU and then stored, the thumbnails are clearer, and the use experience of a user is improved.
Further, the client state information includes client type, resolution, or wire speed information.
As can be seen from the above description, the consideration for selecting the thumbnail includes the client type, resolution or network speed, and is selected according to the display condition of the client, and a smaller picture return can be selected for faster browsing when the network speed of the client is poor.
The thumbnail generation method and the storage medium based on GPU acceleration are suitable for scenes that a server needs to generate thumbnails for the client to browse after the client uploads pictures to the server, such as cloud disk file storage and the like.
Referring to fig. 1 to fig. 3, a first embodiment of the present invention is:
a thumbnail generation method based on GPU acceleration comprises the following steps:
and S1, receiving the picture uploading request, and acquiring and storing the original picture therein.
In this embodiment, a server served by a cloud disk is taken as an example. In the present embodiment, as shown in fig. 2, the servers are divided into a front-end service, a back-end service, and a thumbnail map database. The front-end server, the back-end server and the thumbnail map database can be the same entity server, and the front-end service, the back-end service and the thumbnail map database can be arbitrarily split and erected in two or more entity servers.
In this embodiment, the front-end server is responsible for receiving request information of the client, including functions of picture uploading, picture browsing, and the like; the storage server is responsible for storing the picture information uploaded by the client, and is also responsible for generating a thumbnail, and particularly, the storage server is configured with a GPU hardware accelerator card; the thumbnail database is used for storing the corresponding relation between the original image and the thumbnail, and particularly, a plurality of thumbnails of the same picture correspond to different client devices, so that one picture in the database corresponds to a plurality of thumbnails.
In this embodiment, first, a server receives a picture upload request from a client. Specifically, a front-end server of the network disk receives a picture uploading request, the request is forwarded to a back-end storage server, and the back-end storage server acquires and stores an original picture therein.
S2, calling GPU resources of the storage server, and generating and storing a thumbnail through a thumbnail generation algorithm by the GPU;
the step S2 specifically includes:
s21, calling GPU resources of the storage server, and generating more than one thumbnail by the GPU through a thumbnail generation algorithm, wherein each thumbnail can be adapted to the size or resolution of one client type;
in this embodiment, the back-end storage server calls the GPU resources thereon, and generates a plurality of types of thumbnails with different sizes and different resolutions by using a thumbnail generation algorithm of the GPU written by the CUDA. The generated thumbnail format can also be in a plurality of different formats, such as jpeg, png and the like.
The thumbnail generation algorithm includes but is not limited to: thumbnail generation algorithms that scale the original pictures and some customized thumbnail clipping generation algorithms. The corresponding sizes of different clients are predefined in a configuration file, for example, different thumbnail sizes are predefined for different devices such as a notebook, a PAD and a mobile phone, so that thumbnails with different sizes are generated when the thumbnails are generated.
And judging whether the resolution of the original picture is smaller than a preset threshold value, if so, processing the thumbnail through an image enhancement algorithm of a GPU.
In this embodiment, for an original image that is not clear and uploaded by the client, that is, for an original image with a low resolution, the GPU card is called, and then a clear thumbnail image needs to be generated by using an image enhancement algorithm.
And S22, storing the thumbnail and the original picture in a related mode.
In this embodiment, the back-end storage server stores the generated thumbnails and original pictures, and writes the correspondence between the original pictures and the thumbnails in the thumbnail database. And the front-end server returns a message to the client to confirm that the picture is uploaded completely.
S3, acquiring a picture browsing request of the client, and returning a thumbnail according to the picture browsing request;
the step S3 specifically includes:
acquiring a picture browsing request of a client, selecting a scaling chart with a corresponding size or resolution according to client state information contained in the picture browsing request, and returning the scaling chart;
the client state information includes client type, resolution, or network speed information.
In this embodiment, the client sends a picture browsing request through a web page or an application program. The program of the server is divided into three modules of request analysis, thumbnail generation and thumbnail query. At the moment, the request analysis module analyzes the received picture browsing request to obtain information such as the client type, resolution, network speed and the like of the client; and the thumbnail query module selects the thumbnail information which is stored in advance and is matched with the client from the thumbnail database in the network disk server, so that the corresponding thumbnail is obtained and returned to the client. The request analysis module and the thumbnail query module can be arranged in a front-end server, and the thumbnail generation module is arranged in a storage server.
The second embodiment of the invention is as follows:
a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps in the first embodiment above.
The thumbnail generation method based on GPU acceleration and the storage medium have the main principle that operation tasks of a thumbnail generation part in a server are completed on the GPU, a multi-core operation capability optimization program of the GPU is fully utilized, and the thumbnail generation speed is improved.
In summary, according to the thumbnail generation method and the storage medium based on GPU acceleration provided by the present invention, after receiving the picture uploaded by the user, the generation speed of the thumbnail is significantly increased by means of the computation capability of the GPU, and the operation task of the thumbnail generation part is completed on the GPU, so that the multicore computation capability optimization program of the GPU can be fully utilized, the computation efficiency is improved, and the display of the user at the front end of the network disk has a better real-time effect; by means of GPU image enhancement technology, thumbnail enhancement display of pictures with lower resolution is achieved, and user experience is enhanced; meanwhile, the thumbnail adaptive to each client type is generated after the original picture is obtained, so that the situation that the corresponding thumbnail needs to be generated in real time after the user switches the client is avoided, and the real-time effect of the user is improved.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (8)

1. A thumbnail generation method based on GPU acceleration is characterized by comprising the following steps:
s1, receiving a picture uploading request, and acquiring and storing an original picture therein;
s2, calling GPU resources of the storage server, and generating and storing a thumbnail through a thumbnail generation algorithm by the GPU;
and S3, receiving the picture browsing request, and returning the thumbnail according to the picture browsing request.
2. The method for generating thumbnails based on GPU acceleration according to claim 1, wherein the step S2 specifically includes:
s21, calling GPU resources of the storage server, and generating more than one thumbnail by the GPU through a thumbnail generation algorithm, wherein each thumbnail can be adapted to the size or resolution of one client type;
s22, storing the thumbnail and the original picture in a related mode;
the step S3 specifically includes:
and receiving a picture browsing request, selecting a scaling graph with a corresponding size or resolution according to client state information contained in the picture browsing request, and returning.
3. The method for generating thumbnails based on GPU acceleration according to claim 1, wherein the step S2 specifically includes:
calling GPU resources of a storage server, judging whether the resolution of the original picture is smaller than a preset threshold value, if so, processing the thumbnail through an image enhancement algorithm of the GPU, otherwise, generating the thumbnail through a thumbnail generation algorithm by the GPU;
and storing the thumbnail and the original picture in a correlated manner.
4. The method of claim 2, wherein the client state information comprises client type, resolution, or wire speed information.
5. A computer-readable storage medium, on which a computer program is stored, which program, when executed by a processor, carries out the steps of:
s1, receiving a picture uploading request, and acquiring and storing an original picture therein;
s2, calling GPU resources of the storage server, and generating and storing a thumbnail through a thumbnail generation algorithm by the GPU;
and S3, acquiring a picture browsing request of the client, and returning the thumbnail according to the picture browsing request.
6. The computer-readable storage medium according to claim 5, wherein the step S2 specifically includes:
s21, calling GPU resources of the storage server, and generating more than one thumbnail by the GPU through a thumbnail generation algorithm, wherein each thumbnail can be adapted to the size or resolution of one client type;
s22, storing the thumbnail and the original picture in a related mode;
the step S3 specifically includes:
and acquiring a picture browsing request of a client, selecting a scaling chart with a corresponding size or resolution according to client state information contained in the picture browsing request, and returning.
7. The computer-readable storage medium according to claim 5, wherein the step S2 is specifically that:
the step S2 specifically includes:
calling GPU resources of a storage server, judging whether the resolution of the original picture is smaller than a preset threshold value, if so, processing the thumbnail through an image enhancement algorithm of the GPU, otherwise, generating the thumbnail through a thumbnail generation algorithm by the GPU;
and storing the thumbnail and the original picture in a related way.
8. The computer-readable storage medium of claim 6, wherein the client state information comprises client type, resolution, or wire speed information.
CN202210297448.9A 2022-03-24 2022-03-24 Thumbnail generation method based on GPU acceleration and storage medium Pending CN114897662A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210297448.9A CN114897662A (en) 2022-03-24 2022-03-24 Thumbnail generation method based on GPU acceleration and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210297448.9A CN114897662A (en) 2022-03-24 2022-03-24 Thumbnail generation method based on GPU acceleration and storage medium

Publications (1)

Publication Number Publication Date
CN114897662A true CN114897662A (en) 2022-08-12

Family

ID=82715529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210297448.9A Pending CN114897662A (en) 2022-03-24 2022-03-24 Thumbnail generation method based on GPU acceleration and storage medium

Country Status (1)

Country Link
CN (1) CN114897662A (en)

Similar Documents

Publication Publication Date Title
US20140267439A1 (en) Image Delivery Architecture
CN110096660B (en) Method and device for loading page pictures and electronic equipment
CN109887098B (en) Web AR data presentation mode based on distributed computing
US8639034B2 (en) Multimedia information retrieval system with progressive feature selection and submission
US20110304625A1 (en) Adaptive image rendering and use of imposter
CN106453572B (en) Method and system based on Cloud Server synchronous images
CN111680005A (en) File online preview method, device, system, equipment and storage medium
US9906626B2 (en) Resource demand-based network page generation
CN111770325A (en) Three-dimensional GIS real-time cloud rendering display method, terminal, cloud server and storage medium
CN111209422A (en) Image display method, image display device, electronic device, and storage medium
US20220156989A1 (en) Method and system for outputting character, electronic device, and storage medium
CN111061896B (en) Loading method, device, equipment and medium for 3D (three-dimensional) graph based on glTF (generalized likelihood TF)
CN112581568B (en) Dynamic poster generation method, device, server and storage medium
CN107592553A (en) A kind of compression of images agency balance processing method and processing device
CN114897662A (en) Thumbnail generation method based on GPU acceleration and storage medium
CN109617960B (en) Attribution separation-based web AR data presentation method
US20110125860A1 (en) Mail conversion method, mail retrieval method, mail server, mail client and mail system
CN110740138A (en) Data transmission method and device
CN109803157A (en) A kind of sequence frame picture transmission method, system and electronic equipment based on video
CN114820660A (en) Image processing method, image processing apparatus, electronic device, storage medium, and program product
CN113626099B (en) Application program starting method and device and electronic equipment
CN114138831A (en) Data searching method, device and storage medium
CN113992493A (en) Video processing method, system, device and storage medium
CN111681294B (en) Network tile map high-performance rendering method and system based on edge calculation
CN113849255B (en) Data processing method, device and storage medium

Legal Events

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