CN109413432A - Multi-process coding method, system and device based on event and shared drive mechanism - Google Patents

Multi-process coding method, system and device based on event and shared drive mechanism Download PDF

Info

Publication number
CN109413432A
CN109413432A CN201810719582.7A CN201810719582A CN109413432A CN 109413432 A CN109413432 A CN 109413432A CN 201810719582 A CN201810719582 A CN 201810719582A CN 109413432 A CN109413432 A CN 109413432A
Authority
CN
China
Prior art keywords
coding
data
encoded
region
access
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.)
Granted
Application number
CN201810719582.7A
Other languages
Chinese (zh)
Other versions
CN109413432B (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.)
Beijing Zhongke Flux Technology Co ltd
Original Assignee
Beijing Central Corwick Intelligent Computing Industry Research Institute 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 Beijing Central Corwick Intelligent Computing Industry Research Institute Co Ltd filed Critical Beijing Central Corwick Intelligent Computing Industry Research Institute Co Ltd
Priority to CN201810719582.7A priority Critical patent/CN109413432B/en
Publication of CN109413432A publication Critical patent/CN109413432A/en
Application granted granted Critical
Publication of CN109413432B publication Critical patent/CN109413432B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/189Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
    • H04N19/196Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding being specially adapted for the computation of encoding parameters, e.g. by averaging previously computed encoding parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The multi-process coding method based on event and shared drive mechanism that the invention discloses a kind of, system and device, by increasing by one layer of virtual level between upper-layer user's process and bottom hardware, realize the isolation between the different user process of upper layer, a kind of dispatching method by concurrency between shared drive and mutual exclusion lock raising process as far as possible is provided simultaneously, multiple consumer process can efficiently access bottom encoding device simultaneously, it is low that the present invention solves the code efficiency encountered when massive video coding, the number of support is few, power consumption is big, the problems such as each encoding device cannot be made full use of, improve coded system stability, the performance of each encoding device can sufficiently be excavated, with high-effect, it is high-throughput, the easily advantages such as extension.

Description

