CN109640093A - Picture decoding method and device in a kind of iOS - Google Patents
Picture decoding method and device in a kind of iOS Download PDFInfo
- Publication number
- CN109640093A CN109640093A CN201710931502.XA CN201710931502A CN109640093A CN 109640093 A CN109640093 A CN 109640093A CN 201710931502 A CN201710931502 A CN 201710931502A CN 109640093 A CN109640093 A CN 109640093A
- Authority
- CN
- China
- Prior art keywords
- image
- target image
- color space
- context
- function
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/44—Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
Abstract
The present invention provides picture decoding method and device in a kind of iOS, which comprises S1 creates automatic release pond, and point of use grammer obtains the first image reference object of target image in the automatic release pond;S2 obtains the predetermined word joint number of one-row pixels in color space mode, width and the height and the target image of the first image references object;S3 obtains the context object of the target image using the real bytes number of each pixel in the width of the first image references object, height, color space mode, the target image and the predetermined word joint number of one-row pixels;S4 redraws the context object of the target image, obtains the decoded image of target image according to result is redrawn, and discharge the context object of the target image.Heretofore described target image decoded image next time can call directly, and do not need to decode after obtaining in caching every time, reduce EMS memory occupation and operand.
Description
Technical field
The present invention relates to field of image processings, more particularly, to picture decoding method and device in a kind of iOS.
Background technique
In actual application and development, it is sometimes desirable to use the image of server-side.If directly used, on the one hand, image
Resolution ratio reduce, influence the using effect of image;On the other hand, the loading velocity of image also becomes very slow, it is therefore desirable to right
Image is decoded.
In existing image decoding technique, the image of server-side to be used will be needed to put in the buffer, when it is desired to be used,
Image is obtained from caching, and then image is decoded.But an image may need to require every time using many times
The further decoding after being obtained in caching, to waste plenty of time and resource.
Summary of the invention
For overcome it is above-mentioned call directly original function when, in the case where being modified to original function, destroy original function encapsulation
The problem of property, at least is partially solved the above problem, and the present invention provides picture decoding method and devices in a kind of iOS.
According to the first aspect of the invention, picture decoding method in a kind of iOS is provided, comprising:
S1 creates automatic release pond, and point of use grammer obtains the first image of target image in the automatic release pond
References object;
S2 obtains color space mode, width and the height of the first image references object, the first image is joined
The width for examining object obtains one-row pixels in the target image multiplied by the predetermined word joint number of each pixel in the target image
Predetermined word joint number;
S3, using each in the width of the first image references object, height, color space mode, the target image
The predetermined word joint number of one-row pixels, obtains the context of the target image in the real bytes number and the target image of pixel
Object;
S4 redraws the context object of the target image, obtains the second image of the context object redrawn
References object discharges the context object of the target image, using the corresponding image of the second image reference object as institute
State the decoded image of target image.
Specifically, the step S1 is specifically included:
Point of use grammer obtains the picture in the target image in the automatic release pond, if in the target image
The quantity of picture is equal to 1, then obtains the first image reference object of the target image.
Specifically, the step S2 is specifically included:
The transparency of the first image references object is obtained using CGImageGetAlphaInfo function;
If the transparency of the first image references object is not present, the color of the first image references object is obtained
Spatial model, width and height.
Specifically, color space mode, width and the height of the first image references object are obtained in the step S2
The step of specifically include:
The color space of the first image references object is obtained using CGImageGetColorSpace function;
Using the color space of the first image references object as the parameter of CGColorSpaceGetModel function, obtain
Take the color space mode of the first image references object;
The width of the first image references object is obtained using CGImageGetWidth function;
The height of the first image references object is obtained using CGImageGetHeight function.
Specifically, the step S2 further include:
If the color space mode of the first image references object is not pre-set color spatial model, by described first
The color space mode setting of image reference object is RGB color mode.
Specifically, the step S3 is specifically included:
Use the context object of target image described in CGBitmapContextCreate function creation;
Wherein, first parameter of the CGBitmapContextCreate function is null value, and second parameter is described
The width of first image reference object, third parameter are the height of the first image references object, and the 4th parameter is institute
The real bytes number of each pixel in target image is stated, the 5th parameter is the predetermined word of one-row pixels in the target image
Joint number, the 6th parameter are the color space mode of the first image references object, the context of the target image
The type of object is CGContextRef type.
Specifically, the step S4 is specifically included:
It is redrawn using context object of the CGContextDrawImage function to the target image;
The second image reference of the context object redrawn is obtained using CGBitmapContextCreateImage function
Object;
The context object of the target image is discharged using CGContextRelease function, and returns to second figure
As references object, using the corresponding image of the second image reference object of return as the decoded figure of the target image
Picture.
According to the second aspect of the invention, picture decoding apparatus in a kind of iOS is provided, comprising:
First acquisition unit, for creating automatic release pond, point of use grammer obtains target in the automatic release pond
First image reference object of image;
Second acquisition unit will for obtaining color space mode, width and the height of the first image references object
The width of the first image references object obtains the target figure multiplied by the predetermined word joint number of each pixel in the target image
The predetermined word joint number of one-row pixels as in;
Third acquiring unit, for using width, the height, color space mode, institute of the first image references object
The predetermined word joint number for stating one-row pixels in the real bytes number and the target image of each pixel in target image, obtains the mesh
The context object of logo image;
Unit is redrawn, is redrawn for the context object to the target image, the context object redrawn is obtained
The second image reference object, discharge the context object of the target image, the second image reference object is corresponding
Image is as the decoded image of the target image.
According to the third aspect of the invention we, image decoding apparatus in a kind of iOS is provided, comprising:
At least one processor, at least one processor and bus;Wherein,
The processor and memory complete mutual communication by the bus;
The memory is stored with the program instruction that can be executed by the processor, and the processor calls described program to refer to
Order is able to carry out foregoing method.
According to the fourth aspect of the invention, a kind of non-transient computer readable storage medium is provided, for storing such as preceding institute
State the computer program of method.
The present invention provides picture decoding method and device in a kind of iOS, and this method is by creating automatic release pond, described
The first image reference object that target image is obtained in automatic release pond, according to the acquisition of information of the first image references object
The context object of target image, and context object is redrawn, to realize the decoding to target image, released after decoding
Context object is put, can call directly, not need to obtain from caching every time the target image decoded image next time
After decode, reduce EMS memory occupation and operand.
Detailed description of the invention
Fig. 1 is picture decoding method overall flow schematic diagram in iOS provided in an embodiment of the present invention;
Fig. 2 is picture decoding apparatus overall structure diagram in iOS provided in an embodiment of the present invention;
Fig. 3 is image decoding apparatus overall structure diagram in iOS provided in an embodiment of the present invention.
Specific embodiment
With reference to the accompanying drawings and examples, specific embodiments of the present invention will be described in further detail.Implement below
Example is not intended to limit the scope of the invention for illustrating the present invention.
Picture decoding method in a kind of iOS is provided in one embodiment of the invention, and Fig. 1 provides for the embodiment of the present invention
IOS in picture decoding method overall flow schematic diagram, this method comprises: S1, creates automatic release pond, in the automatic release
Point of use grammer obtains the first image reference object of target image in pond;S2 obtains the face of the first image references object
Colour space mode, width and height, by the width of the first image references object multiplied by each pixel in the target image
Predetermined word joint number obtains the predetermined word joint number of one-row pixels in the target image;S3 uses the first image references object
Width, height, color space mode, a line in the real bytes number and the target image of each pixel in the target image
The predetermined word joint number of pixel, obtains the context object of the target image;S4, to the context object of the target image into
Row is redrawn, and is obtained the second image reference object of the context object redrawn, is discharged the context object of the target image, will
The corresponding image of the second image reference object is as the decoded image of the target image.
Specifically, the target image is the image for needing to be decoded.Before being decoded to the target image,
It is passed to the target image after the target image of server-side being downloaded, and judges whether the target image is deposited
If the target image is not present, a nil object is being returned to, the nil object is an empty object.If described
Target image exists, then creates automatic release pond.
In S1, the automatic release pond of@autoreleasepool function creation is used.After@autoreleasepool mark
In addition braces, the code of image decoding is added in braces, described is released automatically so that the process of image decoding is added to
It puts in pond.The@autoreleasepool function is a kind of machine for automatically recovering system, can postpone to be added in automatic release pond
The release opportunity of object.Under normal circumstances, the object of creation can be released when exceeding its scope, but if object is added
Into the automatic release pond, the release of object executes delay, i.e., will when a RunLoop life cycle terminates
Object release in automatic release pond.The RunLoop is actually the object of a management event and message, and provides one
Entrance function execute affair logic, thread execute described in enter library function after, be constantly in the entrance function internal receipt message,
In the circulation for waiting and handling, until the circulation terminates, the entrance function is returned.IOS system comes with described to be released automatically
Put pond.Since image decoding needs to consume a large amount of memories, it is automatic without the use of iOS system in addition to create automatic release pond
The automatic release pond saves memory in time discharge the object in the automatic release pond.According to incoming mesh
Logo image image obtains the first image reference object imageRef of the target image by grammer CGImage, described
The type of first image reference object is CGImageRef type.The CGImage indicates bitmap, the CGImageRef type
A structural body pointer being defined in QuartzCore frame, can be used for creating bitmap of pixels, pass through operation storage
Edit image in pixel position.
In S2, color space mode, width and the height of the first image references object, common color space are obtained
Mode includes RGB, Lab, CMYK and HSB etc..By the width width of the first image references object imageRef multiplied by described
The predetermined word joint number bytesPerPixel of each pixel obtains the preset byte of one-row pixels in the target image in target image
Number bytesPerRow.The predetermined word joint number is the size of memory shared by each pixel in target image after decompression, can basis
It is set, the predetermined word joint number bytesPerPixel of each pixel is set as 4 in target image as will be described.
In S3, since the target image is compressed image, the real bytes number of each pixel in the target image
The byte number bitsPerComponent of occupancy described in pixel for compression, such as the real bytes of each pixel in the target image
Number is 8.According to each pixel in the width of the first image references object, height, color space mode, the target image
The predetermined word joint number of one-row pixels, obtains the context object of the target image in real bytes number and the target image.
In S4, the context object of the target image is redrawn, after redrawing, obtains the context object
The second image reference object.The context graph picture of the target image is discharged, and returns to the second image reference object, institute
Stating the corresponding image of the second image reference object is the decoded image of the target image.After target image decoding
Image stored, be such as stored in hard disk or memory, next time can directly use decoded image, decoded image
High-quality, loading velocity is fast.The present embodiment is suitable for iOS system.
By creating automatic release pond in the present embodiment, the first image of target image is obtained in the automatic release pond
References object, according to the context object of the acquisition of information target image of the first image references object, and to context pair
As being redrawn, so that decoding of the realization to target image, free context object after decoding, the target image are decoded
Image can call directly next time, do not need to decode after obtaining in caching every time, reduce EMS memory occupation and operand.
On the basis of the above embodiments, step S1 described in the present embodiment specifically includes: in the automatic release pond
Point of use grammer obtains the picture in the target image, if the quantity of picture is equal to 1 in the target image, described in acquisition
First image reference object of target image.
Specifically, after being passed to the target image, judge that the target image is released to dynamic image.Point of use grammer obtains
All pictures in the target image are taken, the picture is static.Judge whether the picture in the target image is sky,
If not empty, then all pictures in the target image are returned.The quantity of picture in the target image is obtained, if the figure
The quantity of piece is equal to 1, then illustrates that the target image is still image, be decoded to the target image;If the picture
Quantity be greater than 1, then illustrate the target image be dynamic image, to the target image without decoding.
The present embodiment by the case where judging the target image not is dynamic image, just to the target image into
Row decoding, to avoid being decoded plurality of pictures simultaneously and causing to occupy a large amount of memories in the short time, is influencing system just
Often operation.
On the basis of the above embodiments, step S2 described in the present embodiment specifically includes: using
The transparency of CGImageGetAlphaInfo function acquisition the first image references object;If the first image reference pair
The transparency of elephant exists, then obtains color space mode, width and the height of the first image references object.
Specifically, using the first image references object imageRef as the ginseng of CGImageGetAlphaInfo function
Number obtains the transparency of the first image references object imageRef using the CGImageGetAlphaInfo function
alpha.Judge that the alpha of the first image references object whether there is, if it is present returning to the first image reference
Object, to having the first image references object of transparency without subsequent processing;If it does not exist, then first figure is obtained
As color space mode, width and the height of references object, to will there is the first image reference object of transparency to exclude.
The CGImageGetAlphaInfo function is used to obtain the transparency of CGImageRef type object.
On the basis of the above embodiments, the first image references object is obtained in step S2 described in the present embodiment
The step of color space mode, width and height, specifically includes: obtaining described the using CGImageGetColorSpace function
The color space of one image reference object;Using the color space of the first image references object as
The parameter of CGColorSpaceGetModel function obtains the color space mode of the first image references object;It uses
The width of CGImageGetWidth function acquisition the first image references object;It is obtained using CGImageGetHeight function
Take the height of the first image references object.
Specifically, obtain the first image references object imageRef's using CGImageGetColorSpace function
Color space.The color space is also referred to as color model, for being subject in a manner of acceptable to colour under certain standards
Explanation.Using the color space of the first image references object as the parameter of CGColorSpaceGetModel function, use
The CGColorSpaceGetModel function obtains the color space mode of the first image references object imageRef.Institute
The color space that CGImageGetColorSpace function is used to obtain CGImageRef type object is stated, it is described
CGColorSpaceGetModel function is used to obtain the color space mode of CGImageRef type object.It is described
CGImageGetWidth function is used to obtain the width of CGImageRef type object, the CGImageGetHeight function
For obtaining the height of CGImageRef type object.
On the basis of the above embodiments, step S2 described in the present embodiment further include: if the first image reference pair
The color space mode of elephant is not pre-set color spatial model, then sets the color space mode of the first image references object
It is set to RGB color mode.
Specifically, after getting the color space mode of the first image references object, judge first figure
As whether the color space mode of references object is pre-set color spatial model, the pre-set color spatial model is to preset
Color space mode, be common color space mode.If the color space mode of the first image references object is not
Pre-set color spatial model then illustrates that the color space mode of the first image references object is unknown color space mode
Although either known but different from pre-set color spatial model color space mode.To the first of unknown color space mode
Image reference object is without processing.It will known but and pre-set color using CGColorSpaceCreateDeviceRGB function
The color space mode setting of the first different image reference object of spatial model is RGB mode, may be set to be other face
Colour space mode, to avoid the case where can not normally decoding.The CGColorSpaceCreateDeviceRGB function is used for
It is RGB mode by the color space mode setting of CGImageRef type object.The RGB mode is a kind of color of industry
Standard, including R (Red, red), G (Green, green) and three Color Channels of B (Blue, blue), containing human eyesight can perceive
All colours.
On the basis of the above embodiments, step S3 described in the present embodiment specifically includes: using
The context object of target image described in CGBitmapContextCreate function creation;Wherein, described
First parameter of CGBitmapContextCreate function is null value, and second parameter is the first image references object
Width, third parameter is the height of the first image references object, and the 4th parameter is each picture in the target image
Element real bytes number, the 5th parameter be the target image in one-row pixels predetermined word joint number, described 6th
Parameter is the color space mode of first references object, and the type of the context object of the target image is
CGContextRef type.
Specifically, using the context object of target image described in CGBitmapContextCreate function creation.It is described
CGBitmapContextCreate function includes 6 parameters, and first parameter is the finger for needing to be drawn image in memory
Needle, is directly disposed as NULL herein, and NULL indicates null value;Second parameter is the width for needing the bitmap drawn, and is arranged herein
For the width of the first image references object;Third parameter is to need the height for the bitmap drawn, and is set as described herein
The height of first image reference object;4th parameter is the occupied byte number of a packed pixel in memory, is arranged herein
For the real bytes number of each pixel in the target image;5th parameter is to need the byte of the every a line for the bitmap drawn
Number, is set as the predetermined word joint number of one-row pixels in the target image herein;6th parameter is the first image reference
The color space mode of object.After all parameters are passed to the CGBitmapContextCreate function, the mesh is obtained
The type of the context object context, context of logo image are CGContextRef type.
On the basis of the above embodiments, step S4 described in the present embodiment specifically includes: using
CGContextDrawImage function redraws the context object of the target image;It uses
CGBitmapContextCreateImage function obtains the second image reference object of the context object redrawn;It uses
CGContextRelease function discharges the context object of the target image, and returns to the second image reference object,
Using the corresponding image of the second image reference object of return as the decoded image of the target image.
Specifically, using repaint function CGContextDrawImage to the context object of the target image into
Row is redrawn, and after drafting, obtains the context drawn using creation image function CGBitmapContextCreateImage
Second object references object of object.The upper of the target image is discharged using context release function CGContextRelease
Hereafter object, and the second image reference object is returned, the corresponding image of the second image reference object of return is made
For the decoded image of the target image.To complete the decoding of image and the release to memory.
Picture decoding apparatus in a kind of iOS is provided in another embodiment of the present invention, and Fig. 2 mentions for the embodiment of the present invention
Picture decoding apparatus overall structure diagram in the iOS of confession, the device include first acquisition unit 1, second acquisition unit 2,
Three acquiring units 3 and reconstruction unit 4, in which:
The first acquisition unit 1 is for creating automatic release pond, and point of use grammer obtains in the automatic release pond
First image reference object of target image;The second acquisition unit 2 is used to obtain the face of the first image references object
Colour space mode, width and height, by the width of the first image references object multiplied by each pixel in the target image
Predetermined word joint number obtains the predetermined word joint number of one-row pixels in the target image;The third acquiring unit 3 is used to use institute
State the width of the first image reference object, height, color space mode, in the target image real bytes number of each pixel and
The predetermined word joint number of one-row pixels, obtains the context object of the target image in the target image;It is described to redraw unit 4
It is redrawn for the context object to the target image, obtains the second image reference pair of the context object redrawn
As the context object of the target image being discharged, using the corresponding image of the second image reference object as the target
Image after image decoding.
Specifically, the target image is the image for needing to be decoded.Before being decoded to the target image,
It is passed to the target image after the target image of server-side being downloaded, and judges whether the target image is deposited
If the target image is not present, a nil object is being returned to, the nil object is an empty object.If described
Target image exists, then creates automatic release pond.
The first acquisition unit 1 uses the automatic release pond of@autoreleasepool function creation.In@
Braces is added after autoreleasepool mark, the code of image decoding is added in braces, thus by image decoding
Process is added in the automatic release pond.The autoreleasepool function is a kind of machine for automatically recovering system, Ke Yiyan
The release opportunity of Late join object into automatic release pond.Under normal circumstances, the object of creation can exceed its scope when quilt
Release, but if object is added in the automatic release pond, the release of object executes delay, i.e., in a RunLoop
When life cycle terminates, the object in automatic release pond is discharged.The RunLoop be actually a management event and
The object of message, and an entrance function is provided and executes affair logic, after entering library function described in thread execution, it is constantly in described
In entrance function internal receipt message, waiting and the circulation of processing, until the circulation terminates, the entrance function is returned.iOS
System comes with the automatic release pond.Since image decoding needs to consume a large amount of memories, automatic release pond is in addition created
Without the use of the automatic automatic release pond of iOS system, thus in time discharge the object in the automatic release pond,
Save memory.According to incoming target image image, the first image of the target image is obtained by grammer CGImage
References object imageRef, the type of the first image references object are CGImageRef type.The CGImage indicates position
Figure, the CGImageRef type are defined in a structural body pointer in QuartzCore frame, can be used for creating picture
Plain bitmap edits image by the pixel position of operation storage.
The second acquisition unit 2 obtains color space mode, width and the height of the first image references object, often
The color space mode seen includes RGB, Lab, CMYK and HSB etc..By the width of the first image references object imageRef
Width obtains a line in the target image multiplied by the predetermined word joint number bytesPerPixel of each pixel in the target image
The predetermined word joint number bytesPerRow of pixel.The predetermined word joint number is memory shared by each pixel in target image after decompression
Size, can according to need and set, as will be described in target image each pixel predetermined word joint number bytesPerPixel
It is set as 4.
Since the target image is compressed image, the real bytes number of each pixel is compression in the target image
Pixel described in occupancy byte number bitsPerComponent, if the real bytes number of each pixel in the target image is 8.
The third acquiring unit 3 is according to the width of the first image references object, height, color space mode, the target figure
As in each pixel real bytes number and the target image in one-row pixels predetermined word joint number, obtain the target image
Context object.
The unit 4 that redraws redraws the context object of the target image, after redrawing, obtains on described
Hereafter the second image reference object of object.The context graph picture of the target image is discharged, and returns to the second image ginseng
Examine object, the corresponding image of the second image reference object is the decoded image of the target image.By the target
Image after image decoding is stored, and is such as stored in hard disk or memory, can directly use decoded image next time, solution
Picture quality after code is good, and loading velocity is fast.
By creating automatic release pond in the present embodiment, the first image of target image is obtained in the automatic release pond
References object, according to the context object of the acquisition of information target image of the first image references object, and to context pair
As being redrawn, so that decoding of the realization to target image, free context object after decoding, the target image are decoded
Image can call directly next time, do not need to decode after obtaining in caching every time, reduce EMS memory occupation and operand.
On the basis of the above embodiments, first acquisition unit described in the present embodiment is specifically used for: releasing automatically described
The picture that point of use grammer in pond obtains in the target image is put to obtain if the quantity of picture is equal to 1 in the target image
Take the first image reference object of the target image.
On the basis of the various embodiments described above, second acquisition unit described in the present embodiment is specifically used for: using
The transparency of CGImageGetAlphaInfo function acquisition the first image references object;If the first image reference pair
The transparency of elephant is not present, then obtains color space mode, width and the height of the first image references object.
On the basis of the various embodiments described above, second acquisition unit described in the present embodiment is further specifically used for: using
The color space of CGImageGetColorSpace function acquisition the first image references object;The first image is referred to
Parameter of the color space of object as CGColorSpaceGetModel function obtains the face of the first image references object
Colour space mode;The width of the first image references object is obtained using CGImageGetWidth function;It uses
The height of CGImageGetHeight function acquisition the first image references object.
On the basis of the above embodiments, device described in the present embodiment further includes setting unit, is used for: if described first
The color space mode of image reference object is not pre-set color spatial model, then by the color of the first image references object
Spatial model is set as RGB color mode.
On the basis of the above embodiments, third acquiring unit described in the present embodiment is specifically used for: using
The context object of target image described in CGBitmapContextCreate function creation;Wherein, described
First parameter of CGBitmapContextCreate function is null value, and second parameter is the first image references object
Width, third parameter is the height of the first image references object, and the 4th parameter is each picture in the target image
Element real bytes number, the 5th parameter be the target image in one-row pixels predetermined word joint number, described 6th
Parameter is the color space mode of the first image references object, and the type of the context object of the target image is
CGContextRef type.
On the basis of the above embodiments, unit is redrawn described in the present embodiment to be specifically used for: using
CGContextDrawImage function redraws the context object of the target image;It uses
CGBitmapContextCreateImage function obtains the second image reference object of the context object redrawn;It uses
CGContextRelease function discharges the context object of the target image, and returns to the second image reference object,
Using the corresponding image of the second image reference object of return as the decoded image of the target image.
The present embodiment provides image decoding apparatus in a kind of iOS, Fig. 3 is image solution in iOS provided in an embodiment of the present invention
Decoding apparatus overall structure diagram, the equipment include: at least one processor 31, at least one processor 32 and bus 33;Its
In,
The processor 31 and memory 32 complete mutual communication by the bus 33;
The memory 32 is stored with the program instruction that can be executed by the processor 31, and the processor calls the journey
Sequence instruction is able to carry out method provided by above-mentioned each method embodiment, for example, S1 creates automatic release pond, described
Point of use grammer obtains the first image reference object of target image in automatic release pond;S2 obtains the first image reference
Color space mode, width and the height of object, by the width of the first image references object multiplied by the target image
The predetermined word joint number of each pixel obtains the predetermined word joint number of one-row pixels in the target image;S3 uses the first image
The width of references object, height, color space mode, in the target image each pixel real bytes number and the target figure
The predetermined word joint number of one-row pixels, obtains the context object of the target image as in;S4, above and below the target image
Literary object is redrawn, and the second image reference object of the context object redrawn is obtained, and discharges the upper and lower of the target image
Literary object, using the corresponding image of the second image reference object as the decoded image of the target image.
The present embodiment provides a kind of non-transient computer readable storage medium, the non-transient computer readable storage medium
Computer instruction is stored, the computer instruction makes the computer execute method provided by above-mentioned each method embodiment, example
Such as include: S1, create automatic release pond, point of use grammer obtains the first image ginseng of target image in the automatic release pond
Examine object;S2 obtains color space mode, width and the height of the first image references object, the first image is joined
The width for examining object obtains one-row pixels in the target image multiplied by the predetermined word joint number of each pixel in the target image
Predetermined word joint number;S3, using in the width of the first image references object, height, color space mode, the target image
The predetermined word joint number of one-row pixels in the real bytes number and the target image of each pixel obtains the upper and lower of the target image
Literary object;S4 redraws the context object of the target image, obtains the second image ginseng of the context object redrawn
Object is examined, the context object of the target image is discharged, using the corresponding image of the second image reference object as described in
The decoded image of target image.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above method embodiment can pass through
The relevant hardware of program instruction is completed, and program above-mentioned can be stored in a computer readable storage medium, the program
When being executed, step including the steps of the foregoing method embodiments is executed;And storage medium above-mentioned includes: ROM, RAM, magnetic disk or light
The various media that can store program code such as disk.
Image decoding apparatus embodiment is only schematical in iOS described above, wherein described be used as separation unit
The unit that part illustrates may or may not be physically separated, and component shown as a unit can be or can also
Not to be physical unit, it can it is in one place, or may be distributed over multiple network units.It can be according to reality
Need that some or all of the modules therein is selected to achieve the purpose of the solution of this embodiment.Those of ordinary skill in the art exist
In the case where not paying creative labor, it can understand and implement.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment can
It realizes by means of software and necessary general hardware platform, naturally it is also possible to pass through hardware.Based on this understanding, on
Stating technical solution, substantially the part that contributes to existing technology can be embodied in the form of software products in other words, should
Computer software product may be stored in a computer readable storage medium, such as ROM/RAM, magnetic disk, CD, including several fingers
It enables and using so that a computer equipment (can be personal computer, server or the network equipment etc.) executes each implementation
Method described in certain parts of example or embodiment.
Finally, the present processes are only preferable embodiment, it is not intended to limit the scope of the present invention.It is all
Within the spirit and principles in the present invention, any modification, equivalent replacement, improvement and so on should be included in protection of the invention
Within the scope of.
Claims (10)
1. picture decoding method in a kind of iOS characterized by comprising
S1 creates automatic release pond, and point of use grammer obtains the first image reference of target image in the automatic release pond
Object;
S2 obtains color space mode, width and the height of the first image references object, by the first image reference pair
The width of elephant obtains the default of one-row pixels in the target image multiplied by the predetermined word joint number of each pixel in the target image
Byte number;
S3 uses each pixel in the width of the first image references object, height, color space mode, the target image
Real bytes number and the target image in one-row pixels predetermined word joint number, obtain the context pair of the target image
As;
S4 redraws the context object of the target image, obtains the second image reference of the context object redrawn
Object discharges the context object of the target image, using the corresponding image of the second image reference object as the mesh
The decoded image of logo image.
2. the method according to claim 1, wherein the step S1 is specifically included:
Point of use grammer obtains the picture in the target image in the automatic release pond, if picture in the target image
Quantity be equal to 1, then obtain the first image reference object of the target image.
3. method according to claim 1 or 2, which is characterized in that the step S2 is specifically included:
The transparency of the first image references object is obtained using CGImageGetAlphaInfo function;
If the transparency of the first image references object is not present, the color space of the first image references object is obtained
Mode, width and height.
4. method according to claim 1 or 2, which is characterized in that obtain the first image reference in the step S2
The step of color space mode of object, width and height, specifically includes:
The color space of the first image references object is obtained using CGImageGetColorSpace function;
Using the color space of the first image references object as the parameter of CGColorSpaceGetModel function, institute is obtained
State the color space mode of the first image reference object;
The width of the first image references object is obtained using CGImageGetWidth function;
The height of the first image references object is obtained using CGImageGetHeight function.
5. according to the method described in claim 4, it is characterized in that, the step S2 further include:
If the color space mode of the first image references object is not pre-set color spatial model, by the first image
The color space mode setting of references object is RGB color mode.
6. method according to claim 1 or 2, which is characterized in that the step S3 is specifically included:
Use the context object of target image described in CGBitmapContextCreate function creation;
Wherein, first parameter of the CGBitmapContextCreate function is null value, and second parameter is described first
The width of image reference object, third parameter are the height of the first image references object, and the 4th parameter is the mesh
The real bytes number of each pixel in logo image, the 5th parameter are the preset byte of one-row pixels in the target image
Number, the 6th parameter are the color space mode of the first image references object, the context pair of the target image
The type of elephant is CGContextRef type.
7. method according to claim 1 or 2, which is characterized in that the step S4 is specifically included:
It is redrawn using context object of the CGContextDrawImage function to the target image;
The second image reference object of the context object redrawn is obtained using CGBitmapContextCreateImage function;
The context object of the target image is discharged using CGContextRelease function, and returns to the second image ginseng
Object is examined, using the corresponding image of the second image reference object of return as the decoded image of the target image.
8. picture decoding apparatus in a kind of iOS characterized by comprising
First acquisition unit, for creating automatic release pond, point of use grammer obtains target image in the automatic release pond
The first image reference object;
Second acquisition unit will be described for obtaining color space mode, width and the height of the first image references object
The width of first image reference object obtains in the target image multiplied by the predetermined word joint number of each pixel in the target image
The predetermined word joint number of one-row pixels;
Third acquiring unit, for using width, height, color space mode, the mesh of the first image references object
In logo image in the real bytes number and the target image of each pixel one-row pixels predetermined word joint number, obtain the target figure
The context object of picture;
Unit is redrawn, is redrawn for the context object to the target image, the of the context object redrawn is obtained
Two image reference objects, discharge the context object of the target image, by the corresponding image of the second image reference object
As the decoded image of the target image.
9. image decoding apparatus in a kind of iOS characterized by comprising
At least one processor, at least one processor and bus;Wherein,
The processor and memory complete mutual communication by the bus;
The memory is stored with the program instruction that can be executed by the processor, and the processor calls described program to instruct energy
Enough methods executed as described in claim 1 to 7 is any.
10. a kind of non-transient computer readable storage medium, which is characterized in that the non-transient computer readable storage medium is deposited
Computer instruction is stored up, the computer instruction makes the computer execute the method as described in claim 1 to 7 is any.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710931502.XA CN109640093A (en) | 2017-10-09 | 2017-10-09 | Picture decoding method and device in a kind of iOS |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710931502.XA CN109640093A (en) | 2017-10-09 | 2017-10-09 | Picture decoding method and device in a kind of iOS |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109640093A true CN109640093A (en) | 2019-04-16 |
Family
ID=66050923
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710931502.XA Pending CN109640093A (en) | 2017-10-09 | 2017-10-09 | Picture decoding method and device in a kind of iOS |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109640093A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1175100A2 (en) * | 1995-08-31 | 2002-01-23 | Mitsubishi Denki Kabushiki Kaisha | Method and apparatus for image encoding and decoding |
CN101465959A (en) * | 2007-12-21 | 2009-06-24 | 希姆通信息技术(上海)有限公司 | Method for generating and rapidly browsing image of hand-hold equipment |
CN104091607A (en) * | 2014-06-13 | 2014-10-08 | 北京奇艺世纪科技有限公司 | Video editing method and device based on IOS equipment |
CN105608177A (en) * | 2015-12-18 | 2016-05-25 | 魅族科技(中国)有限公司 | Picture processing method and apparatus |
CN105959724A (en) * | 2016-05-24 | 2016-09-21 | 腾讯科技(深圳)有限公司 | Video data processing method and device |
-
2017
- 2017-10-09 CN CN201710931502.XA patent/CN109640093A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1175100A2 (en) * | 1995-08-31 | 2002-01-23 | Mitsubishi Denki Kabushiki Kaisha | Method and apparatus for image encoding and decoding |
CN101465959A (en) * | 2007-12-21 | 2009-06-24 | 希姆通信息技术(上海)有限公司 | Method for generating and rapidly browsing image of hand-hold equipment |
CN104091607A (en) * | 2014-06-13 | 2014-10-08 | 北京奇艺世纪科技有限公司 | Video editing method and device based on IOS equipment |
CN105608177A (en) * | 2015-12-18 | 2016-05-25 | 魅族科技(中国)有限公司 | Picture processing method and apparatus |
CN105959724A (en) * | 2016-05-24 | 2016-09-21 | 腾讯科技(深圳)有限公司 | Video data processing method and device |
Non-Patent Citations (2)
Title |
---|
ZZIAZM: "iOS 图片解码(decode)笔记", 《百度》 * |
爱脚本网: "谈谈iOS中图片的解压缩", 《爱脚本网》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3138006B1 (en) | System and method for unified application programming interface and model | |
EP4002086A1 (en) | Method and device for image synthesis, electronic apparatus and storage medium | |
CN104765614B (en) | Color filling processing method and device | |
CN107450971A (en) | Task processing method and device | |
CN105597321A (en) | Barrage display method and system in full-screen game state | |
CN109377554A (en) | Large-scale three dimensional modeling rendering method, equipment, system and storage medium | |
CN107133909B (en) | Method and device for recombining shaders | |
CN109785417A (en) | A kind of method and device for realizing OpenGL cumulative operation | |
US20160189417A1 (en) | Method, apparatus and system for rendering an image | |
CN110062282A (en) | A kind of super-resolution video method for reconstructing, device and electronic equipment | |
CN112287257A (en) | Page display method and device, electronic equipment and storage medium | |
CN110064198A (en) | Processing method and processing device, storage medium and the electronic device of resource | |
CN107122176A (en) | A kind of pattern drawing method and device | |
KR20150106846A (en) | Improvements in and relating to rendering of graphics on a display device | |
CN112307403A (en) | Page rendering method, device, storage medium and terminal | |
EP3050605B1 (en) | A method for event detection in real-time graphic applications | |
CN109102463B (en) | Super-resolution image reconstruction method and device | |
US8600171B2 (en) | Image labeling using parallel processing | |
CN109640093A (en) | Picture decoding method and device in a kind of iOS | |
CN117456070A (en) | Rasterization and rendering method, graphics processing hardware, electronic device and storage medium | |
CN116149987A (en) | Automatic verification method for graphic slider | |
CN114327958A (en) | Operation method of reasoning service component and TensorRT reasoning service component | |
CN109767379B (en) | Data normalization processing method and device, storage medium and electronic equipment | |
CN114882149A (en) | Animation rendering method and device, electronic equipment and storage medium | |
CN102394053B (en) | Method and device for displaying pure monochrome picture |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190416 |
|
RJ01 | Rejection of invention patent application after publication |