1*437bfbebSnyanmisakaMPP (Media Process Platform) design (2016.10.12) 2*437bfbebSnyanmisaka================================================================================ 3*437bfbebSnyanmisaka 4*437bfbebSnyanmisakaThe mpp is a middleware library for Rockchip SoC's cross platform media process. 5*437bfbebSnyanmisakaThe main purpose of mpp is to provide very high performance, high flexibility 6*437bfbebSnyanmisakaand expansibility on multimedia (mainly video and image) process. 7*437bfbebSnyanmisaka 8*437bfbebSnyanmisakaThe design target of mpp is to connect different Rockchip hardware kernel driver 9*437bfbebSnyanmisakaand different userspace application. 10*437bfbebSnyanmisaka 11*437bfbebSnyanmisakaRockchip has two sets of hardware kernel driver. 12*437bfbebSnyanmisaka 13*437bfbebSnyanmisakaThe first one is vcodec_service/vpu_service/mpp_service which is a high 14*437bfbebSnyanmisakaperformance stateless frame base hardware kernel driver. This driver supports 15*437bfbebSnyanmisakaall available codecs that hardware can provide. This driver is used on Android/ 16*437bfbebSnyanmisakaLinux. 17*437bfbebSnyanmisaka 18*437bfbebSnyanmisakaThe second one is v4l2 driver which is developed for ChromeOS. It currently 19*437bfbebSnyanmisakasupports H.264/H.265/vp8/vp9. This driver is used on ChomeOS/Linux. 20*437bfbebSnyanmisaka 21*437bfbebSnyanmisakaMpp plans to support serval userspace applications including OpenMax, 22*437bfbebSnyanmisakagstreamer, libva. 23*437bfbebSnyanmisaka 24*437bfbebSnyanmisaka 25*437bfbebSnyanmisakaFeature explaination 26*437bfbebSnyanmisaka================================================================================ 27*437bfbebSnyanmisaka 28*437bfbebSnyanmisaka1. Cross Platform 29*437bfbebSnyanmisakaThe target OS platform including Android, Linux, ChromeOS and windows. Mpp uses 30*437bfbebSnyanmisakacmake to compile on different platform. 31*437bfbebSnyanmisaka 32*437bfbebSnyanmisaka2. High Performance 33*437bfbebSnyanmisakaMpp supports sync / async interface to reduce the time blocked in interface. And 34*437bfbebSnyanmisakampp internally make hardware and software run parallelly. When hardware is 35*437bfbebSnyanmisakarunning sofware will prepare next hardware task at the same time. 36*437bfbebSnyanmisaka 37*437bfbebSnyanmisaka3. High Flexibility 38*437bfbebSnyanmisakampi (Media Process Interface) is easy to extend by different control function. 39*437bfbebSnyanmisakaThe input/output element packet/frame/buffer is easy to extend different 40*437bfbebSnyanmisakacomponents. 41*437bfbebSnyanmisaka 42*437bfbebSnyanmisaka 43*437bfbebSnyanmisakaSystem Diagram 44*437bfbebSnyanmisaka================================================================================ 45*437bfbebSnyanmisaka 46*437bfbebSnyanmisaka +---------------------------------------+ 47*437bfbebSnyanmisaka | | 48*437bfbebSnyanmisaka | OpenMax / gstreamer / libva | 49*437bfbebSnyanmisaka | | 50*437bfbebSnyanmisaka +---------------------------------------+ 51*437bfbebSnyanmisaka 52*437bfbebSnyanmisaka +-------------------- MPP ----------------------+ 53*437bfbebSnyanmisaka | | 54*437bfbebSnyanmisaka | +-------------------------+ +--------+ | 55*437bfbebSnyanmisaka | | | | | | 56*437bfbebSnyanmisaka | | MPI / MPP | | | | 57*437bfbebSnyanmisaka | | buffer queue manage | | | | 58*437bfbebSnyanmisaka | | | | | | 59*437bfbebSnyanmisaka | +-------------------------+ | | | 60*437bfbebSnyanmisaka | | | | 61*437bfbebSnyanmisaka | +-------------------------+ | | | 62*437bfbebSnyanmisaka | | | | | | 63*437bfbebSnyanmisaka | | codec | | OSAL | | 64*437bfbebSnyanmisaka | | decoder / encoder | | | | 65*437bfbebSnyanmisaka | | | | | | 66*437bfbebSnyanmisaka | +-------------------------+ | | | 67*437bfbebSnyanmisaka | | | | 68*437bfbebSnyanmisaka | +-----------+ +-----------+ | | | 69*437bfbebSnyanmisaka | | | | | | | | 70*437bfbebSnyanmisaka | | parser | | HAL | | | | 71*437bfbebSnyanmisaka | | control | | reg_gen | | | | 72*437bfbebSnyanmisaka | | | | | | | | 73*437bfbebSnyanmisaka | +-----------+ +-----------+ +--------| | 74*437bfbebSnyanmisaka | | 75*437bfbebSnyanmisaka +-------------------- MPP ----------------------+ 76*437bfbebSnyanmisaka 77*437bfbebSnyanmisaka +---------------------------------------+ 78*437bfbebSnyanmisaka | | 79*437bfbebSnyanmisaka | kernel | 80*437bfbebSnyanmisaka | RK vcodec_service / v4l2 | 81*437bfbebSnyanmisaka | | 82*437bfbebSnyanmisaka +---------------------------------------+ 83*437bfbebSnyanmisaka 84*437bfbebSnyanmisakaMpp is composed of four main sub-modules: 85*437bfbebSnyanmisaka 86*437bfbebSnyanmisakaOSAL (Operation System Abstraction Layer) 87*437bfbebSnyanmisakaThis module shutters the differences between different operation systems and 88*437bfbebSnyanmisakaprovide basic components including memory, time, thread, log and hardware memory 89*437bfbebSnyanmisakaallocator. 90*437bfbebSnyanmisaka 91*437bfbebSnyanmisakaMPI (Media Process Interface) / MPP 92*437bfbebSnyanmisakaThis module is on charge of interaction with external user. Mpi layer has two 93*437bfbebSnyanmisakaways for user. The simple way - User can use put/get packet/frame function set. 94*437bfbebSnyanmisakaThe advanced way - User has to config MppTask and use dequeue/enqueue function 95*437bfbebSnyanmisakaset to communicate with mpp. MppTask can carry different meta data and complete 96*437bfbebSnyanmisakacomplex work. 97*437bfbebSnyanmisaka 98*437bfbebSnyanmisakaCodec (encoder / decoder) 99*437bfbebSnyanmisakaThis module implements the high efficiency internal work flow. The codec module 100*437bfbebSnyanmisakaprovides a general call flow for different video format. Software process will 101*437bfbebSnyanmisakabe separated from hardware specified process. The software will communicate with 102*437bfbebSnyanmisakahardware with a common task interface which combines the buffer information and 103*437bfbebSnyanmisakacodec specified infomation. 104*437bfbebSnyanmisaka 105*437bfbebSnyanmisakaParser/Controller and hal (Hardware Abstraction Layer) 106*437bfbebSnyanmisakaThis layer provides the implement function call of different video format and 107*437bfbebSnyanmisakadifferent hardware. For decoder parser provide the video stream parse function 108*437bfbebSnyanmisakaand output format related syntax structure to hal. The hal will translate the 109*437bfbebSnyanmisakasyntax structure to register set on different hardware. Current hal supports 110*437bfbebSnyanmisakavcodec_service kernel driver and plan to support v4l2 driver later. 111*437bfbebSnyanmisaka 112*437bfbebSnyanmisaka 113