Skip to content

Commit

Permalink
update audio and video framework for C302X RC4 SDk
Browse files Browse the repository at this point in the history
Signed-off-by: subing.xu <subing.xu@amlogic.com>
  • Loading branch information
subing.xu authored and codingspirit committed Jul 26, 2023
1 parent 08dddce commit 7d460fc
Show file tree
Hide file tree
Showing 30 changed files with 4,860 additions and 19 deletions.
813 changes: 813 additions & 0 deletions 3rdparty/C302/include/fdk-aac/FDK_audio.h

Large diffs are not rendered by default.

1,090 changes: 1,090 additions & 0 deletions 3rdparty/C302/include/fdk-aac/aacdecoder_lib.h

Large diffs are not rendered by default.

1,731 changes: 1,731 additions & 0 deletions 3rdparty/C302/include/fdk-aac/aacenc_lib.h

Large diffs are not rendered by default.

584 changes: 584 additions & 0 deletions 3rdparty/C302/include/fdk-aac/genericStds.h

Large diffs are not rendered by default.

411 changes: 411 additions & 0 deletions 3rdparty/C302/include/fdk-aac/machine_type.h

Large diffs are not rendered by default.

202 changes: 202 additions & 0 deletions 3rdparty/C302/include/fdk-aac/syslib_channelMapDescr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
scheme for digital audio. This FDK AAC Codec software is intended to be used on
a wide variety of Android devices.
AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
general perceptual audio codecs. AAC-ELD is considered the best-performing
full-bandwidth communications codec by independent studies and is widely
deployed. AAC has been standardized by ISO and IEC as part of the MPEG
specifications.
Patent licenses for necessary patent claims for the FDK AAC Codec (including
those of Fraunhofer) may be obtained through Via Licensing
(www.vialicensing.com) or through the respective patent owners individually for
the purpose of encoding or decoding bit streams in products that are compliant
with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
Android devices already license these patent claims through Via Licensing or
directly from the patent owners, and therefore FDK AAC Codec software may
already be covered under those patent licenses when it is used for those
licensed purposes only.
Commercially-licensed AAC software libraries, including floating-point versions
with enhanced sound quality, are also available from Fraunhofer. Users are
encouraged to check the Fraunhofer website for additional applications
information and documentation.
2. COPYRIGHT LICENSE
Redistribution and use in source and binary forms, with or without modification,
are permitted without payment of copyright license fees provided that you
satisfy the following conditions:
You must retain the complete text of this software license in redistributions of
the FDK AAC Codec or your modifications thereto in source code form.
You must retain the complete text of this software license in the documentation
and/or other materials provided with redistributions of the FDK AAC Codec or
your modifications thereto in binary form. You must make available free of
charge copies of the complete source code of the FDK AAC Codec and your
modifications thereto to recipients of copies in binary form.
The name of Fraunhofer may not be used to endorse or promote products derived
from this library without prior written permission.
You may not charge copyright license fees for anyone to use, copy or distribute
the FDK AAC Codec software or your modifications thereto.
Your modified versions of the FDK AAC Codec must carry prominent notices stating
that you changed the software and the date of any change. For modified versions
of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
AAC Codec Library for Android."
3. NO PATENT LICENSE
NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
Fraunhofer provides no warranty of patent non-infringement with respect to this
software.
You may use this FDK AAC Codec software or modifications thereto only for
purposes that are authorized by appropriate patent licenses.
4. DISCLAIMER
This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
including but not limited to the implied warranties of merchantability and
fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
or consequential damages, including but not limited to procurement of substitute
goods or services; loss of use, data, or profits, or business interruption,
however caused and on any theory of liability, whether in contract, strict
liability, or tort (including negligence), arising in any way out of the use of
this software, even if advised of the possibility of such damage.
5. CONTACT INFORMATION
Fraunhofer Institute for Integrated Circuits IIS
Attention: Audio and Multimedia Departments - FDK AAC LL
Am Wolfsmantel 33
91058 Erlangen, Germany
www.iis.fraunhofer.de/amm
amm-info@iis.fraunhofer.de
----------------------------------------------------------------------------- */

/************************* System integration library **************************
Author(s): Thomas Dietzen
Description:
*******************************************************************************/

/** \file syslib_channelMapDescr.h
* \brief Function and structure declarations for the channel map descriptor implementation.
*/

#ifndef SYSLIB_CHANNELMAPDESCR_H
#define SYSLIB_CHANNELMAPDESCR_H

#include "machine_type.h"

/**
* \brief Contains information needed for a single channel map.
*/
typedef struct {
const UCHAR*
pChannelMap; /*!< Actual channel mapping for one single configuration. */
UCHAR numChannels; /*!< The number of channels for the channel map which is
the maximum used channel index+1. */
} CHANNEL_MAP_INFO;