Multi-process coding method, system and device based on event and shared drive mechanism
Technical field:
The present invention relates to coding and decoding video fields, it particularly relates to a kind of based on event and shared drive mechanism Multi-process coding method.
Background technique:
With mobile Internet, the development of big data, artificial intelligence, video processing especially Video coding processing is straight Broadcast, network transmission, security protection, traffic monitoring, the demand of the various fields such as game it is growing day by day.How video coding system is realized How high-performance, high throughput, high energy efficiency, the easily characteristics such as extension support that the real-time processing of massive video flow data is the field face The new challenge faced.Traditional coding method is generally encoded using softwares such as ffmpeg, causes coding real-time lower, and function Consume larger, used coding method is easy to produce load imbalance due to lacking efficient scheduling mechanism and unstable asks Topic, and be not easy to be adapted to specific coding and decoding video hardware accelerator, hardware poor expandability.
Summary of the invention:
Present invention aim to address the code efficiencies encountered when massive video coding, and number that is low, supporting is few, power consumption is big, The problems such as making full use of each encoding device cannot be changed with customer flow.In order to solve these deficiencies of conventional method, this Invention by various coding methods and hardware interface researched and proposed it is a kind of based on event and shared drive mechanism mostly into Journey coding method is realized between the different user of upper layer by increasing by one layer of virtual level between upper layer application and bottom hardware Isolation, improve coded system stability, and propose and a kind of process is improved by shared drive and mutual exclusion lock as far as possible Between concurrency dispatching method, thus support multi-user can and meanwhile efficiently access bottom encoding device, bottom coding set It is standby to realize multi-channel video using hardware mechanisms while encoding, to sufficiently excavate the performance of each encoding device.Including with Lower content:
On the one hand, the present invention provides a kind of multi-process coding method based on event and shared drive mechanism, the side Method includes:
Virtual level is set between upper layer application and bottom hardware;
Every road coding entity is divided into and reads data to be encoded stream, updates coding parameter, coding, closes four steps, Upper layer application successively calls the reading data to be encoded stream, updates coding parameter, coding, closes that four steps are corresponding connects Mouthful, virtual level is successively called according to described, manages bottom hardware coding resource, realizes multi-process coding;
Wherein, every road coding entity requirement sequence call the readings data to be encoded stream, update coding parameter, coding, Close the corresponding interface of four steps.
Preferably, the reading data to be encoded flow step, including coding entity all the way is opened, it initializes and fills coding Parameter;
The update coding parameter step, including in an encoding process, by changing current coding parameter, realize upper layer The consumer process of application changes coding mode;
The coding step, including according to the coding parameter being arranged, the consumer process recursive call of the upper layer application step Rapid corresponding interface is encoded;
The closing step, including the road coding entity is closed, virtual level discharges corresponding hardware encoding resource.
Preferably, mutual exclusive call between coding entity of not going the same way reads data to be encoded stream, updates coding parameter, closes institute Corresponding interface.
Preferably, the virtual level allows multiplex coding entity to be performed simultaneously coding step, when new coding entity all the way When executing reading data to be encoded flow step, virtual level creates a new thread;
Synchronization is realized between thread in a manner of event, wherein producer's process generates data-triggered event, wakes up consumption Person's process enables the process enter dormant state if consumer process obtains less than event.
Preferably, the virtual level allows multiplex coding entity concurrently to execute coding step;
Thread pool is set, the encoding tasks concurrently executed are passed into the thread pool;
When there is free idle thread in thread pool, then an encoding tasks is distributed into the idle thread and executed.
Preferably, in the thread pool, the encoding tasks are inserted into an obstruction queue, the thread in the thread pool The encoding tasks are obtained from the obstruction queue.
Preferably, it is realized in coding step in a manner of shared drive, data to be encoded and volume is transmitted between multiple processes Code stream after the completion of code;
It wherein, is mutual exclusion to the access of a given memory block between multiple processes.
Preferably, creation control lock executes the mutual exclusive call;
Wherein, when the bottom hardware is encoded, different disengaging layers needs to obtain access region control lock first, It can access and read data to be encoded stream, update coding parameter, close the critical resource in step;When the access operation is completed Afterwards, release access region control lock.
Preferably, the shared drive mode further include: after data are written to shared region of memory in a process, share Other processes of this region of memory are visible to the data;
It is mutual exclusion to the access of a given memory block between the multiple process, comprising: when a process is to shared Region of memory when writing data forbid other process reading and writing data before it completes write operation.
On the other hand, the present invention also provides a kind of multi-process coded system based on event and shared drive mechanism, institute The system of stating includes: upper application module, virtual level module, bottom hardware module;
The upper application module successively calls coding entity is corresponding to read number to be encoded for the interaction with user According to stream, update coding parameter, coding, the corresponding interface of four steps of closing;
The virtual level module is used to successively call according to described, manages the coding resource of bottom hardware module, realizes more Process coding;
The bottom hardware module is for realizing operation and coding.
Preferably, the virtual level module creation control lock,
When the bottom hardware module, which executes, to be encoded, different processes needs to obtain access region control lock, ability first Access reads data to be encoded stream, updates coding parameter, closes the critical resource in step;After the completion of the access operation, Discharge access region control lock.
Preferably, the system also includes memory module, the memory module includes share and access area;
After data are written to shared region of memory in a process, other processes of this region of memory are shared to the data It can be seen that;
When a process is when writing data to shared region of memory, before it completes write operation, forbid other process reading and writing The data.
In another aspect, the present invention also provides a kind of multi-process code device based on event and shared drive mechanism, It is characterized in that, described device includes at least one processor and at least one read-write storage device;
It include a shared access region in the read-write storage device;The share and access area meets: when a process is to altogether After the region of memory write-in data enjoyed, other processes for sharing this region of memory are visible to the data;When a process is to altogether When the region of memory enjoyed writes data, before it completes write operation, forbid other process reading and writing data;
The read-write storage device is stored with instruction code, and the processor calls described instruction code, to execute such as Method either described in upper.
Compared with the prior art, technical solution of the present invention has high-performance, high throughput, high energy efficiency, easy to maintain, easy expansion Exhibition, the easily characteristics such as optimization.The isolation between the different user of upper layer is realized, coded system stability is improved, supports multi-user Bottom encoding device can be efficiently accessed simultaneously, and bottom encoding device is realized multi-channel video using hardware mechanisms while compiled Code, to sufficiently excavate the performance of each encoding device.
Detailed description of the invention:
Fig. 1 is the life cycle of the road implementation process Zhong Mei of the present invention video;
Fig. 2 is addressable port call flow chart in the present invention;
Fig. 3 is coding framework figure in the present invention;
Fig. 4 is high-throughput scheduling flow description figure in implementation process of the present 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 the described embodiment is only a part of the embodiment of the present invention, rather than whole embodiments.Based on this hair Embodiment in bright, those of ordinary skill in the art under the premise of not making the creative labor it is obtained it is all its His embodiment, shall fall within the protection scope of the present invention.
It should be pointed out that being that can mutually use for reference or mutually between embodiment in all embodiments of the invention Be used in combination, each embodiment is only illustrated uses as preferred mode, unless explicitly pointed out in this specification, otherwise it is following respectively The step of technical solution between embodiment or embodiment can be called mutually or be executed jointly.
Embodiment 1
In a specific embodiment, by taking coding entity is Video coding object as an example, skill of the invention is elaborated Art scheme embodiment.Although the data processing object being pointed out that in the present embodiment is video data, this hair The data processing object that bright technical solution is applicable in is not limited to video stream data, can be applicable to other multiplex coding objects Data processing.
As shown in Figure 1, the life cycle of every road coding entity be abstracted as read data to be encoded stream, update coding parameter, It encoded, close four steps of this road video, and be encapsulated as open101, update102, encode103, close104 tetra- A interface.
Wherein open101 is to open encoded video all the way, initializes and fill coding parameter, parameter includes that video type is H.264 or mpeg2, image quality rank profile, the high information of width of each frame, bit rate mode are that regular coding CBR still can be changed Piece (slice) number, interframe space (gop size) size that code rate V BR, video frame rate, each frame include etc..The parameter only exists Setting is primary when initialization coding, will not be modified in an encoding process.
Update102 is to update coding parameter, in an encoding process if it is desired to change coding mode can pass through update Go change coding parameter, the parameter that can be changed have pixel format, coded image width, coded image height, whether will be current Frame is encoded to I frame, encoder bit rate, which can repeatedly call, and at least calls once when encoded video initialization, with Parameter can be set repeatedly afterwards.
Encode103 is encoded for calling underlying device, such as the farsighted core AI chip of section in use, powerful abundant API, the solution support a variety of graphic platforms (graphics platforms), realize general utility functions, can regard to number Frequency pre-processed, encoding and decoding and the conversion of different coding format, can be used as bottom encoding device processing Video coding.
Close104 be complete this road video coding after close this video all the way.
The call flow chart of this four interfaces is as shown in Fig. 2, coding first calls open interface 201 to open wait compile when starting The data flow of code at least calls a update interface 202 when encoded video initialization, then when coding parameter changes Update interface 202 is called when change again, if you do not need to changing coding parameter then calls directly encode addressable port 203 are encoded, and call close interface 204 to close this road video when encoding and completing.
Coding first calls open interface 201 to open data flow to be encoded when starting, when encoded video initialization A update interface 202 is at least called then to call update interface 202 again when coding parameter changes, if not It needs to change coding parameter and then calls directly encode addressable port 203 and encoded, call close interface when encoding and completing 204 close this road video.
As shown in Figure 3, the general frame of system is deployed as passing through between bottom encoding device 301 and consumer process 304 The channel PCIe 302 is in communication with each other.Virtual level 303, which is realized, between the channel PCIe 302 and consumer process 304 allows multi-channel video Encode coding is carried out simultaneously.Wherein open, update, close interface only call primary, update in entirely coding process Although interface repeatedly calls but only carries out coding parameter transmitting few in number, therefore the volume of transmitted data of these three interfaces It is very limited, the channel PCIe 302 can be shared, we can by way of mutual exclusion lock the channel exclusive reference PCIe 302. And encode interface need multi-channel video and meanwhile carry out yuv data transmission also need to return coding complete BS code stream, therefore One or more PCIe accesses 302 are used alone.
Fig. 4 is that the detailed process of whole system describes figure, and coding step is divided into and reads data to be encoded stream, more newly organized Code parameter is encoded, closes four steps of this road video, and being encapsulated as open () 401, update () 402, encode 404 4 () 403, close () interfaces.I-th road client process sequence call open401, update402, encode403, 404 interface of close, the corresponding Video coding all the way of the i-th road client process, life cycle open401, update402, encode403,close404.Equally, the life cycle in bottom encoding service process per video all the way be also open412, Update413, encode414, close415, also require that sequence call open412, update413, encode414, Close415 interface.
It is required that mutual exclusive call open412, update413, close415 interface is needed between video of not going the same way, bottom coding The bottom layer realizations such as driving determine that the resource that open412, update413, close415 are used is critical resource, need to guarantee not With carrying out exclusive reference between process.
It does not go the same way and needs mutual exclusive call open412, update413, close415 interface between video, for the demand, Creation mutual exclusion lock is needed exist for, for exclusive reference critical resource between process.It does not go the same way and needs first to obtain control zone between video Access lock 411, only takes lock, could access the critical resource in open412, update413, close415.When having encoded At when close calling terminate after, release the control area access lock 416.
Guarantee to call aforementioned four interface with video sequences all the way and video of not going the same way between exclusive reference basis On, the concurrency as far as possible between raising process.Bottom coding realizes that allowing multi-channel video to carry out encode 414 simultaneously encodes, Whenever the new open 412 of video all the way, bottom encoding device will create a new thread, dedicated for client into Data interaction when row coding.Cataloged procedure such as Fig. 4, upper-layer user's process is as follows:
Step the s401: the i-th road client process calls encode, transmits yuv data to virtual level service thread.
Step s402: triggering the i-th road of bottom encoding device YUV video writes complete event.Bottom encoding device is waken up to carry out I-th road Video coding, allows it to handle YUV.
Step s403: client process enters dormant state and the coding of the i-th road of bottom encoding device video is waited to complete thing Part.
Step s404: the thread of the i-th road of bottom encoding device video waits the YUV of the i-th road client process to write and succeeds Part, if the thread that can not receive this i-th road of event bottom encoding device video, which will be blocked, subsequently enters dormant state, thus Reduce resource consumption.It waits and writes complete event until receiving the YUV of the i-th road client process.
Step s405: it wakes up the thread of the i-th road of bottom encoding device video and carries out coded treatment.
Step s406: the i-th road Video coding of triggering writes complete event after coding is completed.
Step the s407: the i-th road Video coding complete event wake up the i-th road suspend mode Zhong client process, the i-th tunnel client into Journey returns BS code stream to upper layer application, completes the coding of a frame data.
It does not go the same way and encodes and can concurrently execute between video, therefore for one can be initiated per Video coding all the way Thread, for the ease of realizing that thread management, the present invention go to manage numerous threads by way of thread pool.
The present invention is realized by way of shared drive transmits bulk between bottom encoding service host process and client process Data, this mode is a kind of most fast method of process data sharing, needs to cooperate process exclusive, Process Synchronization to use. Shared drive is divided according to the number of process, each process exclusively enjoys a piece of memory, and BS/YUV number is monopolized on the road i in as Fig. 4 According to area 406,407 ... ..., because being that two processes access to a given memory block, if a process is to altogether It enjoys memory field and writes data, then before it finishes this single stepping, another process should not go these data of reading and writing.So needing A control zone 405 is wanted to go to guarantee the exclusive reference to each data field.
Embodiment 2
The embodiment still with Video coding as an example, the implementation principle that the present invention is further explained.
Specific embodiment 1: every road coding entity is abstract.The life cycle of every road coding entity is abstracted as and is read wait compile Code data flow, update coding parameter, encoded, close four steps of this road video, and be encapsulated as open (), update (), Four encode (), close () interfaces, four interfaces are successively called by upper-layer user's process, and virtual level is according to the life on every road Period is managed bottom coding resource.
Open interface is to open encoded video all the way, initializes and fill coding parameter, parameter includes that video type is H.264 or mpeg2, image quality rank profile, the high information of width of each frame, bit rate mode are that regular coding CBR still can be changed Piece (slice) number, interframe space (gop size) size that code rate V BR, video frame rate, each frame include etc..The parameter only exists Setting is primary when initialization coding, will not be modified in an encoding process.
Update interface is to update coding parameter, and upper-layer user's process is if it is desired to change coding mode can in an encoding process To go change present encoding parameter by update, the parameter that can be changed includes pixel format, coded image width, code pattern Whether image height degree by present frame is encoded to I frame, encoder bit rate, which can repeatedly call, in encoded video initialization It waits and at least calls once, subsequent parameter can be set repeatedly.
Encode interface realizes cataloged procedure, and according to the coding parameter being set, upper-layer user's course cycles call should Interface is encoded, and virtual level one frame initial data of every reception (YUV, RGB etc.) is encoded to accordingly by bottom encoding device BS code stream, and the video code flow finished is returned into consumer process.
Close is to close this video all the way after the coding for completing this road video, and virtual level discharges corresponding hardware encoding money Source.
Coding first calls open interface to open data flow to be encoded when starting, when encoded video initialization at least A update interface is called, then calls update interface again when coding parameter changes, if you do not need to changing Coding parameter then calls directly encode addressable port and is encoded, and close interface is called to close this road view when encoding and completing Frequently.
It is required that need guarantee sequence to call open, update, encode, close interface with video all the way, each user into The corresponding Video coding all the way of journey, life cycle open, update, encode, close.Equally, bottom encoding service into Also it is open, update, encode, close per the life cycle of video all the way in journey, also requires that every video needs all the way Guarantee sequence calls open, update, encode, close interface.
Specific embodiment 2: needing mutual exclusive call open, update, close interface between video of not going the same way, because this A three periods accounted in the coding life cycle of every road ratio is very small, it is few with the traffic of coded hardware, it is hard in order to improve The utilization rate in part channel realizes higher performance, these three stages of different coding number are transmitted using a channel, bottom The bottom layer realizations such as layer coding driving determine that the resource that open, update, close are used is critical resource, it is therefore desirable to guarantee These three stages can be with the access channel resource of mutual exclusion.For the demand, virtual level needs to create mutual exclusion lock, for mutual between process Reprimand access critical resource.The host process of virtual level can create corresponding coding thread according to the number of consumer process, per all the way Video corresponds to a thread, needs first to obtain control zone access lock between difference process when bottom encoding device is encoded, only Lock is taken, the critical resource in open, update, close could be accessed.Access region control is discharged after the completion of access operation Lockmaking, other processes could access critical resource.
Specific embodiment 3: realizing the synchronization between process by way of event, and producer's process generates data-triggered thing Part wakes up consumer process, it is allowed to handle the data.If consumer process obtains and will be blocked less than event, Into dormant state, process resource consumption is reduced.
Guarantee to call aforementioned four interface with video sequences all the way and video of not going the same way between exclusive reference basis On, the concurrency as far as possible between raising process.Virtual level, which is realized, allows multi-channel video to carry out encode coding simultaneously.Whenever new The open of video all the way when, virtual level will create a new thread, and data when dedicated for being encoded with client are handed over Mutually.Process is as follows:
I-th road client process calls encode, first prepares yuv data, when the yuv data of the i-th road client process is ready to Afterwards, triggering the i-th road of bottom encoding device YUV video writes complete event, wakes up bottom encoding device and carries out the i-th road Video coding, It is allowed to handle YUV, subsequent client process enters dormant state and waits the coding of the i-th road of bottom encoding device video complete At event.
The thread of the i-th road of bottom encoding device video waits the YUV of the i-th road client process to write complete event, if received not Thread to this i-th road of event bottom encoding device video will be blocked and subsequently enter dormant state, disappear to reduce resource Consumption.Thread and the progress of the i-th road of bottom encoding device video are waken up after the YUV for receiving the i-th road client process writes complete event Coded treatment, the i-th road Video coding of triggering writes complete event after coding is completed.
I-th road Video coding writes complete event and wakes up the i-th road suspend mode Zhong client process, and the i-th road client process is to upper layer Using passback BS code stream, the coding of this frame data is completed.
Specific embodiment 4: coding can be executed concurrently between video of not going the same way, therefore for compiling per video all the way Code can initiate a thread, and when our encoding tasks numbers to be processed are smaller, we can create several threads ourselves Corresponding task is handled, but when there are a large amount of encoding tasks, since creation, destroying threads need very big expense, used Thread pool these problems just greatly alleviate, and in order to reduce expense while be easy to implement thread management, the present invention passes through thread The mode in pond goes to manage numerous coding threads.
We can pass to the encoding tasks concurrently executed one thread pool, to be replaced by each times concurrently executed Business all creates a new thread.As long as available free thread in pond, encoding tasks will distribute to a thread and execute.Online The inside of Cheng Chi, encoding tasks are inserted into an obstruction queue (Blocking Queue), and the thread in thread pool can go to take Task in this queue.As soon as success will follow takes out from queue times for one idle thread when the insertion queue of new task It is engaged in and executes it.Thread pool (Thread Pool) is very useful for the Thread Count of synchronization operation in limitation application program, Because one new thread of every starting can all have corresponding performance cost, per thread requires to distribute some memories etc. to stack.
Specific embodiment 5: the present invention realized by way of shared drive bottom encoding service host process and client into The code stream after the completion of data to be encoded and coding is transmitted between journey, shared drive is a kind of most fast of process data sharing Method, access shared drive region and access it is fast as the exclusive region of memory of process, need not move through system calling or Other processes for needing to cut kernel are completed, while it also avoids the various unnecessary duplications to data.One process Data are written with to shared region of memory, all processes for sharing this region of memory can be immediately seen in therein Hold.Using shared drive it should be noted that the mutual exclusion accessed between multiple processes a given memory block, it is therefore desirable to cooperate Process exclusive, Process Synchronization use because being that multiple processes access to a given memory block, if a process to Shared section key writes data, then before it finishes this single stepping, other process should not go these data of reading and writing.
Embodiment 3
In yet another embodiment, the present invention also provides a kind of, and the multi-process based on event and shared drive mechanism encodes System, the system can execute the specific method as in embodiment 1, embodiment 2.The system comprises: upper application module, void Quasi- layer module, bottom hardware module;
The upper application module successively calls coding entity is corresponding to read number to be encoded for the interaction with user According to stream, update coding parameter, coding, the corresponding interface of four steps of closing;
The virtual level module is used to successively call according to described, manages the coding resource of bottom hardware module, realizes more Process coding;
The bottom hardware module is for realizing operation and coding.
Preferably, the virtual level module creation control lock,
When the bottom hardware module, which executes, to be encoded, different processes needs to obtain access region control lock, ability first Access reads data to be encoded stream, updates coding parameter, closes the critical resource in step;After the completion of the access operation, Discharge access region control lock.
Preferably, the system also includes memory module, the memory module includes share and access area;
After data are written to shared region of memory in a process, other processes of this region of memory are shared to the content It can be seen that;
When a process is when writing data to shared region of memory, before it completes write operation, forbid other process reading and writing The data.
Embodiment 4
In another embodiment, the present invention also provides a kind of, and the multi-process based on event and shared drive mechanism encodes Device, described device include at least one processor and at least one read-write storage device;
It include a shared access region in the read-write storage device;The share and access area meets: when a process is to altogether After the region of memory write-in data enjoyed, other processes for sharing this region of memory are visible to the content;When a process is to altogether When the region of memory enjoyed writes data, before it completes write operation, forbid other process reading and writing data;
The read-write storage device is stored with instruction code, and the processor calls described instruction code, to execute such as The method of upper the embodiment described 1,2.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the program can be stored in a computer-readable storage medium In, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM) etc..
The present invention is described referring to the method for the embodiment of the present invention, block diagram, line chart, analogous diagram, described above Only the embodiment of the present invention, does not limit the present invention, and anyone skilled in the art takes off in the present invention In the technical scope of dew, any changes or substitutions that can be easily thought of, should be covered by the protection scope of the present invention.Therefore, originally The protection scope of invention should be subject to the protection scope in claims.

