Commit 085ba227 authored by Manuel Jander's avatar Manuel Jander
Browse files

Merge remote-tracking branch 'origin' into...

Merge remote-tracking branch 'origin' into 2232-ivas-conformance-on-basop-release-build-fails-on-4-isar-post-rend-cmdline
parents 77a30532 596ebef8
Loading
Loading
Loading
Loading
Loading
+63 −19
Original line number Diff line number Diff line
@@ -178,19 +178,27 @@ typedef struct
static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP(
    DecArguments arg,
    BS_READER_HANDLE hBsReader,
    IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf,
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
    ObjectEditFileReader *objectEditFileReader,
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
#ifdef DECODER_FORMAT_SWITCHING
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
#endif
#else
#ifdef DDECODER_FORMAT_SWITCHING
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    IVAS_RENDER_CONFIG_DATA *renderConfig,
#endif
#ifdef DECODER_FORMAT_SWITCHING
    IVAS_DEC_HANDLE *phIvasDec,
#else
    IVAS_DEC_HANDLE hIvasDec,
#endif
    int16_t *pcmBuf );
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader );

@@ -232,6 +240,9 @@ int main(
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA **pAE = NULL;
    uint32_t aeCount = 0;
#endif
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    IVAS_RENDER_CONFIG_DATA renderConfig = { 0 };
#endif
#ifdef WMOPS
    reset_wmops();
    reset_mem( USE_BYTES );
@@ -530,7 +541,9 @@ int main(

    if ( arg.renderConfigEnabled )
    {
#ifndef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
        IVAS_RENDER_CONFIG_DATA renderConfig;
#endif

        /* sanity check */
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB &&
@@ -730,19 +743,19 @@ int main(

    if ( arg.voipMode )
    {
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader,
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
#ifdef DECODER_FORMAT_SWITCHING
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &hIvasDec, pcmBuf );
#else
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf );
                            &splitRendBits,
#endif
#else
#ifdef DDECODER_FORMAT_SWITCHING
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &hIvasDec, pcmBuf );
#else
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf );
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
                            &renderConfig,
#endif
#ifdef DECODER_FORMAT_SWITCHING
                            &hIvasDec,
#else
                            hIvasDec,
#endif
                            pcmBuf );
    }
    else
    {
@@ -1910,12 +1923,16 @@ static ivas_error initOnFirstGoodFrame(
            fParamsSR = fopen( srParamsFile, "w" );
            if ( NULL != fParamsSR )
            {
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
                fprintf( fParamsSR, "DOF = %d;\nLC3PLUS_HIGHRES = %d;\n", poseCorrection, lc3plusHighRes );
#else
                fprintf( fParamsSR, "CODEC = %s;\nDOF = %d;\nFRAMESIZE = %d;\nRENDERSIZE = %d;\nLC3PLUS_HIGHRES = %d;\n",
                         splitRendCodec == ISAR_SPLIT_REND_CODEC_LC3PLUS ? "LC3PLUS" : "LCLD",
                         poseCorrection,
                         splitRendCodecFrameSizeMs,
                         splitRendIsarFrameSizeMs,
                         lc3plusHighRes );
#endif
                fclose( fParamsSR );
                fParamsSR = NULL;
            }
@@ -3008,6 +3025,9 @@ static ivas_error decodeVoIP(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
#endif
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    IVAS_RENDER_CONFIG_DATA *renderConfig,
#endif
#ifdef DECODER_FORMAT_SWITCHING
    IVAS_DEC_HANDLE *phIvasDec,
#else
@@ -3050,7 +3070,11 @@ static ivas_error decodeVoIP(
#ifdef IVAS_RTPDUMP
    IVAS_RTP ivasRtp = { 0 };
    IVAS_RTP srRtp = { 0 };
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
    IVAS_RTP_SR_INFO srInfo = { true, false, 0, 20, IVAS_SR_TRANSPORT_LCLD };
#else
    IVAS_RTP_SR_INFO srInfo = { true, false, 0, IVAS_SR_TRANSPORT_LCLD };
#endif
    int32_t initialTsOffsetSystemAndRTP = 0;
#else
    FILE *f_rtpstream = NULL;
@@ -3128,8 +3152,10 @@ static ivas_error decodeVoIP(
        case IVAS_DEC_INPUT_FORMAT_RTPDUMP:
        case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF:
#ifdef IVAS_RTPDUMP
#ifndef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
#ifdef RTP_S4_251135_CR26253_0016_REV1
            if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, 0, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK )
#endif
#else
            if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK )
#endif
@@ -3249,7 +3275,11 @@ static ivas_error decodeVoIP(
                &hIvasDec,
                newCodecInPacket,
                &arg,
#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
                renderConfig,
#else
                NULL, /* ToDo : Provide rendererConfig */
#endif
                NULL /* ToDo : Provide LS Custom Data */
            );
            if ( error != IVAS_ERR_OK )
@@ -3745,6 +3775,9 @@ static ivas_error decodeVoIP(
        {
            srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->codec_frame_size_ms;
            srInfo.codec = ( splitRendBits->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) ? IVAS_SR_TRANSPORT_LC3PLUS : IVAS_SR_TRANSPORT_LCLD;
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
            srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->codec_frame_size_ms;
#endif
            if ( ( error = IVAS_RTP_WriteNextFrame( &srRtp, splitRendBits->bits_buf, &srInfo, (int16_t) splitRendBits->bits_written, false, false ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while pushing SR audio bitstream to RTP pack\n", ivas_error_to_string( error ) );
@@ -4374,6 +4407,7 @@ ivas_error restartDecoder(
        goto cleanup;
    }

#ifndef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    if ( arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
@@ -4390,6 +4424,7 @@ ivas_error restartDecoder(

        arg->enableHeadRotation = true;
    }
#endif

    if ( arg->voipMode )
    {
@@ -4406,6 +4441,15 @@ ivas_error restartDecoder(
        goto cleanup;
    }

#ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART
    /* ISAR frame size is set from command line, not renderer config file.
     * This will be ignored if output format is not split rendering. */
    if ( renderConfig != NULL )
    {
        renderConfig->split_rend_config.isar_frame_size_ms = (int16_t) arg->renderFramesize /* given in number of 5ms subframes */ * 5;
    }
#endif

    if ( arg->renderConfigEnabled && renderConfig != NULL )
    {
        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, *renderConfig ) ) != IVAS_ERR_OK )
+78 −0
Original line number Diff line number Diff line
@@ -749,6 +749,9 @@ static void trim( char *str )

static ivas_error parseSRParamsFile(
    const char *srParamsFilePath,
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
    const char *rtpFilePath,
#endif
    ISAR_SPLIT_REND_CODEC *codec,
    ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection,
    int16_t *codec_frame_size_ms,
@@ -775,6 +778,24 @@ static ivas_error parseSRParamsFile(
            trim( key );
            trim( value );

#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
            if ( 0 == strncmp( key, "DOF", 3 ) )
            {
                int val = atoi( value );
                if ( val == 0 || val == 1 )
                {
                    *poseCorrection = ( val == 0 ) ? ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE : ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB;
                }
            }
            else if ( 0 == strncmp( key, "LC3PLUS_HIGHRES", 15 ) )
            {
                int val = atoi( value );
                if ( val == 0 || val == 1 )
                {
                    *lc3plusHighRes = (int16_t) val;
                }
            }
#else
            if ( 0 == strncmp( key, "CODEC", 5 ) )
            {
                *codec = ( 0 == strncmp( value, "LCLD", 4 ) ) ? ISAR_SPLIT_REND_CODEC_LCLD : *codec;
@@ -812,10 +833,52 @@ static ivas_error parseSRParamsFile(
                    *lc3plusHighRes = (int16_t) val;
                }
            }
#endif
        }
    }

    fclose( fParamSR );

#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
    {
        /* Peek the RTP stream to ascertain the codec and codec_frame_size */
        ivas_error error = IVAS_ERR_OK;
        IVAS_RTP srRtp = { 0 };
        if ( ( error = IVAS_RTP_READER_Init( &srRtp, rtpFilePath, NULL, false, NULL ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "error in IVAS_RTP_READER_Init() for sr RTP peek: %d\n", error );
            return error;
        }

        /* read a frame */
        while ( 1 )
        {
            bool qBit = false;
            IVAS_RTP_SR_INFO srInfo = { 0 };
            uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3];
            int16_t auSize = 0;
            uint16_t rtpSequenceNumber = 0;
            uint32_t rtpTimeStamp = 0, nextPacketRcvTime_ms = 0;

            error = IVAS_RTP_ReadNextFrame( &srRtp, au, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, &srInfo, &qBit );
            if ( error != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in IVAS_RTP_ReadNextFrame, error code: %d\n", error );
                return error;
            }

            if ( srInfo.valid )
            {
                *codec = ( srInfo.codec == IVAS_SR_TRANSPORT_LCLD ) ? ISAR_SPLIT_REND_CODEC_LCLD : ISAR_SPLIT_REND_CODEC_LC3PLUS;
                *codec_frame_size_ms = (int16_t) srInfo.codecFrameSizeMs;
                *isar_frame_size_ms = *codec_frame_size_ms; /* for rtp force codec framesize as isar renderer frame size */
                break;
            }
        }
        IVAS_RTP_Term( &srRtp );
    }
#endif

    return IVAS_ERR_OK;
}
#endif
@@ -949,6 +1012,9 @@ int main(
    if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].srRtp ) )
    {
        error = parseSRParamsFile( args.srParamsFilePath,
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
                                   args.inputFilePath,
#endif
                                   &bitsBuffer.config.codec,
                                   &bitsBuffer.config.poseCorrection,
                                   &bitsBuffer.config.codec_frame_size_ms,
@@ -960,12 +1026,21 @@ int main(
            goto cleanup;
        }

#ifndef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
        if ( ( error = IVAS_RTP_READER_Init( &srRTP, (uint32_t) bitsBuffer.config.codec_frame_size_ms, args.inputFilePath, NULL, false, NULL ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_RTP_READER_Init( &srRTP, args.inputFilePath, NULL, false, NULL ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "error in IVAS_RTP_READER_Init(): %d\n", error );
            goto cleanup;
        }
        audioReader = NULL;

#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
        /* Force owerwrite of command line provided rendersize to align with codec frame size */
        args.render_framesize = bitsBuffer.config.isar_frame_size_ms / 5;
#endif
    }
    /*if split renderer is running in post renderer mode*/
    else if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) )
@@ -1202,6 +1277,9 @@ int main(
                    if ( error == IVAS_ERR_END_OF_FILE )
                    {
                        numSamplesRead = 0;
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
                        break;
#endif
                    }
                    else
                    {
+3 −0
Original line number Diff line number Diff line
@@ -108,6 +108,8 @@
#define NONBE_FIX_2205_SATURATE_ALTERNATIVE
#define NONBE_FIX_2206_SATURATE_ALTERNATIVE
#define FIX_2226_ISAR_PRE_CRASH_CLDFB_NO_CHANNELS           /* Dolby: Fix crash of ISAR pre-renderer due to an attempt of re-scaling  uninitialized values in the CLDFB filter bank */
#define RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE                 /* Dolby: CR for split rendering codec framesize signalling in Toc Byte */


#define NONBE_FIX_ISSUE_2232_CHECK_CLDFB_STATES             /* FhG: Adjust scaleFactor according to st->cldfbSyn->cldfb_state_fx too to avoid overflow in cldfbSynthesis_ivas_fx() */

@@ -159,6 +161,7 @@
#define REVERSE_ISM_PI_DATA                            /* Add reading and packing/unpacking of reverse ISM PI data */
#define PI_LATENCY                                     /* Support for PI latency */
#define DECODER_FORMAT_SWITCHING                       /* Re-initialize the decoder when the format/subformat of the incoming stream is changed */
#define FIX_SPLIT_RENDERING_ON_DECODER_RESTART         /* Re-configure split rendering on decoder restart */

/* #################### End BASOP porting switches ############################ */

+6 −3
Original line number Diff line number Diff line
@@ -275,6 +275,9 @@ typedef struct
    bool valid;           /* Valid Split Rendering Info for/in the ToC */
    bool diegetic;        /* SR content digetic */
    uint32_t bitrateKbps; /* SR bitrate in kbps */
#ifdef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
    uint32_t codecFrameSizeMs; /* SR transport codec framesize in ms (5/10/20) */
#endif
    IVAS_RTP_SR_TRANSPORT codec; /* SR Transport Codec used*/
} IVAS_RTP_SR_INFO;
#endif /* RTP_S4_251135_CR26253_0016_REV1 */
+4 −0
Original line number Diff line number Diff line
@@ -920,8 +920,10 @@ ivas_error IVAS_RTP_WRITER_Init(

ivas_error IVAS_RTP_READER_Init(
    IVAS_RTP *rtp, /* i/o : IVAS RTP File reader handle  */
#ifndef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
#ifdef RTP_S4_251135_CR26253_0016_REV1
    uint32_t srCodecFrameSizeMs, /* i   : SR Codec Framesize in ms */
#endif
#endif
    const char *inputBitstreamFilename, /* i   : Input rtpdump filename       */
    const char *piOutputFilename,       /* i   : Output PI data json filename */
@@ -934,8 +936,10 @@ ivas_error IVAS_RTP_READER_Init(
    memset( rtp, 0, sizeof( IVAS_RTP ) );

    rtp->unpackCfg.maxFramesPerPacket = IVAS_MAX_FRAMES_PER_RTP_PACKET;
#ifndef RTP_SR_CODEC_FRAME_SIZE_IN_TOC_BYTE
#ifdef RTP_S4_251135_CR26253_0016_REV1
    rtp->unpackCfg.srCodecFrameSizeMs = srCodecFrameSizeMs;
#endif
#endif
    rtp->rtpPacket.buffer = rtp->packet;
    rtp->rtpPacket.capacity = sizeof( rtp->packet );
Loading