diff options
author | Sunita Nadampalli | 2013-12-11 13:22:38 -0600 |
---|---|---|
committer | Sunita Nadampalli | 2013-12-11 13:22:38 -0600 |
commit | 50f233c4d3a969065fcbe9767a7ebde6ac5690d8 (patch) | |
tree | 548e1340552c66612af71b4e4650228afd5e47dd /libdce.c | |
parent | 33343d01a3fe529ab6b1f4060607162047241b5a (diff) | |
download | repo-libdce-50f233c4d3a969065fcbe9767a7ebde6ac5690d8.tar.gz repo-libdce-50f233c4d3a969065fcbe9767a7ebde6ac5690d8.tar.xz repo-libdce-50f233c4d3a969065fcbe9767a7ebde6ac5690d8.zip |
[LIBDCE]: Changes to make Encoder and Decoder co-exist on Android
In the current design omx video decoder is sending ptr for
inbufs and dma_buf_fd for the outbufs to the dce client.
In order to co-exist with encoder the inbufs/outbufs interpretation
is unified between encoder and decoder. this is achieved by
passing the memheader for both inbufs and outbufs for
both encoder and decoders.
This patch modified the process function to handle memheader
for all Android scenarios (inbufs/outbufs for encoder/decoder)
With this unified buf interpretation, the process function
simplified for Android.
Note# This patch has should be merged along with the omx patch:
http://review.omapzoom.org/#/c/34414/
Change-Id: Ia89ef9785ddf702bca986ce6b4a91983fb8bcc11
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
Diffstat (limited to 'libdce.c')
-rw-r--r-- | libdce.c | 90 |
1 files changed, 40 insertions, 50 deletions
@@ -515,6 +515,7 @@ static XDAS_Int32 process(void *codec, void *inBufs, void *outBufs, | |||
515 | 515 | ||
516 | #ifdef BUILDOS_ANDROID | 516 | #ifdef BUILDOS_ANDROID |
517 | int32_t inbuf_offset[MAX_INPUT_BUF]; | 517 | int32_t inbuf_offset[MAX_INPUT_BUF]; |
518 | int32_t outbuf_offset[MAX_OUTPUT_BUF]; | ||
518 | #endif | 519 | #endif |
519 | 520 | ||
520 | _ASSERT(codec != NULL, DCE_EINVALID_INPUT); | 521 | _ASSERT(codec != NULL, DCE_EINVALID_INPUT); |
@@ -564,58 +565,44 @@ static XDAS_Int32 process(void *codec, void *inBufs, void *outBufs, | |||
564 | for( count = 0, total_count = 0; count < numInBufs; count++, total_count++ ) { | 565 | for( count = 0, total_count = 0; count < numInBufs; count++, total_count++ ) { |
565 | if( codec_id == OMAP_DCE_VIDDEC3 ) { | 566 | if( codec_id == OMAP_DCE_VIDDEC3 ) { |
566 | data_buf = (void * *)(&(((XDM2_BufDesc *)inBufs)->descs[count].buf)); | 567 | data_buf = (void * *)(&(((XDM2_BufDesc *)inBufs)->descs[count].buf)); |
567 | #ifdef BUILDOS_ANDROID | ||
568 | /* the decoder input buffer filled by the parsers, have an offset */ | ||
569 | /* for the actual data. the offset within the input buffer is provided */ | ||
570 | /* via memheader offset field. Hence the buf ptr needs to be advanced with the offset */ | ||
571 | inbuf_offset[count] = P2H(*data_buf)->offset; | ||
572 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, | ||
573 | MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf),(size_t)P2H(*data_buf), | ||
574 | (size_t)memplugin_share((void *)*data_buf)); | ||
575 | |||
576 | *data_buf += inbuf_offset[count]; | ||
577 | #else | ||
578 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, | ||
579 | MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf), | ||
580 | (size_t)*data_buf, (size_t)*data_buf); | ||
581 | #endif | ||
582 | } else if( codec_id == OMAP_DCE_VIDENC2 ) { | 568 | } else if( codec_id == OMAP_DCE_VIDENC2 ) { |
583 | data_buf = (void * *)(&(((IVIDEO2_BufDesc *)inBufs)->planeDesc[count].buf)); | 569 | data_buf = (void * *)(&(((IVIDEO2_BufDesc *)inBufs)->planeDesc[count].buf)); |
584 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, | ||
585 | MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf), | ||
586 | (size_t)*data_buf, (size_t)*data_buf); | ||
587 | |||
588 | } else if( codec_id == OMAP_DCE_VIDDEC2 ) { | 570 | } else if( codec_id == OMAP_DCE_VIDDEC2 ) { |
589 | data_buf = (void * *)(&(((XDM1_BufDesc *)inBufs)->descs[count].buf)); | 571 | data_buf = (void * *)(&(((XDM1_BufDesc *)inBufs)->descs[count].buf)); |
572 | } | ||
590 | #ifdef BUILDOS_ANDROID | 573 | #ifdef BUILDOS_ANDROID |
591 | /* the decoder input buffer filled by the parsers, have an offset */ | 574 | inbuf_offset[count] = ((MemHeader*)(*data_buf))->offset; |
592 | /* for the actual data. the offset within the input buffer is provided */ | 575 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, MmRpc_OFFSET((int32_t)inBufs, |
593 | /* via memheader offset field. Hence the buf ptr needs to be advanced with the offset */ | 576 | (int32_t)data_buf), (size_t)(*data_buf), |
594 | inbuf_offset[count] = P2H(*data_buf)->offset; | 577 | (size_t)(((MemHeader*)(*data_buf))->dma_buf_fd)); |
595 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, | 578 | *data_buf += inbuf_offset[count]; |
596 | MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf),(size_t)P2H(*data_buf), | ||
597 | (size_t)memplugin_share((void *)*data_buf)); | ||
598 | |||
599 | *data_buf += inbuf_offset[count]; | ||
600 | #else | 579 | #else |
601 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, | 580 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), INBUFS_INDEX, |
602 | MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf), | 581 | MmRpc_OFFSET((int32_t)inBufs, (int32_t)data_buf), |
603 | (size_t)*data_buf, (size_t)*data_buf); | 582 | (size_t)*data_buf, (size_t)*data_buf); |
604 | #endif | 583 | #endif |
605 | } | 584 | } |
606 | } | ||
607 | 585 | ||
608 | /* Output Buffers */ | 586 | /* Output Buffers */ |
609 | for( count = 0; count < numOutBufs; count++, total_count++ ) { | 587 | for( count = 0; count < numOutBufs; count++, total_count++ ) { |
610 | if(codec_id == OMAP_DCE_VIDENC2 || codec_id == OMAP_DCE_VIDDEC3) { | 588 | if(codec_id == OMAP_DCE_VIDENC2 || codec_id == OMAP_DCE_VIDDEC3) { |
611 | if(((XDM2_BufDesc *)outBufs)->descs[LUMA_BUF].buf != ((XDM2_BufDesc *)outBufs)->descs[CHROMA_BUF].buf ) { | 589 | if(((XDM2_BufDesc *)outBufs)->descs[LUMA_BUF].buf != ((XDM2_BufDesc *)outBufs)->descs[CHROMA_BUF].buf ) { |
612 | /* Either Encode usecase or MultiPlanar Buffers for Decode usecase */ | 590 | /* Either Encode usecase or MultiPlanar Buffers for Decode usecase */ |
613 | data_buf = (void * *)(&(((XDM2_BufDesc *)outBufs)->descs[count].buf)); | 591 | data_buf = (void * *)(&(((XDM2_BufDesc *)outBufs)->descs[count].buf)); |
614 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), OUTBUFS_INDEX, | 592 | #ifdef BUILDOS_ANDROID |
615 | MmRpc_OFFSET((int32_t)outBufs, (int32_t)data_buf), | 593 | outbuf_offset[count] = ((MemHeader*)(*data_buf))->offset; |
616 | (size_t)*data_buf, (size_t)*data_buf); | 594 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), OUTBUFS_INDEX, MmRpc_OFFSET((int32_t)outBufs, |
595 | (int32_t)data_buf), (size_t)(*data_buf), | ||
596 | (size_t)(((MemHeader*)(*data_buf))->dma_buf_fd)); | ||
597 | *data_buf += outbuf_offset[count]; | ||
598 | |||
599 | #else | ||
600 | Fill_MmRpc_fxnCtx_Xlt_Array(&(fxnCtx.xltAry[total_count]), OUTBUFS_INDEX, | ||
601 | MmRpc_OFFSET((int32_t)outBufs, (int32_t)data_buf), | ||
602 | (size_t)*data_buf, (size_t)*data_buf); | ||
603 | #endif | ||
617 | } | 604 | } |
618 | #if defined(BUILDOS_LINUX) || defined(BUILDOS_ANDROID) | 605 | #if defined(BUILDOS_LINUX) |
619 | else { | 606 | else { |
620 | /* SinglePlanar Buffers for Decode usecase*/ | 607 | /* SinglePlanar Buffers for Decode usecase*/ |
621 | data_buf = (void * *)(&(((XDM2_BufDesc *)outBufs)->descs[count].buf)); | 608 | data_buf = (void * *)(&(((XDM2_BufDesc *)outBufs)->descs[count].buf)); |
@@ -672,15 +659,18 @@ static XDAS_Int32 process(void *codec, void *inBufs, void *outBufs, | |||
672 | 659 | ||
673 | #ifdef BUILDOS_ANDROID | 660 | #ifdef BUILDOS_ANDROID |
674 | for( count = 0; count < numInBufs; count++ ) { | 661 | for( count = 0; count < numInBufs; count++ ) { |
675 | if( codec_id == OMAP_DCE_VIDDEC3 ) { | 662 | if( codec_id == OMAP_DCE_VIDDEC3 ) { |
676 | /* restore the actual buf ptr before returing to the mmf */ | 663 | /* restore the actual buf ptr before returing to the mmf */ |
677 | data_buf = (void * *)(&(((XDM2_BufDesc *)inBufs)->descs[count].buf)); | 664 | data_buf = (void * *)(&(((XDM2_BufDesc *)inBufs)->descs[count].buf)); |
678 | *data_buf -= inbuf_offset[count]; | 665 | } else if( codec_id == OMAP_DCE_VIDDEC2 ) { |
679 | } else if( codec_id == OMAP_DCE_VIDDEC2 ) { | 666 | /* restore the actual buf ptr before returing to the mmf */ |
680 | /* restore the actual buf ptr before returing to the mmf */ | 667 | data_buf = (void * *)(&(((XDM1_BufDesc *)inBufs)->descs[count].buf)); |
681 | data_buf = (void * *)(&(((XDM1_BufDesc *)inBufs)->descs[count].buf)); | 668 | } |
682 | *data_buf -= inbuf_offset[count]; | 669 | *data_buf -= inbuf_offset[count]; |
683 | } | 670 | } |
671 | for (count = 0; count < numOutBufs; count++){ | ||
672 | data_buf = (void * *)(&(((XDM2_BufDesc *)outBufs)->descs[count].buf)); | ||
673 | *data_buf -= outbuf_offset[count]; | ||
684 | } | 674 | } |
685 | #endif | 675 | #endif |
686 | 676 | ||