Claims (13)

1. a kind of multi-process coding method based on event and shared drive mechanism, which is characterized in that the described method includes:
Virtual level is set between upper layer application and bottom hardware;
Every road coding entity is divided into and reads data to be encoded stream, updates coding parameter, coding, closes four steps, upper layer It is empty using successively calling the reading data to be encoded stream, update coding parameter, coding, close the corresponding interface of four steps Quasi- layer is successively called according to described, manages bottom hardware coding resource, realizes multi-process coding;
Wherein, every road coding entity requirement sequence calls the reading data to be encoded stream, updates coding parameter, coding, closing The corresponding interface of four steps.
2. the method according to claim 1, wherein
The reading data to be encoded flow step, including coding entity all the way is opened, it initializes and fills coding parameter;
The update coding parameter step, including in an encoding process, by changing current coding parameter, realize upper layer application Consumer process change coding mode;
The coding step, including according to the coding parameter being arranged, the consumer process recursive call of the upper layer application step pair The interface answered is encoded;
The closing step, including the road coding entity is closed, virtual level discharges corresponding hardware encoding resource.
3. the method according to claim 1, wherein mutual exclusive call reading is to be encoded between coding entity of not going the same way Data flow updates interface corresponding to coding parameter, closing.
4. the method according to claim 1, wherein the virtual level allows multiplex coding entity to be performed simultaneously volume Code step, when new coding entity all the way, which executes, reads data to be encoded flow step, virtual level creates a new thread;
Synchronization is realized between thread in a manner of event, wherein producer's process generate data-triggered event, wake up consumer into Journey enables the process enter dormant state if consumer process obtains less than event.
5. the method according to claim 1, wherein the virtual level allows multiplex coding entity concurrently to execute volume Code step;
Thread pool is set, the encoding tasks concurrently executed are passed into the thread pool;
When there is free idle thread in thread pool, then an encoding tasks is distributed into the idle thread and executed.
6. according to the method described in claim 5, it is characterized in that, the encoding tasks are inserted into one in the thread pool Block queue, the thread in the thread pool obtains the encoding tasks from the obstruction queue.
7. the method according to claim 1, wherein being realized in coding step in a manner of shared drive, Duo Gejin The code stream after the completion of data to be encoded and coding is transmitted between journey;
It wherein, is mutual exclusion to the access of a given memory block between multiple processes.
8. according to the method described in claim 3, it is characterized in that, creation control lock executes the mutual exclusive call;
Wherein, when the bottom hardware is encoded, different disengaging layers needs to obtain access region control lock, Cai Nengfang first It asks and reads data to be encoded stream, update coding parameter, close the critical resource in step;After the completion of the access operation, release Put access region control lock.
9. the method according to the description of claim 7 is characterized in that the shared drive mode further include: when a process is to altogether After the region of memory write-in data enjoyed, other processes for sharing this region of memory are visible to the data;
It is mutual exclusion to the access of a given memory block between the multiple process, comprising: when a process is in shared When depositing region and writing data, before it completes write operation, forbid other process reading and writing data.
10. a kind of multi-process coded system based on event and shared drive mechanism, which is characterized in that the system comprises: on Layer application module, virtual level module, bottom hardware module;
The upper application module successively calls the corresponding reading data to be encoded of coding entity for the interaction with user Stream updates coding parameter, coding, closes the corresponding interface of four steps;
The virtual level module is used to successively call according to described, manages the coding resource of bottom hardware module, realizes multi-process Coding;
The bottom hardware module is for realizing operation and coding.
11. system according to claim 10, which is characterized in that the virtual level module creation control lock,
When the bottom hardware module, which executes, to be encoded, different processes needs to obtain access region control lock first, could access Data to be encoded stream is read, coding parameter is updated, closes the critical resource in step;After the completion of the access operation, release Access region control lock.
12. system according to claim 10, which is characterized in that the system also includes memory module, the storage mould Block includes share and access area;
After data are written to shared region of memory in a process, other processes for sharing this region of memory can to the data See;
When a process is when writing data to shared region of memory, before it completes write operation, forbid other process reading and writing number According to.
13. a kind of multi-process code device based on event and shared drive mechanism, which is characterized in that described device includes at least One processor and at least one read-write storage device;
It include a shared access region in the read-write storage device;The share and access area meets: when a process is to shared After data are written in region of memory, other processes for sharing this region of memory are visible to the data;When a process is to shared When region of memory writes data, before it completes write operation, forbid other process reading and writing data;
The read-write storage device is stored with instruction code, and the processor calls described instruction code, to execute such as right It is required that any method of 1-9.
CN201810719582.7A 2018-07-03 2018-07-03 Multi-process coding method, system and device based on event and shared memory mechanism Active CN109413432B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810719582.7A CN109413432B (en) 2018-07-03 2018-07-03 Multi-process coding method, system and device based on event and shared memory mechanism

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810719582.7A CN109413432B (en) 2018-07-03 2018-07-03 Multi-process coding method, system and device based on event and shared memory mechanism

