A kind of coding method of video encoder, apparatus and system
Technical field
The present invention relates to technical field of video coding, more particularly to a kind of coding method of video encoder, device and
System.
Background technique
With deepening continuously for digitized revolution, the continuous expansion of scale of urbanization and the construction of safe city, video
Monitoring system constantly moves ahead towards the direction of " high Qinghua, networking, intelligence, densification ".Monitoring point is more and more, and video is clear
Clear degree requires higher and higher, and the video recording holding time is increasingly longer, and bandwidth shared by transmission of video is increasing, is virtually current
Video monitoring storage system and transmission bandwidth increase pressure.Therefore in the case of nowadays mass data needs to store, how
Realize that " the cloud compression " of big data becomes many enterprises, the serious problem that department faces.
Traditional video compression technology is to achieve the effect that a compression by reducing the method for resolution ratio or frame number,
But this compress technique is to be unable to satisfy nowadays using losing image quality, video definition as the compression method of cost to height
The requirement of clarity.Video coding technique determines the effect of video compression technology, and video coding technique is solid in code rate at present
Video sequence is handled in the case where fixed, maximum compression, but the number that such coded system provides can be reached
Dynamic adjustment can not be carried out according to user demand and network condition according to stream, thus be not suitable for current network transmission.
It can be seen that how to improve video coding technique to adapt to current network transmission and user demand is this field skill
Art personnel's urgent problem to be solved.
Summary of the invention
The object of the present invention is to provide a kind of coding methods of video encoder, for improving video coding technique to adapt to
Current network transmission and user demand.In addition, the purpose of the present invention also provides the code device and packet of a kind of video encoder
System containing the device.
In order to solve the above technical problems, the present invention provides a kind of coding method of video encoder, comprising:
The video of acquisition is decoded;
Decoded video is encoded according to coding protocol to obtain target processing image;
It is compared between the frame adjacent to target processing image;
If the pixel between the adjacent frame is all the same, the frame in the adjacent frame is carried out using algorithm
Coding;
If the pixel between the adjacent frame changes, extracts the adjacent frame and obtain changing frame;
The changing frame is carried out to split into multiple subregions according to recursive mode;
Each subregion is according to a kind of adaptive equalization mode of feature selecting of its image pixel;
Compensated subregion is encoded using the algorithm.
Preferably, the changing frame is carried out splitting into 4 sub-regions according to recursive mode.
Preferably, the adaptive equalization mode includes: band-like compensation way.
Preferably, the adaptive equalization mode includes: edge compensation mode.
A kind of code device of video encoder, comprising:
Acquiring unit, for being decoded to the video of acquisition;
Processing unit, for being encoded according to coding protocol to decoded video to obtain target processing image;
Comparing unit, for being compared between the frame adjacent to target processing image;
First coding unit, if the pixel between the adjacent frame is all the same, using algorithm to the phase
A frame in adjacent frame is encoded;
Change unit is extracted the adjacent frame and is obtained if the pixel between the adjacent frame changes
Changing frame;
Unit is divided, splits into multiple subregions according to recursive mode for carrying out to the changing frame;
Compensating unit, for each subregion according to a kind of adaptive equalization side of feature selecting of its image pixel
Formula;
Second coding unit, for being encoded using the algorithm to compensated subregion.
Preferably, the division unit carries out the changing frame to split into 4 sub-regions according to recursive mode.
Preferably, the compensation way of the compensating unit includes: band-like compensation way.
Preferably, the compensation way of the compensating unit further include: edge compensation mode.
A kind of coded system of video encoder, code device, router including video encoder described above are taken the photograph
As head, display device and hard disk video recorder.
Preferably, the display device is computer.
The coding method of video encoder provided by the present invention, is first decoded video, is then assisted according to coding
View carries out coding to decoded video and obtains target processing image.Image is handled for target, compare between consecutive frame whether
It changes, any one frame is encoded using algorithm if not changing;If the pixel between adjacent frame changes,
Changing frame is then extracted, changing frame is carried out to split into multiple subregions according to recursive mode, then each subregion is carried out
Adaptive equalization finally encodes compensated subregion using algorithm.It is solid that the method overcome code rates in the prior art
Fixed mode is capable of the high quality high magnification compression conversion of the various video flowings of dynamically adapting using the coding mode of retractility,
The consecutive frame not changed is encoded using any one frame, memory space can be saved, improves compression efficiency.
Detailed description of the invention
In order to illustrate the embodiments of the present invention more clearly, attached drawing needed in the embodiment will be done simply below
It introduces, it should be apparent that, drawings in the following description are only some embodiments of the invention, for ordinary skill people
For member, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of flow chart of the coding method of video encoder provided by the invention;
Fig. 2 is a kind of structure chart of the code device of video encoder provided by the invention;
Fig. 3 is a kind of structure chart of the coded system of video encoder provided by the invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, rather than whole embodiments.Based on this
Embodiment in invention, those of ordinary skill in the art are without making creative work, obtained every other
Embodiment belongs to the scope of the present invention.
Core of the invention is to provide a kind of coding method of video encoder, apparatus and system.
In order to enable those skilled in the art to better understand the solution of the present invention, with reference to the accompanying drawings and detailed description
The present invention is described in further detail.
Embodiment one
Fig. 1 is a kind of flow chart of the coding method of video encoder provided by the invention.As shown in Figure 1, a kind of video
The coding method of encoder, comprising:
S10: the video of acquisition is decoded.
In specific implementation, when there is transmission of video to come, the video is decoded first, at subsequent processes
Reason.Since decoding technique is very mature, those skilled in the art know, therefore, wouldn't repeat here.
S11: decoded video is encoded according to coding protocol to obtain target processing image.
The type of coding protocol has very much, for example, can using International Telecommunication Association H.261, H.263 etc., do not limit here
System.It selects suitable coding protocol to carry out coding to decoded video according to the resolution ratio of video invitation and obtains target processing figure
Picture.Following steps are made improvements to target processing image.
S12: it is compared between the frame adjacent to target processing image.
It is compared between adjacent frame in the target processing image that will acquire.Here do not represent can only for adjacent frame
It is that previous and following frame compares, is also possible to first three frame and rear three frame is made comparisons, adjacent frame is illustrate front and back suitable
Order relation.Compare if it is three frames, then first three frame and rear three frame are exactly adjacent frame, compare if it is four frames, then preceding four frame and
Four frames are exactly adjacent frame afterwards.
S13: if the pixel between adjacent frame is all the same, the frame in adjacent frame is compiled using algorithm
Code.
After step S12 compares adjacent frame, if the pixel between adjacent frame is all the same, algorithm pair is utilized
Any one frame in adjacent frame is encoded.
S14: it if the pixel between adjacent frame changes, extracts adjacent frame and obtains changing frame.
After step S12 compares adjacent frame, if the pixel between adjacent frame changes, extract adjacent
Frame is to obtain changing frame.
S15: changing frame is carried out to split into multiple subregions according to recursive mode.
After obtaining changing frame, multiple subregions are split into according to recursive mode to changing frame.For example, can split into
4 sub-regions.In the application, splitting into multiple subregions is subsequent compensation for convenience.It is understood that the son of division
Region is more, then the video after reconstructing is closer to true video, but the subregion divided is more, then the time compensated also can
Increase, and in compensation process, can also there is error.Therefore, in specific implementation, the number of the subregion of adjustable division
Mesh.
S16: each subregion is according to a kind of adaptive equalization mode of feature selecting of its image pixel.
Due to each subregion difference, so different adaptive equalization modes is selected for different subregions, to subtract
Distortion between few source images and reconstructed image.
S17: compensated subregion is encoded using algorithm.
After carrying out adaptive equalization to each subregion, compensated subregion is encoded to obtain using algorithm
Video after reconstruct.
The coding method of video encoder provided by the invention, is first decoded video, then according to coding protocol
Coding is carried out to decoded video and obtains target processing image.Image is handled for target, whether compare between consecutive frame has
Variation, encodes any one frame using algorithm if not changing;If the pixel between adjacent frame changes,
Changing frame is extracted, changing frame is carried out to split into multiple subregions according to recursive mode, then each subregion is carried out certainly
Adaptive compensation finally encodes compensated subregion using algorithm.The method overcome code rates in the prior art to fix
Mode be capable of the high quality high magnification compression conversion of the various video flowings of dynamically adapting using the coding mode of retractility, it is right
It is encoded in the consecutive frame not changed using any one frame, memory space can be saved, improve compression efficiency.
Wherein, changing frame can be carried out splitting into 4 sub-regions according to recursive mode in specific implementation.
As a preferred embodiment, adaptive equalization mode includes: band-like compensation way.
As a preferred embodiment, adaptive equalization mode includes: edge compensation mode.
In order to allow those skilled in the art more to understand band-like compensation way provided by the invention and edge compensation mode, with
Under elaborate.
The band-like compensation way that the present invention mentions is that pixel value is divided into several bands, the same band according to intensity
Interior pixel possesses identical offset, and the band according to locating for pixel makees corresponding compensation when compensating.Specific real
Image pixel intensities can be divided into 48 grades from 0 to maximum value, while be divided into two classes by Shi Zhong, and the first kind is located in the middle
24 bands, remaining 24 bands are the second class.In coding, head only are written into the compensated information of a kind of band, it is another kind of
Band does not transmit then.Such mode, which encodes, ignores a kind of band with smaller offset, to save coding
Bit number.
In addition to band-like compensation way, the present invention also provides another compensation ways, i.e. edge compensation mode.Edge compensation side
Formula is mainly used for compensating the profile of image.Specifically, by the pixel value of current pixel point and 2 adjacent pixels into
Row comparison, the type for obtaining the pixel is local maxima, Local Minimum or image border.In compensation according to the class of pixel
Type is compensated accordingly.
Embodiment two
Fig. 2 is a kind of structure chart of the code device of video encoder provided by the invention.As shown in Fig. 2, Video coding
The code device of device, comprising:
Acquiring unit 10, for being decoded to the video of acquisition.
In specific implementation, when there is transmission of video to come, acquiring unit 10 is first decoded the video, with after an action of the bowels
Continuous process processing.Since decoding technique is very mature, those skilled in the art know, therefore, wouldn't repeat here.
Processing unit 20, for being encoded according to coding protocol to decoded video to obtain target processing image.
The type of coding protocol has very much, for example, can using International Telecommunication Association H.261, H.263 etc., do not limit here
System.Processing unit 20 selects suitable coding protocol to carry out coding acquisition to decoded video according to the resolution ratio of video invitation
Target handles image.
Comparing unit 30, for being compared between the frame adjacent to target processing image.
It is compared between adjacent frame in the target processing image that comparing unit 30 will acquire.Here adjacent frame is simultaneously
It can only be previous for not representing and following frame compares, and be also possible to first three frame and rear three frame is made comparisons, and adjacent frame is only said
The ordinal relation of bright front and back.Comparing if it is three frames, then first three frame and rear three frame are exactly adjacent frame, compare if it is four frames,
Then preceding four frame and rear four frame are exactly adjacent frame.
First coding unit 40, if the pixel between adjacent frame is all the same, using algorithm to adjacent frame
In a frame encoded.
After comparing unit 30 compares adjacent frame, if the pixel between adjacent frame is all the same, first is compiled
Code unit 40 encodes any one frame in adjacent frame using algorithm.
Change unit 50 extracts adjacent frame and obtains changing frame if the pixel between adjacent frame changes.
After comparing unit 30 compares adjacent frame, if the pixel between adjacent frame changes, change list
Member 50 extracts adjacent frame to obtain changing frame.
Unit 60 is divided, splits into multiple subregions according to recursive mode for carrying out to changing frame.
After obtaining changing frame, division unit 60 splits into multiple subregions according to recursive mode to changing frame.For example,
4 sub-regions can be split into.In the application, splitting into multiple subregions is subsequent compensation for convenience.It is understood that
It is that the subregion of division is more, then the video after reconstructing is closer to true video, but the subregion divided is more, then mends
The time repaid also will increase, and in compensation process, can also there is error.Therefore, in specific implementation, adjustable division
Subregion number.
Compensating unit 70, for each subregion according to a kind of adaptive equalization mode of feature selecting of its image pixel.
Due to each subregion difference, so selecting different adaptive equalizations for different subregion compensating units 70
Mode, to reduce the distortion between source images and reconstructed image.
Second coding unit 80, for being encoded using algorithm to compensated subregion.
After carrying out adaptive equalization to each subregion, the second coding unit 80 is using algorithm to compensated subregion
It is encoded with the video after being reconstructed.
The code device of video encoder provided by the invention, first acquiring unit are decoded video, then handle
Unit carries out coding to decoded video according to coding protocol and obtains target processing image.Image is handled for target, is compared
Unit compares whether change between consecutive frame, and the first coding unit carries out any one frame using algorithm if not changing
Coding;If the pixel between adjacent frame changes, change unit extract changing frame, division unit to changing frame carry out by
Multiple subregions are split into according to recursive mode, then compensating unit carries out adaptive equalization, the second last to each subregion
Coding unit encodes compensated subregion using algorithm.The device overcomes the side that code rate is fixed in the prior art
Formula is capable of the high quality high magnification compression conversion of the various video flowings of dynamically adapting, for not having using the coding mode of retractility
The consecutive frame changed is encoded using any one frame, can save memory space, improves compression efficiency.
Wherein, division unit carries out changing frame to split into 4 sub-regions according to recursive mode.
As a preferred embodiment, the compensation way of compensating unit includes: band-like compensation way.
As a preferred embodiment, the compensation way of compensating unit further include: edge compensation mode.
The band-like compensation way that the present invention mentions is that pixel value is divided into several bands, the same band according to intensity
Interior pixel possesses identical offset, and the band according to locating for pixel makees corresponding compensation when compensating.Specific real
Image pixel intensities can be divided into 48 grades from 0 to maximum value, while be divided into two classes by Shi Zhong, and the first kind is located in the middle
24 bands, remaining 24 bands are the second class.In coding, head only are written into the compensated information of a kind of band, it is another kind of
Band does not transmit then.Such mode, which encodes, ignores a kind of band with smaller offset, to save coding
Bit number.
In addition to band-like compensation way, the present invention also provides another compensation ways, i.e. edge compensation mode.Edge compensation side
Formula is mainly used for compensating the profile of image.Specifically, by the pixel value of current pixel point and 2 adjacent pixels into
Row comparison, the type for obtaining the pixel is local maxima, Local Minimum or image border.In compensation according to the class of pixel
Type is compensated accordingly.
Embodiment three
Fig. 3 is a kind of structure chart of the coded system of video encoder provided by the invention.As shown in figure 3, Video coding
The coded system of device, code device 1, router 2, camera 3, display dress including video encoder described in embodiment two
Set 4 and hard disk video recorder 5.
Traditional unit or mechanism monitoring network topological diagram are that front end IP camera is (hard into computer, into NVR by router
Disk video recorder).Namely the video flowing of camera is stored into computer or into NVR etc., is browsed by interchanger.
As shown in figure 3, video coding apparatus 1 is added on router 2 by cable, web built in video coding apparatus 1
(webpage) configuration interface carries out configuration to obtain the video flowing of camera 3, into video coding apparatus 1 excessively by log-on webpage
After processing, then display device 4 is passed to by router 2 and hard disk video recorder 5 is stored or browsed.Video coding apparatus 1 is just
It is equivalent to a terminal, video, which flowed into video coding apparatus 1 and compresses, returns again to the old place.
Wherein, display device can be computer.
The coding method of video encoder provided by the present invention, apparatus and system are described in detail above.This
Apply that a specific example illustrates the principle and implementation of the invention in text, the explanation of above example is only intended to
It facilitates the understanding of the method and its core concept of the invention.It should be pointed out that for those skilled in the art,
Without departing from the principles of the invention, can be with several improvements and modifications are made to the present invention, these improvement and modification are also fallen
Enter the protection scope of the claims in the present invention.