coda9_vpuconfig.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause
  2. /*
  3. * Copyright (c) 2019, Chips&Media
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  16. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  19. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #ifndef __CODA9_VPU_CONFIG_H__
  27. #define __CODA9_VPU_CONFIG_H__
  28. #ifdef USE_FEEDING_METHOD_BUFFER
  29. #include "wave511/vpuapi/vpuconfig.h"
  30. #include "wave511/vpuapi/vputypes.h"
  31. #else
  32. #include "vpuconfig.h"
  33. #include "vputypes.h"
  34. #endif
  35. #if MAX_DEC_PIC_WIDTH > 1920 // 4K
  36. #define USE_WTL 0 // not support 4K WTL
  37. #define MAX_EXTRA_FRAME_BUFFER_NUM 1
  38. #define MAX_PP_SRC_NUM 2 //PPU buffer(decoding case) or Source buffer(encoding case)
  39. #define MAX_DPB_MBS 110400 // 32768 for level 5
  40. #elif MAX_DEC_PIC_WIDTH > 720
  41. #define USE_WTL 0 // for WTL (needs MAX_DPB_NUM*2 frame)
  42. #define MAX_EXTRA_FRAME_BUFFER_NUM 4
  43. #define MAX_PP_SRC_NUM 2 //PPU buffer(decoding case) or Source buffer(encoding case)
  44. #define MAX_DPB_MBS 32768 // 32768 for level 4.1
  45. #else
  46. #define USE_WTL 0 // for WTL (needs MAX_DPB_NUM*2 frame)
  47. #define MAX_EXTRA_FRAME_BUFFER_NUM 4
  48. #define MAX_PP_SRC_NUM 2 //PPU buffer(decoding case) or Source buffer(encoding case)
  49. #define MAX_DPB_MBS 32768 // 32768 for level 4.1
  50. #endif
  51. // codec specific configuration
  52. #define VPU_REORDER_ENABLE 1 // it can be set to 1 to handle reordering DPB in host side.
  53. #define VPU_GMC_PROCESS_METHOD 0
  54. #define VPU_AVC_X264_SUPPORT 1
  55. // DRAM configuration for TileMap access
  56. #define EM_RAS 13
  57. #define EM_BANK 3
  58. #define EM_CAS 10
  59. #define EM_WIDTH 2
  60. // DDR3 3BA, DDR4 1BG+2BA
  61. //#define EM_RAS 16
  62. //#define EM_BANK 3
  63. //#define EM_CAS 10
  64. //#define EM_WIDTH 3
  65. // DDR3 4BA, DDR4 2BG+2BA
  66. //#define EM_RAS 15
  67. //#define EM_BANK 4
  68. //#define EM_CAS 10
  69. //#define EM_WIDTH 3
  70. #define VPU_ME_LINEBUFFER_MODE 0
  71. #define VPU_GBU_SIZE 1024
  72. //********************************************//
  73. // External Memory Map Table
  74. //********************************************//
  75. # define CODE_BUF_SIZE (272*1024)
  76. # define TEMP_BUF_SIZE (470*1024)
  77. # define WORK_BUF_SIZE (80*1024)
  78. #define PARA_BUF_SIZE (10*1024)
  79. //=====2. VPU BITSTREAM MEMORY ===================//
  80. #define MAX_STREAM_BUF_SIZE 0x300000 // max bitstream size
  81. //===== 3. VPU PPS Save Size ===================//
  82. //----- SPS/PPS save buffer --------------------//
  83. #define PS_SAVE_SIZE ((320+8)*1024*4) // sps[64], pps[256], backupPsBuf[8] for rollback, error concealment (each 4Kbyte)
  84. //----- VP8 MB save buffer -------------------//
  85. #define VP8_MB_SAVE_SIZE (17*4*(MAX_DEC_PIC_WIDTH*MAX_DEC_PIC_HEIGHT/256)) // MB information + split MVs)*4*MbNumbyte
  86. //----- slice save buffer --------------------//
  87. #define SLICE_SAVE_SIZE (MAX_DEC_PIC_WIDTH*MAX_DEC_PIC_HEIGHT*3/4) // this buffer for ASO/FMO
  88. //=====5. VPU Encoder Scratch buffer ssize ======================//
  89. #define SIZE_AVCENC_QMAT_TABLE ((16*6)+(64*2)) // 4x4 6, 8x8 2
  90. #define SIZE_MP4ENC_DATA_PARTITION (MAX_ENC_PIC_WIDTH*MAX_ENC_PIC_HEIGHT*3/4)
  91. //=====6. Check VPU required memory size =======================//
  92. #define MAX_FRM_SIZE ((MAX_DEC_PIC_WIDTH*MAX_DEC_PIC_HEIGHT*3)/2)
  93. #define MAX_DEC_FRAME_BUFFERING (MAX_DPB_MBS/((MAX_DEC_PIC_WIDTH*MAX_DEC_PIC_HEIGHT)/256))
  94. #define MAX_DPB_NUM (16 < MAX_DEC_FRAME_BUFFERING ? (16+2+MAX_EXTRA_FRAME_BUFFER_NUM) : (MAX_DEC_FRAME_BUFFERING+2+MAX_EXTRA_FRAME_BUFFER_NUM)) // (+2 for current and display_delay)
  95. #define MAX_DPB_SIZE (((MAX_FRM_SIZE+0x3fff)&(~0x3fff))*MAX_DPB_NUM) // frame buffer for codec (MAX_DPB_NUM)
  96. #define MAX_MV_COL_SIZE (((MAX_FRM_SIZE+4)/5)*MAX_DPB_NUM)
  97. #define MAX_PP_SRC_SIZE (((MAX_FRM_SIZE+0x3fff)&(~0x3fff))*MAX_PP_SRC_NUM)
  98. #define CODEC_FRAME_BASE ((((MAX_STREAM_BUF_SIZE*MAX_NUM_INSTANCE)) + 0xff) & (~0xff))
  99. #define REQUIRED_VPU_MEMORY_SIZE (CODEC_FRAME_BASE+((MAX_DPB_SIZE*(1+USE_WTL))+MAX_MV_COL_SIZE+MAX_PP_SRC_SIZE)*MAX_NUM_INSTANCE)
  100. #endif /* __CODA9_VPU_CONFIG_H__ */