Publications (2)

Publication Number Publication Date
CN109413432A true CN109413432A (en) 2019-03-01
CN109413432B CN109413432B (en) 2023-01-13

Family

ID=65464204

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810719582.7A Active CN109413432B (en) 2018-07-03 2018-07-03 Multi-process coding method, system and device based on event and shared memory mechanism

Country Status (1)

Country Link
CN (1) CN109413432B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637634A (en) * 2020-12-24 2021-04-09 北京睿芯高通量科技有限公司 High-concurrency video processing method and system for multi-process shared data
CN113064751A (en) * 2021-03-26 2021-07-02 山东英信计算机技术有限公司 Encoding and decoding method, device and equipment based on erasure pool and storage medium
CN118535356A (en) * 2024-07-25 2024-08-23 山东浪潮科学研究院有限公司 Dynamic shared memory multiplexing method and device applicable to GPGPU

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100114555A1 (en) * 2008-11-05 2010-05-06 Sun Microsystems, Inc. Handling mutex locks in a dynamic binary translation across heterogenous computer systems
CN103442204A (en) * 2013-08-08 2013-12-11 浙江工业大学 Network video transmission system and method based on DM365
CN105760217A (en) * 2016-03-23 2016-07-13 深圳森格瑞通信有限公司 Method for accessing shared memory
CN107943602A (en) * 2017-12-15 2018-04-20 北京数码视讯科技股份有限公司 Hardware abstraction plateform system and equipment based on AVS2 codings

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100114555A1 (en) * 2008-11-05 2010-05-06 Sun Microsystems, Inc. Handling mutex locks in a dynamic binary translation across heterogenous computer systems
CN103442204A (en) * 2013-08-08 2013-12-11 浙江工业大学 Network video transmission system and method based on DM365
CN105760217A (en) * 2016-03-23 2016-07-13 深圳森格瑞通信有限公司 Method for accessing shared memory
CN107943602A (en) * 2017-12-15 2018-04-20 北京数码视讯科技股份有限公司 Hardware abstraction plateform system and equipment based on AVS2 codings

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637634A (en) * 2020-12-24 2021-04-09 北京睿芯高通量科技有限公司 High-concurrency video processing method and system for multi-process shared data
CN113064751A (en) * 2021-03-26 2021-07-02 山东英信计算机技术有限公司 Encoding and decoding method, device and equipment based on erasure pool and storage medium
WO2022199328A1 (en) * 2021-03-26 2022-09-29 山东英信计算机技术有限公司 Encoding and decoding method, apparatus and device based on erasure pool, and storage medium
CN113064751B (en) * 2021-03-26 2023-04-25 山东英信计算机技术有限公司 Encoding and decoding method, device, equipment and storage medium based on erasure correction pool
CN118535356A (en) * 2024-07-25 2024-08-23 山东浪潮科学研究院有限公司 Dynamic shared memory multiplexing method and device applicable to GPGPU