/**
* \brief This is the main data struct. It contains the mapping for all
* channel configurations such as administration information.
*
* CAUTION: Do not access this structure directly from a algorithm specific
* library. Always use one of the API access functions below!
*/
typedef struct {
const CHANNEL_MAP_INFO* pMapInfoTab; /*!< Table of channel maps. */
UINT mapInfoTabLen; /*!< Length of the channel map table array. */
UINT fPassThrough; /*!< Flag that defines whether the specified mapping shall
be applied (value: 0) or the input just gets passed
through (MPEG mapping). */
} FDK_channelMapDescr;

#ifdef __cplusplus
extern "C" {
#endif

/**
* \brief Initialize a given channel map descriptor.
*
* \param pMapDescr Pointer to a channel map descriptor to be initialized.
* \param pMapInfoTab Table of channel maps to initizalize the descriptor
with.
* If a NULL pointer is given a default table for
WAV-like mapping will be used.
* \param mapInfoTabLen Length of the channel map table array (pMapInfoTab).
If a zero length is given a default table for WAV-like mapping will be used.
* \param fPassThrough If the flag is set the reordering (given by
pMapInfoTab) will be bypassed.
*/
void FDK_chMapDescr_init(FDK_channelMapDescr* const pMapDescr,
const CHANNEL_MAP_INFO* const pMapInfoTab,
const UINT mapInfoTabLen, const UINT fPassThrough);

/**
* \brief Change the channel reordering state of a given channel map
* descriptor.
*
* \param pMapDescr Pointer to a (initialized) channel map descriptor.
* \param fPassThrough If the flag is set the reordering (given by
* pMapInfoTab) will be bypassed.
* \return Value unequal to zero if set operation was not
* successful. And zero on success.
*/
int FDK_chMapDescr_setPassThrough(FDK_channelMapDescr* const pMapDescr,
UINT fPassThrough);

/**
* \brief Get the mapping value for a specific channel and map index.
*
* \param pMapDescr Pointer to channel map descriptor.
* \param chIdx Channel index.
* \param mapIdx Mapping index (corresponding to the channel configuration
* index).
* \return Mapping value.
*/
UCHAR FDK_chMapDescr_getMapValue(const FDK_channelMapDescr* const pMapDescr,
const UCHAR chIdx, const UINT mapIdx);

/**
* \brief Evaluate whether channel map descriptor is reasonable or not.
*
* \param pMapDescr Pointer to channel map descriptor.
* \return Value unequal to zero if descriptor is valid, otherwise
* zero.
*/
int FDK_chMapDescr_isValid(const FDK_channelMapDescr* const pMapDescr);

/**
* Extra variables for setting up Wg4 channel mapping.
*/
extern const CHANNEL_MAP_INFO FDK_mapInfoTabWg4[];
extern const UINT FDK_mapInfoTabLenWg4;

#ifdef __cplusplus
}
#endif

#endif /* !defined(SYSLIB_CHANNELMAPDESCR_H) */
2 changes: 2 additions & 0 deletions 3rdparty/C302/include/ipc_audio_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ int IPC_AUDIO_UpdateAttr(unsigned int uflag);
int IPC_AUDIO_Init(unsigned int uflag);
void IPC_AUDIO_UnInit(unsigned int uflag);

int IPC_AUDIO_SYS_Init();
void IPC_AUDIO_SYS_UnInit();

#ifdef __cplusplus
#if __cplusplus
Expand Down
6 changes: 3 additions & 3 deletions 3rdparty/C302/include/ipc_cfg_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ typedef enum IPC_CFG_VI_OPTIONS

typedef enum IPC_CFG_STREAM_OPTIONS
{
CFG_STREAM_OPTION_VIID = 0,
CFG_STREAM_OPTION_PPUID,
CFG_STREAM_OPTION_CHANNEL = 0,
CFG_STREAM_OPTION_RESOLUTION,
CFG_STREAM_OPTION_FORMAT,
CFG_STREAM_OPTION_ENCODEC,
Expand Down Expand Up @@ -93,10 +92,11 @@ typedef enum IPC_CFG_IMAGE_OPTIONS
CFG_IMAGE_OPTION_LDC,
CFG_IMAGE_OPTION_HLC,
CFG_IMAGE_OPTION_HLCLEVEL,
CFG_IMAGE_OPTION_FLICKER,
CFG_IMAGE_OPTION_FULL_COLOR,
CFG_IMAGE_OPTION_IRCUT,
CFG_IMAGE_OPTION_D2N,
CFG_IMAGE_OPTION_N2D,
CFG_IMAGE_OPTION_FLICKER,
CFG_IMAGE_OPTION_BUTT
} IPC_CFG_IMAGE_OPTIONS;

