CN111369444B - Image scaling processing method and device - Google Patents

Image scaling processing method and device Download PDF

Info

Publication number
CN111369444B
CN111369444B CN202010246410.XA CN202010246410A CN111369444B CN 111369444 B CN111369444 B CN 111369444B CN 202010246410 A CN202010246410 A CN 202010246410A CN 111369444 B CN111369444 B CN 111369444B
Authority
CN
China
Prior art keywords
scaling
channels
lines
image data
line
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
CN202010246410.XA
Other languages
Chinese (zh)
Other versions
CN111369444A (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.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua 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 Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202010246410.XA priority Critical patent/CN111369444B/en
Publication of CN111369444A publication Critical patent/CN111369444A/en
Application granted granted Critical
Publication of CN111369444B publication Critical patent/CN111369444B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof

Abstract

The invention provides an image scaling processing method and device, wherein the method comprises the following steps: caching images into a common linear buffer in a row unit, and sending the cached image data corresponding to the images to a plurality of scaling channels through the common linear buffer; determining the jumping line number of the plurality of scaling channels and the reference line number during scaling according to the scaling scales of the plurality of scaling channels, wherein the jumping line number is the line number of current scaling offset relative to the last scaling offset; based on the skip line number and the reference line number, the image data is subjected to longitudinal scaling through the scaling channels, so that the problem of overlarge resource consumption caused by supporting single-channel image scaling in the related technology can be solved, and when one image needs to be scaled to multiple resolution outputs, the image is scaled through the scaling channels, so that the consumption of resources is reduced, and the resource utilization is maximized.

Description

Image scaling processing method and device
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image scaling processing method and apparatus.
Background
In the image processing process, the image is often reduced or enlarged, and when the image is to be output to a plurality of display devices, the original image needs to be scaled to the corresponding resolution for outputting due to different resolutions of the displays.
In the related art, horizontally scaling image data, and selecting data in a coordinate range of each window of a screen display image according to superposition conditions among the windows of the display image; temporarily storing the data in the coordinate range of each selected window, taking out the image data in the coordinate range of each window which is horizontally scaled, and vertically scaling. Only single-channel image scaling output is supported, so that when multiple requirements exist on the resolution of the output, the scaling device in the design needs to be repeated for several times, and resources are consumed in comparison.
Aiming at the problem that the related technology only supports single-channel image scaling and causes overlarge resource consumption, no solution is proposed yet.
Disclosure of Invention
The embodiment of the invention provides an image scaling processing method and device, which at least solve the problem of overlarge resource consumption caused by supporting single-channel image scaling in the related technology.
According to an embodiment of the present invention, there is provided an image scaling processing method including:
caching images into a common linear buffer in a row unit, and sending the cached image data corresponding to the images to a plurality of scaling channels through the common linear buffer;
determining the jumping line number of the plurality of scaling channels and the reference line number during scaling according to the scaling scales of the plurality of scaling channels, wherein the jumping line number is the line number of current scaling offset relative to the last scaling offset;
and performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the jumping line number and the reference line number.
Optionally, performing, based on the number of jumping lines and the number of reference lines, a vertical scaling process on the image data through the plurality of scaling channels includes:
determining the starting lines of longitudinal scaling of the scaling channels according to the jumping line numbers of the scaling channels and the reference line numbers;
and performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the initial lines, the skip lines and the reference lines of the plurality of scaling channels.
Optionally, performing, by the plurality of scaling channels, vertical scaling processing on the image data based on the starting lines, the skip lines, and the reference lines of the plurality of scaling channels includes:
acquiring the line number of the image data cached in the common linear buffer;
respectively judging whether the number of lines of the image data cached in the shared linear buffer is larger than the reference number of lines of the plurality of scaling channels;
and if the judgment result is yes, performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the starting lines, the jumping line numbers and the reference line numbers of the plurality of scaling channels.
Optionally, performing, by the plurality of scaling channels, vertical scaling processing on the image data based on the starting lines, the skip lines, and the reference lines of the plurality of scaling channels includes:
for each of the plurality of scaling channels, performing the following steps to perform a longitudinal scaling process on the image data through the plurality of scaling channels, referred to as a current scaling channel for the scaling channel being performed:
performing ith scaling processing on the (i-1) a line to the M+ (i-1) a-1 line of the data through the current scaling channel to obtain an i-1 line of output data, wherein a is the skip line number, M is the reference line number, N is the line number of the image data, N is more than M, and i is an integer greater than or equal to 1;
i=i+1。
optionally, the method further comprises:
after a scaling process is completed at least once through each of the plurality of scaling channels, image data preceding a smallest i-1 line of the plurality of scaling channels in the common linear buffer is deleted.
Optionally, determining whether the number of lines of the image data buffered in the common linear buffer is greater than the reference number of lines of the plurality of scaling channels includes:
under the condition that the multi-scaling channel is an enlarged image, judging whether the number of lines of the image data cached in the shared linear buffer is larger than or equal to the reference number of lines of the multi-scaling channel plus 1 respectively;
and respectively judging whether the number of lines of the image data cached in the shared linear buffer is larger than or equal to the sum of the reference number of lines of the multi-scaling channel and the maximum reduction ratio under the condition that the multi-scaling channel is a reduced image, wherein the maximum reduction ratio is a value obtained by rounding up the reduction ratio of the multi-scaling channel.
According to another embodiment of the present invention, there is also provided an image scaling processing apparatus including:
the buffer module is used for buffering the images into a common linear buffer in a row unit, and sending the buffered image data corresponding to the images to a plurality of scaling channels through the common linear buffer;
the determining module is used for determining the jumping line number of the plurality of scaling channels and the reference line number during scaling according to the scaling proportions of the plurality of scaling channels, wherein the jumping line number is the line number of the current scaling offset relative to the last scaling offset;
and the scaling module is used for performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the jumping line number and the reference line number respectively.
Optionally, the scaling module includes:
a determining submodule, configured to determine starting lines of longitudinal scaling of the plurality of scaling channels according to the number of skip lines and the number of reference lines of the plurality of scaling channels, respectively;
and the scaling sub-module is used for performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the initial lines, the skip lines and the reference lines of the plurality of scaling channels.
Optionally, the scaling submodule includes:
an acquisition unit configured to acquire a line number of image data buffered in the common linear buffer;
a judging unit configured to respectively judge whether the number of lines of the image data buffered in the common linear buffer is greater than the reference number of lines of the plurality of scaling channels;
and the scaling unit is used for performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the starting lines, the jumping lines and the reference lines of the plurality of scaling channels when the judgment result is yes.
Optionally, the scaling unit is further configured to
For each of the plurality of scaling channels, performing the following steps to perform a longitudinal scaling process on the image data through the plurality of scaling channels, referred to as a current scaling channel for the scaling channel being performed:
carrying out ith scaling treatment on the (i-1) a line to the M+ (i-1) a-1 line of the data in the current scaling channel to obtain the i-1 line of output data, wherein a is the jumping line number, M is the reference line number, N is the line number of the image data, N is more than M, and i is an integer greater than or equal to 1;
i=i+1。
optionally, the apparatus further comprises:
and the deleting unit is used for deleting the data before the smallest i-1 line in the plurality of scaling channels in the shared linear buffer after the scaling processing is completed at least once through each scaling channel in the plurality of scaling channels.
Optionally, the judging unit is further configured to
Under the condition that the multi-scaling channel is an enlarged image, judging whether the number of lines of the image data cached in the shared linear buffer is larger than or equal to the reference number of lines of the multi-scaling channel plus 1 respectively;
and respectively judging whether the number of lines of the image data cached in the shared linear buffer is larger than or equal to the sum of the reference number of lines of the multi-scaling channel and the maximum reduction ratio under the condition that the multi-scaling channel is a reduced image, wherein the maximum reduction ratio is a value obtained by rounding up the reduction ratio of the multi-scaling channel.
According to a further embodiment of the invention, there is also provided a computer-readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
According to a further embodiment of the invention, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
According to the invention, an image is cached in a common linear buffer in a row unit, and image data corresponding to the cached image is sent to a plurality of scaling channels through the common linear buffer; determining the jumping line number of the plurality of scaling channels and the reference line number during scaling according to the scaling scales of the plurality of scaling channels, wherein the jumping line number is the line number of current scaling offset relative to the last scaling offset; based on the skip line number and the reference line number, the image data is subjected to longitudinal scaling through the scaling channels, so that the problem of overlarge resource consumption caused by supporting single-channel image scaling in the related technology can be solved, and when one image needs to be scaled to multiple resolution outputs, the image is scaled through the scaling channels, so that the consumption of resources is reduced, and the resource utilization is maximized.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a mobile terminal of an image scaling processing method according to an embodiment of the present invention;
fig. 2 is a flowchart of an image scaling processing method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a multi-channel image scaling processing apparatus according to an embodiment of the present invention;
FIG. 4 is a flow chart of data caching according to an embodiment of the invention;
FIG. 5 is a flow chart of data output according to an embodiment of the invention;
FIG. 6 is a schematic diagram of control logic for a shared linear buffer according to an embodiment of the invention;
fig. 7 is a block diagram of an image scaling processing apparatus according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the drawings in conjunction with embodiments. It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
Example 1
The method embodiment provided in the first embodiment of the present application may be executed in a mobile terminal, a computer terminal or a similar computing device. Taking a mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of a mobile terminal according to an embodiment of the present invention, as shown in fig. 1, a mobile terminal 10 may include one or more (only one is shown in fig. 1) processors 102 (the processors 102 may include, but are not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data, and optionally, a transmission device 106 for communication functions and an input/output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal 10 may also include more or fewer components than shown in FIG. 1 or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a message receiving method in an embodiment of the present invention, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, that is, implement the method described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 106 is arranged to receive or transmit data via a network. The specific examples of networks described above may include wireless networks provided by the communication provider of the mobile terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
In this embodiment, there is provided an image scaling processing method running on the mobile terminal or the network architecture, and fig. 2 is a flowchart of the image scaling processing method according to an embodiment of the present invention, as shown in fig. 2, where the flowchart includes the following steps:
step S202, caching an image into a common linear buffer in a row unit, and sending the cached image data corresponding to the image to a plurality of scaling channels through the common linear buffer;
step S204, determining the jumping line number of the plurality of scaling channels and the reference line number during scaling according to the scaling ratios of the plurality of scaling channels, wherein the jumping line number is the line number of the current scaling offset relative to the last scaling;
step S206, performing vertical scaling processing on the image data through the plurality of scaling channels based on the skip line number and the reference line number.
Buffering the image in line units into a common linear buffer through the steps S202 to S206, and transmitting the buffered image data corresponding to the image to a plurality of scaling channels through the common linear buffer; determining the jumping line number of the plurality of scaling channels and the reference line number during scaling according to the scaling scales of the plurality of scaling channels, wherein the jumping line number is the line number of current scaling offset relative to the last scaling offset; based on the skip line number and the reference line number, the image data is subjected to longitudinal scaling through the scaling channels, so that the problem of overlarge resource consumption caused by supporting single-channel image scaling in the related technology can be solved, and when one image needs to be scaled to multiple resolution outputs, the image is scaled through the scaling channels, so that the consumption of resources is reduced, and the resource utilization is maximized.
In the embodiment of the present invention, the step S206 may specifically include:
s2061, respectively determining initial lines of longitudinal scaling of the scaling channels according to the skip line numbers and the reference line numbers of the scaling channels;
s2062, performing vertical scaling processing on the image data by the plurality of scaling channels based on the start line, the skip line, and the reference line of the plurality of scaling channels.
Further, the step S2062 may specifically include:
acquiring the line number of the image data cached in the common linear buffer;
respectively judging whether the number of lines of the image data cached in the shared linear buffer is larger than the reference number of lines of the plurality of scaling channels;
further, in the case that the multi-scaling channel is an enlarged image, judging whether the number of lines of the image data buffered in the common linear buffer is greater than or equal to the reference number of lines of the multi-scaling channel plus 1, respectively; and respectively judging whether the number of lines of the image data cached in the shared linear buffer is larger than or equal to the sum of the reference number of lines of the multi-scaling channel and the maximum reduction ratio under the condition that the multi-scaling channel is a reduced image, wherein the maximum reduction ratio is a value obtained by rounding up the reduction ratio of the multi-scaling channel.
And if the judgment result is yes, performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the starting lines, the jumping line numbers and the reference line numbers of the plurality of scaling channels.
Further, for each of the plurality of scaling channels, performing the following steps to perform a longitudinal scaling process on the image data through the plurality of scaling channels, the scaling channel being performed being referred to as a current scaling channel:
performing ith scaling processing on the (i-1) a line to the (m+ (i-1) a-1 line of the data in the current scaling channel to obtain an i-1 line of output data, wherein a is the skip line number, M is the reference line number, N is the line number of the image data, N is more than M, and i is an integer greater than or equal to 1;
i=i+1。
in an alternative embodiment, the image data preceding the smallest i-1 line in the plurality of scaling channels in the common linear buffer is deleted after the scaling process is completed at least once by each of the plurality of scaling channels.
The scaling subsystem architecture proposed by the present example enables multi-pass scaling of image data, which is not possible with existing schemes. The multi-path scaling is widely applied in the fields of security protection, AI and the like, and in the fields, the same image data needs to be scaled to different sizes for display and processing. Fig. 3 is a schematic diagram of a multi-channel image scaling apparatus according to an embodiment of the present invention, as shown in fig. 3, which is composed of a common linear buffer 32, a plurality of scaling cores (scaling core 0, scaling cores 1, …, scaling core n). Each scaling core includes a hop count generator 34, a vertical scaler 36, and a horizontal scaler 38. The image data is input into the common linear buffer 32 in rows, the common linear buffer 32 stores a plurality of rows of data, the vertical scaler 36 calculates the initial row coordinates according to the number of skip rows input by the scaling core, and outputs a plurality of rows of image data in parallel for vertical scaling, and the vertically scaled image enters the horizontal scaler 38, and finally outputs a scaled image.
The shared linear buffer 32 is mainly used for inputting, storing and outputting distributed data, and the input logic and the output logic are respectively controlled by the following flow:
input control logic: the common linear buffer 32 contains a large memory for storing N lines of data, and the vertical scaler needs to refer to M lines to scale out one line of data, where M is fixed, so that the common linear buffer 32 can operate as long as the number of lines of the image stored in the common linear buffer 32 is greater than or equal to M, but in order for the entire scaling system to perform the maximum performance, the number of storage lines N needs to be greater than M, and how to calculate will be described below.
The INPUT control logic maintains mainly an INPUT LINE counter input_line_ CNT (INPUT LINE counter), which is incremented by 1 whenever a LINE of images is INPUT into the common linear buffer 32, and fig. 4 is a flowchart of a data cache according to an embodiment of the present invention, as shown in fig. 4, including:
step S401, releasing the buffer space to be empty, and recalculating the space size;
step S402, judging whether the public linear buffer has residual space, namely judging whether the LINE_BUF_CAP of all channels is smaller than N, executing step S403 under the condition of judging the number of bits of the result, otherwise executing step S405;
step S403, caching a line of data;
step S404, INPUT_LINE_CNT is incremented by 1;
step S405, it is determined whether the input of one frame of image is completed, and if yes, the process is ended, otherwise, the process returns to step S402.
The line_buf_cap (linear buffer capability common use amount) is a value in units of LINEs calculated by an input_line_cnt and an output LINE counter in distribution logic described later, in other words, the storage control and the distribution control are related to each other.
The number of output control logic depends on the number of scaling cores of the subsequent stage, and channel 0 is taken as an example for illustration. The channel 0 distribution control logic mainly maintains a count value of ch0_out_line_cnt (channel 0 output LINE counter), which is initialized to 0 at the beginning of a frame, and then acquires a number of hops from the scaling core 0, which means that the scaling core wants to output the ch0_out_line_cnt, which is offset from the ch0_dump_num LINE, based on the last time the control logic outputs, and then outputs the next set of parallel LINE data. For example, the image height is reduced from 100 to 10, the first time ch0_jump_num acquired from the scaling core may be 0, then the 0 th row after scaling is obtained by passing the 0 th to M-1 rows before scaling through the scaling core, the second time ch0_jump_num acquired from the scaling core may be 10, then the 10 th to 10+m-1 rows before scaling is obtained by passing the scaling core to obtain the 1 st row after scaling, and so on, a frame of the image is obtained by reducing vertically by 10 times. FIG. 5 is a flow chart of data output according to an embodiment of the invention, as shown in FIG. 5, including:
step S501, the output line start coordinate counters of all scaling cores are cleared to 0;
for the CH0 scaling channel, performing the scaling process includes:
step S5021, reading the JUMP line number CH0_JUMP_NUM;
step S5031, CH0_OUTPUT_LINE_CNT plus CH0_JUMP_NUM;
in step S5041, it is determined whether the data size in the current buffer space is enough for the channel CH0 to perform the vertical scaling, specifically (input_line_cnt-chn_output_line_cnt-vertical scaling parallel LINE number M) > =0? Or the image is input to be greater than or equal to 0, if the judgment result is yes, executing the step S5051, otherwise returning to the step S5041;
step S5051, outputting longitudinal scaling parallel data of CH 0;
step S5061, judging whether the CH0 one-frame image is scaled longitudinally, ending the process under the condition of judging the number of bits of the result, otherwise returning to step S5021;
for the CHn scaling channel, performing the scaling process includes:
step S5021, reading the JUMP line number CHn_JUMP_NUM;
step S5031, CHn_OUTPUT_LINE_CNT plus CHn_JUMP_NUM;
in step S5041, it is determined whether the data size in the current buffer space is enough for the channel CHn to perform the vertical scaling, specifically (input_line_cnt-chn_output_line_cnt-vertical scaling parallel LINE number M) > =0? Or the image is input to be greater than or equal to 0, if the judgment result is yes, executing the step S5051, otherwise returning to the step S5041;
step S5051, outputting the longitudinal scaling parallel data of CHn;
step S5061, judging whether the longitudinal scaling of the CHn one-frame image is finished, ending with the judgment of the number of bits of the result, otherwise returning to step S5021;
the output control logic needs to determine whether the current shared linear buffer has the data until the scaling core needs the data of which lines, and the determination condition is as follows:
input_line_cnt > =ch0_output_line_cnt+m (the existing image LINEs in the common linear buffer may be OUTPUT if they have exceeded the image LINEs desired by the scaling core) or the entire image has been INPUT.
The shared linear buffer usage (line_buf_cap) is calculated by taking CH0 as an example:
CH0_LINE_BUF_CAP=INPUT_LINE_CNT-CH0_OUTPUT_LINE_CNT
i.e. the input LINE counter minus the OUTPUT LINE count of lane 0, it is simply understood that lane 0 considers that none of the LINEs preceding ch0_output_line_cnt are needed, the shared linear buffer can make room for storing new image LINE data, ch0_line_buf_cap can fluctuate between-ch0_jump_num_n, and the shared linear buffer is allowed to input new data as long as ch0_line_buf_cap < N, CH 0.
However, the common linear buffer cannot only consider the case of one channel, and needs to consider the case of all channels, only that all output channels allow their input data.
I.e. all line_buf_caps < N in the input control logic.
The control logic of the entire shared linear buffer has formed a closed loop control, which is described below as a 3-channel example.
Fig. 6 is a schematic diagram of control logic of a shared linear buffer according to an embodiment of the present invention, as shown in fig. 6, where the shared linear buffer has N lines of buffering, where N must be greater than or equal to M in order to meet the minimum requirement of the scaling core, but N is not illustrated, where it is impossible to place an entire original image in the buffering, and thus the memory resources consumed are mostly, and below, according to a specific principle of the scaling algorithm, it is illustrated how an optimal solution of N is calculated, that is, the minimum value of N without affecting the performance of the scaling core. The description is given in two cases, longitudinal enlargement and longitudinal reduction.
Longitudinal amplification: for magnification, the same line of the original image may be read out multiple times, for example twice, and in general, 2 is unlikely to appear (this does not follow the rule of magnification) in such an order that the jump_num acquired from the scaling core is 0, 1, 0 … per frame, so if the current channel is only magnified in the longitudinal direction, the N-best solution is m+1, and +1 is needed because while ensuring that the current channel is output, the image can be input into this line of additional buffer at the same time, so that the next time if jump_num is 1, there is already data in the linear line buffer that can continue to be output, without affecting the performance of the scaling core.
Longitudinal shrinkage: for scaling, taking scaling by a factor of 2.5 as an example, jump_num will vary from 2 to 3, and N takes the value m+3 in order not to affect the performance of the scaling core.
To sum up, the optimal solution for a single channel for N is: when only amplification is required in the longitudinal direction of the channel, n=m+1; when the channel is to be scaled down longitudinally, n=m+ceil (maximum scaling)// ceil is an upward value.
Knowing the N optimal solutions of the single channels, the optimal solutions of all the channels only need to be the maximum value of the N optimal solutions of the single channels, and if the practical application is insensitive to efficiency loss, N can be properly reduced to reduce resource consumption.
According to the embodiment of the invention, by sharing the linear line buffer, under the condition that the number of the scaling channels is increased, only the scaling core is needed to be increased, so that the consumption of resources is reduced. The existing scheme needs to increase the scaling core and the linear line buffer at the same time if multi-channel scaling is to be realized, and the linear line buffer consumes more resources (almost occupies half of the resources of the whole scaling subsystem), so that resources are wasted. Assuming that the consumption of the linear line buffer resource is 1, the scaling core consumes 1, the current scheme is used for realizing N-path scaling, 2N resources are needed, and the common linear line buffer technology provided by the scheme is used, only 1+N resources are needed to be consumed. The shared linear line buffer controller has simple and clear structure and low resource consumption.
Example 2
According to another embodiment of the present invention, there is also provided an image scaling processing apparatus, fig. 7 is a block diagram of the image scaling processing apparatus according to an embodiment of the present invention, as shown in fig. 7, including:
a buffer module 72, configured to buffer an image in a line unit into a common linear buffer, and send image data corresponding to the buffered image to a plurality of scaling channels through the common linear buffer;
a determining module 74, configured to determine, according to scaling ratios of the plurality of scaling channels, a number of skip lines of the plurality of scaling channels and a number of reference lines during scaling, where the number of skip lines is a number of lines that a current scaling is offset with respect to a previous scaling;
a scaling module 76, configured to perform a vertical scaling process on the image data through the plurality of scaling channels based on the number of jumping lines and the number of reference lines.
Optionally, the scaling module 76 includes:
a determining submodule, configured to determine starting lines of longitudinal scaling of the plurality of scaling channels according to the number of skip lines and the number of reference lines of the plurality of scaling channels, respectively;
and the scaling sub-module is used for performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the initial lines, the skip lines and the reference lines of the plurality of scaling channels.
Optionally, the scaling submodule includes:
an acquisition unit configured to acquire a line number of image data buffered in the common linear buffer;
a judging unit configured to respectively judge whether the number of lines of the image data buffered in the common linear buffer is greater than the reference number of lines of the plurality of scaling channels;
and the scaling unit is used for performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the starting lines, the jumping lines and the reference lines of the plurality of scaling channels respectively when the judgment result is yes.
Optionally, the scaling unit is further configured to
For each of the plurality of scaling channels, performing the following steps to perform a longitudinal scaling process on the image data through the plurality of scaling channels, referred to as a current scaling channel for the scaling channel being performed:
performing ith scaling processing on the (i-1) a line to the (m+ (i-1) a-1 line of the data in the current scaling channel to obtain an i-1 line of output data, wherein a is the skip line number, M is the reference line number, N is the line number of the image data, N is more than M, and i is an integer greater than or equal to 1;
i=i+1。
optionally, the apparatus further comprises:
and the deleting unit is used for deleting the image data before the smallest i-1 line in the plurality of scaling channels in the common linear buffer after the scaling processing is completed at least once through each scaling channel in the plurality of scaling channels.
Optionally, the judging unit is further configured to
Under the condition that the multi-scaling channel is an enlarged image, judging whether the number of lines of the image data cached in the shared linear buffer is larger than or equal to the reference number of lines of the multi-scaling channel plus 1 respectively;
and respectively judging whether the number of lines of the image data cached in the shared linear buffer is larger than or equal to the sum of the reference number of lines of the multi-scaling channel and the maximum reduction ratio under the condition that the multi-scaling channel is a reduced image, wherein the maximum reduction ratio is a value obtained by rounding up the reduction ratio of the multi-scaling channel.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
Example 3
Embodiments of the present invention also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
Alternatively, in the present embodiment, the above-described storage medium may be configured to store a computer program for performing the steps of:
s1, caching an image into a common linear buffer in a row unit, and sending the cached image data corresponding to the image to a plurality of scaling channels through the common linear buffer;
s2, determining the jumping line number of the plurality of scaling channels and the reference line number during scaling according to the scaling proportions of the plurality of scaling channels, wherein the jumping line number is the line number of current scaling offset relative to the last scaling;
s3, based on the jumping line number and the reference line number, performing longitudinal scaling processing on the image data through the plurality of scaling channels.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Example 4
An embodiment of the invention also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, caching an image into a common linear buffer in a row unit, and sending the cached image data corresponding to the image to a plurality of scaling channels through the common linear buffer;
s2, determining the jumping line number of the plurality of scaling channels and the reference line number during scaling according to the scaling proportions of the plurality of scaling channels, wherein the jumping line number is the line number of current scaling offset relative to the last scaling;
s3, based on the jumping line number and the reference line number, performing longitudinal scaling processing on the image data through the plurality of scaling channels.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments and optional implementations, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may alternatively be implemented in program code executable by computing devices, so that they may be stored in a memory device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps within them may be fabricated into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (6)

1. An image scaling processing method, characterized by comprising:
caching images into a common linear buffer in a row unit, and sending the cached image data corresponding to the images to a plurality of scaling channels through the common linear buffer;
determining the jumping line number of the plurality of scaling channels and the reference line number during scaling according to the scaling scale of the plurality of scaling channels, wherein the jumping line number is the line number of current scaling offset relative to last scaling, and the reference line number is smaller than the line number of the image data;
performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the jumping line number and the reference line number;
wherein the performing, based on the number of jumping lines and the number of reference lines, the vertical scaling processing on the image data through the plurality of scaling channels includes:
determining the starting lines of longitudinal scaling of the scaling channels according to the jumping line numbers of the scaling channels and the reference line numbers;
acquiring the line number of the image data cached in the common linear buffer;
respectively judging whether the number of lines of the image data cached in the shared linear buffer is larger than the reference number of lines of the plurality of scaling channels;
if the judgment result is yes, performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the initial lines, the skip lines and the reference lines of the plurality of scaling channels;
wherein determining whether the number of lines of the image data buffered in the common linear buffer is greater than the reference number of lines of the plurality of scaling channels, respectively, includes:
judging whether the number of lines of the image data cached in the shared linear buffer is greater than or equal to the reference number of lines of the plurality of scaling channels plus 1 respectively under the condition that the plurality of scaling channels are amplified images;
and respectively judging whether the line number of the image data cached in the shared linear buffer is larger than or equal to the sum of the reference line number of the plurality of scaling channels and the maximum reduction ratio under the condition that the plurality of scaling channels are reduced images, wherein the maximum reduction ratio is a value obtained by rounding up the reduction ratios of the plurality of scaling channels.
2. The method of claim 1, wherein performing a vertical scaling process on the image data through the plurality of scaling channels based on the starting line, the skip line, and the reference line of the plurality of scaling channels comprises:
for each of the plurality of scaling channels, performing the following steps to perform a longitudinal scaling process on the image data through the plurality of scaling channels, referred to as a current scaling channel for the scaling channel being performed:
and (3) carrying out i-th scaling processing on the (i-1) th line a to the M+ (i-1) th line a-1 of the data through the current scaling channel to obtain the i-1 th line of output data, wherein a is the skip line number, M is the reference line number, and i is an integer greater than or equal to 1.
3. The method according to claim 2, wherein the method further comprises:
after a scaling process is completed at least once through each of the plurality of scaling channels, image data preceding a smallest i-1 line of the plurality of scaling channels in the common linear buffer is deleted.
4. An image scaling processing apparatus, characterized by comprising:
the buffer module is used for buffering the images into a common linear buffer in a row unit, and sending the buffered image data corresponding to the images to a plurality of scaling channels through the common linear buffer;
a determining module, configured to determine, according to scaling ratios of the plurality of scaling channels, a number of skip lines of the plurality of scaling channels and a number of reference lines during scaling, where the number of skip lines is a number of lines of a current scaling offset with respect to a previous scaling, and the number of reference lines is smaller than a number of lines of the image data;
the scaling module is used for performing longitudinal scaling processing on the image data through the plurality of scaling channels based on the jumping line number and the reference line number;
wherein the scaling module comprises:
a determining submodule, configured to determine starting lines of longitudinal scaling of the plurality of scaling channels according to the number of skip lines and the number of reference lines of the plurality of scaling channels, respectively;
a scaling sub-module, configured to perform vertical scaling processing on the image data through the plurality of scaling channels based on the initial lines, the skip lines, and the reference lines of the plurality of scaling channels;
the scaling submodule includes:
an acquisition unit configured to acquire a line number of image data buffered in the common linear buffer;
a judging unit configured to respectively judge whether the number of lines of the image data buffered in the common linear buffer is greater than the reference number of lines of the plurality of scaling channels;
a scaling unit, configured to perform vertical scaling processing on the image data through the plurality of scaling channels based on the starting lines, the skip lines, and the reference lines of the plurality of scaling channels, respectively, if the determination result is yes;
the judging unit is further configured to, when the plurality of scaling channels are enlarged images, respectively judge whether the number of lines of the image data buffered in the shared linear buffer is greater than or equal to the reference number of lines of the plurality of scaling channels plus 1; and respectively judging whether the line number of the image data cached in the shared linear buffer is larger than or equal to the sum of the reference line number of the plurality of scaling channels and the maximum reduction ratio under the condition that the plurality of scaling channels are reduced images, wherein the maximum reduction ratio is a value obtained by rounding up the reduction ratios of the plurality of scaling channels.
5. A computer-readable storage medium, characterized in that the storage medium has stored therein a computer program, wherein the computer program is arranged to perform the method of any of claims 1 to 3 when run.
6. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of the claims 1 to 3.
CN202010246410.XA 2020-03-31 2020-03-31 Image scaling processing method and device Active CN111369444B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010246410.XA CN111369444B (en) 2020-03-31 2020-03-31 Image scaling processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010246410.XA CN111369444B (en) 2020-03-31 2020-03-31 Image scaling processing method and device

Publications (2)

Publication Number Publication Date
CN111369444A CN111369444A (en) 2020-07-03
CN111369444B true CN111369444B (en) 2024-02-27

Family

ID=71209309

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010246410.XA Active CN111369444B (en) 2020-03-31 2020-03-31 Image scaling processing method and device

Country Status (1)

Country Link
CN (1) CN111369444B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112150362A (en) * 2020-09-22 2020-12-29 北京中房智宝科技有限公司 Picture preprocessing solution
CN115150566A (en) * 2022-09-01 2022-10-04 杭州雄迈集成电路技术股份有限公司 Multi-path multi-resolution video real-time output method and system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1652155A (en) * 2005-03-28 2005-08-10 北京中星微电子有限公司 Method and apparatus for changing digital image size
CN101038666A (en) * 2007-04-23 2007-09-19 北京中星微电子有限公司 Device for zooming still image and method thereof
CN101154341A (en) * 2006-09-30 2008-04-02 联詠科技股份有限公司 Image zooming circuit and method thereof
CN101374212A (en) * 2008-08-15 2009-02-25 上海茂碧信息科技有限公司 Method for implementing image interpolation arithmetic using memory structure with hierarchical speed
CN104036754A (en) * 2013-03-04 2014-09-10 澜起科技(上海)有限公司 Double-scaler system sharing row cache
CN107680028A (en) * 2016-08-01 2018-02-09 北京百度网讯科技有限公司 Processor and method for zoomed image
DE202017105882U1 (en) * 2016-11-14 2018-04-17 Google LLC (n.d.Ges.d. Staates Delaware) Fovealized two-way graphics pipeline

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1605400A1 (en) * 2004-06-11 2005-12-14 STMicroelectronics S.r.l. Processing pipeline of pixel data of a color image acquired by a digital sensor
KR100754893B1 (en) * 2005-03-14 2007-09-04 삼성전자주식회사 Image scaling device using one line memory and method thereof
TW200802171A (en) * 2006-06-20 2008-01-01 Sunplus Technology Co Ltd Image scaling system for saving memory
TWI320158B (en) * 2006-09-25 2010-02-01 Image scaling circuit and method thereof
CN101894362B (en) * 2010-07-05 2012-02-01 昆山龙腾光电有限公司 Image amplifying device and method
GB2487375B (en) * 2011-01-18 2017-09-20 Aptina Imaging Corp Interest point detection
US9386234B2 (en) * 2014-07-31 2016-07-05 Apple Inc. Auto filter extent management

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1652155A (en) * 2005-03-28 2005-08-10 北京中星微电子有限公司 Method and apparatus for changing digital image size
CN101154341A (en) * 2006-09-30 2008-04-02 联詠科技股份有限公司 Image zooming circuit and method thereof
CN101038666A (en) * 2007-04-23 2007-09-19 北京中星微电子有限公司 Device for zooming still image and method thereof
CN101374212A (en) * 2008-08-15 2009-02-25 上海茂碧信息科技有限公司 Method for implementing image interpolation arithmetic using memory structure with hierarchical speed
CN104036754A (en) * 2013-03-04 2014-09-10 澜起科技(上海)有限公司 Double-scaler system sharing row cache
CN107680028A (en) * 2016-08-01 2018-02-09 北京百度网讯科技有限公司 Processor and method for zoomed image
DE202017105882U1 (en) * 2016-11-14 2018-04-17 Google LLC (n.d.Ges.d. Staates Delaware) Fovealized two-way graphics pipeline

Also Published As

Publication number Publication date
CN111369444A (en) 2020-07-03

Similar Documents

Publication Publication Date Title
CN109729588B (en) Service data transmission method and device
CN111369444B (en) Image scaling processing method and device
CN108632886A (en) A kind of method for processing business and device
CN114567681B (en) Block chain network high-efficiency data transmission method
CN110493789B (en) Network capacity expansion method and device
US11671678B2 (en) Method and device, equipment, and storage medium for data processing
CN111683251A (en) Video data storage method and device and computer readable storage medium
EP4195843A1 (en) Control signaling transmission method, control signaling acquisition method, device and storage medium
CN103209044A (en) Transmission method, device and system of messages with data to be transmitted
US7414991B2 (en) Computing system and method to select data packet
CN114760529A (en) Transmission method and device of multichannel video data and computer equipment
CN112188562B (en) Multicast scheduling method and device for relay base station, storage medium and electronic device
CN117499351A (en) Message forwarding device and method, communication chip and network equipment
CN114828251A (en) Resource allocation method, terminal and network side equipment
CN107241404B (en) Method, device and system for receiving and transmitting messages
CN102340638B (en) A kind of method and apparatus of parallel data processing in video processing device
CN113658049A (en) Image transposition method, equipment and computer readable storage medium
CN108650049B (en) Channel detection method, device and base station
CN112765085A (en) Data transmission method and related device
CN109104446B (en) Message order-preserving method, network node and storage medium
CN114844607B (en) Beacon frame transmitting method, device, storage medium and AP
CN111935834B (en) Data transmission method, device, computer equipment and storage medium
CN115643591A (en) Resource occupation position determining method, terminal equipment and base station
KR20160109733A (en) Storage apparatus and method for processing a plurality of client data
CN117119579B (en) Antenna data processing method, device, equipment 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
GR01 Patent grant
GR01 Patent grant