Also Published As

Publication number Publication date
CN109413432B (en) 2023-01-13

Similar Documents

Publication Publication Date Title
CN109413432A (en) Multi-process coding method, system and device based on event and shared drive mechanism
CN105263050B (en) Mobile terminal real-time rendering system and method based on cloud platform
CN103631634B (en) Realize the method and apparatus of graphics processor virtualization
CN100336075C (en) Appts. method and system with graphics-rendering engine having time allocator
CN105427366B (en) A kind of image rendering method and image rendering system
CN105120293B (en) Image collaboration coding/decoding method and device based on CPU and GPU
CN101908035B (en) Video coding and decoding method, GPU (Graphics Processing Unit) and its interacting method with CPU (Central Processing Unit), and system
CN103309748B (en) Adaptive scheduling host system and scheduling method of GPU virtual resources in cloud game
CN107704922A (en) Artificial neural network processing unit
CN107679621A (en) Artificial neural network processing unit
CN106454354B (en) A kind of AVS2 parallel encoding processing system and method
CN112614202A (en) GUI rendering display method, terminal, server, electronic device and storage medium
CN110427094A (en) Display methods, device, electronic equipment and computer-readable medium
CN101710986A (en) H.264 parallel decoding method and system based on isostructural multicore processor
CN103809730A (en) Low-power-consumption wearable equipment system
CN106575431A (en) Method and apparatus for highly efficient graphics processing unit (GPU) execution model
CN103703785A (en) Video data generation unit, video image display device, video data generation method, video image display method, and video image file data structure
CN105323586A (en) Shared memory interface used for multi-core parallel video coding and decoding
CN106201670B (en) A kind of CAN bus data processing method based on Labview
CN101493751A (en) Multi-window manager of embedded graph system
CN109064538A (en) View rendering method, apparatus, storage medium and intelligent terminal
CN101739290A (en) System for securing multithreaded server applications
CN106293953B (en) A kind of method and system of the shared display data of access
CN106412473A (en) Image processing device, movie subsystem and movie processing circuit
CN103164227A (en) Collection method and collection device of window images

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
TR01 Transfer of patent right

Effective date of registration: 20230526

Address after: Room 711c, 7 / F, block a, building 1, yard 19, Ronghua Middle Road, Beijing Economic and Technological Development Zone, Daxing District, Beijing 102600

Patentee after: Beijing Ruixin high throughput technology Co.,Ltd.

Address before: 101300 room 232, building 5, 25 shuntongdao, Shunyi District, Beijing

Patentee before: BEIJING ZHONGKE RUIXIN INTELLIGENT COMPUTER INDUSTRIAL RESEARCH INSTITUTE CO.,LTD.

TR01 Transfer of patent right
CP01 Change in the name or title of a patent holder

Address after: Room 711c, 7 / F, block a, building 1, yard 19, Ronghua Middle Road, Beijing Economic and Technological Development Zone, Daxing District, Beijing 102600

Patentee after: Beijing Zhongke Flux Technology Co.,Ltd.

Address before: Room 711c, 7 / F, block a, building 1, yard 19, Ronghua Middle Road, Beijing Economic and Technological Development Zone, Daxing District, Beijing 102600

Patentee before: Beijing Ruixin high throughput technology Co.,Ltd.

CP01 Change in the name or title of a patent holder