Expand Down
18 changes: 14 additions & 4 deletions 3rdparty/C302/include/ipc_cfg_define.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ extern "C" {
#define MAX_CFG_NUM 64
#define MAX_CFG_AREA_NUM 4

#define VIDEO_STREAM_ISP_ID 2
#define VIDEO_STREAM_PPU_CHN 2

#define EACH_VI_MAX_ISP_CHN 3
#define CALU_ISP_CHN_BY_VI(vi, ppu) ((vi*EACH_VI_MAX_ISP_CHN)+ppu) // Each sensor has 3 physical channels
#define CALU_ISP_CHN_BY_ID(viid, ispid) ((viid*EACH_VI_MAX_ISP_CHN)+ispid) // Each sensor has 3 physical channels

typedef enum IPC_CFG_DATA_TYPE
{
Expand Down Expand Up @@ -97,6 +100,7 @@ typedef enum IPC_RESOLUTION
{
PIC_CIF = 0, // 352x288
PIC_360P, // 640x360
PIC_480P, // 720*480
PIC_D1, // 704x576
PIC_720P, // 1280x720
PIC_1080P, // 1920x1080
Expand All @@ -107,6 +111,12 @@ typedef enum IPC_RESOLUTION
PIC_BUTT
} IPC_RESOLUTION;

typedef enum IPC_VIDEO_STREAM
{
VIDEO_STREAM_MAIN = 0,
VIDEO_STREAM_BUTT
} IPC_VIDEO_STREAM;

typedef enum IPC_VFORMAT_TYPE
{
FORMAT_NONE = 0,
Expand Down Expand Up @@ -194,8 +204,7 @@ typedef struct IPC_VI_CONFIG
/* video encode stream */
typedef struct IPC_STREAM_CONFIG
{
int s32ViId;
int s32PpuId;
int s32Channel;
IPC_RESOLUTION enResolution; // resolution
IPC_VFORMAT_TYPE enFormat; // stream format,0-need encode,1-not need encode,raw NV21
IPC_VCODEC_TYPE enCodec; // encode type
Expand Down Expand Up @@ -236,10 +245,11 @@ typedef struct IPC_IMAGE_CONFIG
unsigned char u8LDC; // distortion correction
unsigned char u8HLC; // strong light suppression
unsigned char u8HLCLevel; // strong light suppression level:0-close 1-low 2-mid 3-high
unsigned char u8AntiFlickerMode; // antiflicker mode: 0-disable 1-50hz 2-60hz 3-Auto
unsigned char u8FullColor; // is full color mode enabled, 0-disable, 1-enable
IPC_IRCUT_TYPE enIrcutType; // IRCUT type
unsigned int u32DayToNight; // day to night time, valid only in timed mode
unsigned int u32NightToDay; // night to day time, valid only in timed mode
unsigned char u8AntiFlickerMode; // antiflicker mode: 0-disable 1-50hz 2-60hz 3-Auto
} IPC_IMAGE_CONFIG;

typedef struct IPC_VIDEO_CONFIG
Expand Down
12 changes: 6 additions & 6 deletions 3rdparty/C302/include/ipc_video_define.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ int IPC_ISP_SetWBAttr(int sChn, IPC_IMAGE_CONFIG *pstImageCfg);
int IPC_ISP_SetMirrorAndFlip(int sChn, unsigned char uMirror, unsigned char uFlip);

//=====================================ppu api=============================================
int IPC_PPU_GetChnStatus(int sViId, int sPpuId);
int IPC_PPU_GetChn(int sViId, int sPpuId);
int IPC_PPU_GetChnStatus(int sPpuGrp, int sPpuChn);
int IPC_PPU_SetLdcAttr(int sPpuGrp, IPC_IMAGE_CONFIG *pstImageCfg, IPC_STREAM_CONFIG *pstStreamCfg);


//=====================================vi api=============================================
int IPC_VI_GetViNum();
int IPC_VI_GetViChn(int sViId);
int IPC_VI_GetViPipe(int sViId);
unsigned int IPC_VI_GetInputFps(int sViId);
int IPC_VI_SetInputFps(int sViId, unsigned int uFps);
int IPC_VI_GetWdr(int sViId);
int IPC_VI_SetWdr(int sViId, int sWDR);
Expand All @@ -116,7 +116,7 @@ int IPC_IRCUT_SetCfg(int sChn, IPC_IMAGE_CONFIG *pstImageCfg);


//=======================================base api=================================================
int IPC_SYS_Init(IPC_VIDEO_CONFIG *pstVideoConfig, int sIsEncode);
int IPC_SYS_Init(IPC_VIDEO_CONFIG *pstVideoConfig);
void IPC_SYS_UnInit();

int IPC_VI_Start();
Expand All @@ -126,13 +126,13 @@ void IPC_VI_UnInit();

int IPC_ISP_RestartSns(int nViPipe, IPC_SNS_TYPE enSnsType);
int IPC_ISP_StandbySns(int nViPipe, IPC_SNS_TYPE enSnsType);
unsigned int IPC_ISP_CalcFrameSize(int sViId, int sPpuId);
unsigned int IPC_ISP_CalcFrameSize(int sPpuGrp);
int IPC_ISP_ChnStart();
void IPC_ISP_ChnStop();
int IPC_ISP_ChnInit(IPC_VIDEO_CONFIG *pstVideoCfg);
void IPC_ISP_ChnUnInit();

int IPC_PPU_GetFrame(int sViId, int sPpuId, void* pdata, unsigned int u32size,
int IPC_PPU_GetFrame(int sPpuGrp, void* pdata, unsigned int u32size,
unsigned int *u32len, unsigned long long *u64pts);
int IPC_PPU_Start();
void IPC_PPU_Stop();
Expand Down
Binary file removed 3rdparty/C302/lib/dynamic/libAudioSignalProcess.so
Binary file not shown.
Binary file removed 3rdparty/C302/lib/dynamic/libasp.so
Binary file not shown.
Binary file removed 3rdparty/C302/lib/dynamic/libaudio.so
Binary file not shown.
Binary file removed 3rdparty/C302/lib/dynamic/libmbuffer.so
Binary file not shown.
Binary file removed 3rdparty/C302/lib/dynamic/libparam.so
Binary file not shown.
Binary file removed 3rdparty/C302/lib/dynamic/libvideo.so
Binary file not shown.
Binary file added 3rdparty/C302/lib/libAudioSignalProcess.so
Binary file not shown.
Binary file added 3rdparty/C302/lib/libasp.so
Binary file not shown.
Binary file added 3rdparty/C302/lib/libaudio.a
Binary file not shown.
Binary file added 3rdparty/C302/lib/libmbuffer.a
Binary file not shown.
Binary file added 3rdparty/C302/lib/libparam.a
Binary file not shown.
Binary file added 3rdparty/C302/lib/libvideo.a
Binary file not shown.
Binary file removed 3rdparty/C302/lib/static/libaudio.a
Binary file not shown.
Binary file removed 3rdparty/C302/lib/static/libmbuffer.a
Binary file not shown.
Binary file removed 3rdparty/C302/lib/static/libparam.a
Binary file not shown.
Binary file removed 3rdparty/C302/lib/static/libvideo.a
Binary file not shown.
2 changes: 0 additions & 2 deletions 3rdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ User need to put C302 board SDK under [3rdparty/C302](C302/), including `sysroot
C302/
├── include
├── lib
│ ├── dynamic
│ └── static
└── sysroot
```

Expand Down
4 changes: 2 additions & 2 deletions CMake/C302.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ if(BOARD STREQUAL "C302")

set(BOARD_DESTINATION_PLATFORM arm-unknown-linux-gnu)

link_directories(${BOARD_SDK_DIR}/lib/static ${BOARD_SDK_DIR}/lib/dynamic)
link_directories(${BOARD_SDK_DIR}/lib)

set(BOARD_LIBS_SHARED
pthread dl m z fdk-aac
sns_imx290 sns_imx307 sns_imx335 sns_gc4653 sns_imx415
ae alg awb dewarp mbi mbi_dewarp mbi_isp mbi_venc ppu asp AudioSignalProcess
param video audio mbuffer
libparam.a libvideo.a libaudio.a libmbuffer.a
)
set(BOARD_LIBS_STATIC
pthread dl m z fdk-aac
Expand Down
2 changes: 1 addition & 1 deletion source/C302/C302AudioCapturer.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#define USING_HARD_STREAM_AUDIO

#define DEFAULT_VOLUME 50
#define DEFAULT_VOLUME 14

#define C302_HANDLE_GET(x) C302AudioCapturer* audioHandle = (C302AudioCapturer*) ((x))

Expand Down
2 changes: 1 addition & 1 deletion source/C302/C302AudioPlayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#define C302_HANDLE_GET(x) C302AudioPlayer* audioHandle = (C302AudioPlayer*) ((x))

#define DEFAULT_VOLUME 50
#define DEFAULT_VOLUME 31

typedef struct {
AudioPlayerStatus status;
Expand Down

0 comments on commit 7d460fc

Please sign in to comment.