Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22242519 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "latest-usac-b128648229"

* changes:
  C2SoftXaac: Updating plugin to support latest conformance changes
  SoftXaac: Updating plugin to support latest conformance changes
parents 19e848e3 62ecb20f
Loading
Loading
Loading
Loading
+75 −60
Original line number Diff line number Diff line
@@ -1309,6 +1309,17 @@ IA_ERRORCODE C2SoftXaacDec::decodeXAACStream(uint8_t* inBuffer,
                                &ui_exec_done);
    RETURN_IF_FATAL(err_code,  "IA_CMD_TYPE_DONE_QUERY");

    int32_t num_preroll = 0;
    err_code = ixheaacd_dec_api(mXheaacCodecHandle,
                                IA_API_CMD_GET_CONFIG_PARAM,
                                IA_ENHAACPLUS_DEC_CONFIG_GET_NUM_PRE_ROLL_FRAMES,
                                &num_preroll);
    RETURN_IF_FATAL(err_code, "IA_ENHAACPLUS_DEC_CONFIG_GET_NUM_PRE_ROLL_FRAMES");

    {
      int32_t preroll_frame_offset = 0;

        do {
            if (ui_exec_done != 1) {
                VOID* p_array;        // ITTIAM:buffer to handle gain payload
                WORD32 buf_size = 0;  // ITTIAM:gain payload length
@@ -1363,7 +1374,8 @@ IA_ERRORCODE C2SoftXaacDec::decodeXAACStream(uint8_t* inBuffer,
            RETURN_IF_FATAL(err_code,  "IA_API_CMD_GET_OUTPUT_BYTES");

            if (mMpegDDRCPresent == 1) {
        memcpy(mDrcInBuf, mOutputBuffer, *outBytes);
                memcpy(mDrcInBuf, mOutputBuffer + preroll_frame_offset, *outBytes);
                preroll_frame_offset += *outBytes;
                err_code = ia_drc_dec_api(mMpegDDrcHandle, IA_API_CMD_SET_INPUT_BYTES, 0, outBytes);
                RETURN_IF_FATAL(err_code, "IA_API_CMD_SET_INPUT_BYTES");

@@ -1373,6 +1385,9 @@ IA_ERRORCODE C2SoftXaacDec::decodeXAACStream(uint8_t* inBuffer,

                memcpy(mOutputBuffer, mDrcOutBuf, *outBytes);
            }
            num_preroll--;
        } while (num_preroll > 0);
    }
    return IA_NO_ERROR;
}

+64 −49
Original line number Diff line number Diff line
@@ -1426,13 +1426,21 @@ IA_ERRORCODE SoftXAAC::decodeXAACStream(uint8_t* inBuffer, uint32_t inBufferLeng
    RETURN_IF_FATAL(err_code, "IA_CMD_TYPE_DO_EXECUTE");

    UWORD32 ui_exec_done;
    WORD32 i_num_preroll = 0;
    /* Checking for end of processing */
    err_code = ixheaacd_dec_api(mXheaacCodecHandle, IA_API_CMD_EXECUTE, IA_CMD_TYPE_DONE_QUERY,
                                &ui_exec_done);
    RETURN_IF_FATAL(err_code, "IA_CMD_TYPE_DONE_QUERY");

#ifdef ENABLE_MPEG_D_DRC
    err_code = ixheaacd_dec_api(mXheaacCodecHandle, IA_API_CMD_GET_CONFIG_PARAM,
                              IA_ENHAACPLUS_DEC_CONFIG_GET_NUM_PRE_ROLL_FRAMES,
                              &i_num_preroll);

    RETURN_IF_FATAL(err_code, "IA_ENHAACPLUS_DEC_CONFIG_GET_NUM_PRE_ROLL_FRAMES");
    {
        int32_t pi_preroll_frame_offset = 0;
        do {
#ifdef ENABLE_MPEG_D_DRC
            if (ui_exec_done != 1) {
                VOID* p_array;        // ITTIAM:buffer to handle gain payload
                WORD32 buf_size = 0;  // ITTIAM:gain payload length
@@ -1455,12 +1463,13 @@ IA_ERRORCODE SoftXAAC::decodeXAACStream(uint8_t* inBuffer, uint32_t inBufferLeng

                    memcpy(mDrcInBuf, p_array, buf_size);
                    /* Set number of bytes to be processed */
                err_code =
                    ia_drc_dec_api(mMpegDDrcHandle, IA_API_CMD_SET_INPUT_BYTES_BS, 0, &buf_size);
                    err_code = ia_drc_dec_api(mMpegDDrcHandle, IA_API_CMD_SET_INPUT_BYTES_BS,
                                              0, &buf_size);
                    RETURN_IF_FATAL(err_code, "IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT");

                    err_code = ia_drc_dec_api(mMpegDDrcHandle, IA_API_CMD_SET_CONFIG_PARAM,
                                          IA_DRC_DEC_CONFIG_GAIN_STREAM_FLAG, &gain_stream_flag);
                                              IA_DRC_DEC_CONFIG_GAIN_STREAM_FLAG,
                                              &gain_stream_flag);
                    RETURN_IF_FATAL(err_code, "IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT");

                    /* Execute process */
@@ -1471,30 +1480,36 @@ IA_ERRORCODE SoftXAAC::decodeXAACStream(uint8_t* inBuffer, uint32_t inBufferLeng
                    mMpegDDRCPresent = 1;
                }
            }
    }
#endif
            /* How much buffer is used in input buffers */
            err_code =
        ixheaacd_dec_api(mXheaacCodecHandle, IA_API_CMD_GET_CURIDX_INPUT_BUF, 0, bytesConsumed);
                ixheaacd_dec_api(mXheaacCodecHandle, IA_API_CMD_GET_CURIDX_INPUT_BUF,
                                 0, bytesConsumed);
            RETURN_IF_FATAL(err_code, "IA_API_CMD_GET_CURIDX_INPUT_BUF");

            /* Get the output bytes */
    err_code = ixheaacd_dec_api(mXheaacCodecHandle, IA_API_CMD_GET_OUTPUT_BYTES, 0, outBytes);
            err_code = ixheaacd_dec_api(mXheaacCodecHandle,
                                        IA_API_CMD_GET_OUTPUT_BYTES, 0, outBytes);
            RETURN_IF_FATAL(err_code, "IA_API_CMD_GET_OUTPUT_BYTES");
#ifdef ENABLE_MPEG_D_DRC

            if (mMpegDDRCPresent == 1) {
        memcpy(mDrcInBuf, mOutputBuffer, *outBytes);
        err_code = ia_drc_dec_api(mMpegDDrcHandle, IA_API_CMD_SET_INPUT_BYTES, 0, outBytes);
                memcpy(mDrcInBuf, mOutputBuffer + pi_preroll_frame_offset, *outBytes);
                pi_preroll_frame_offset += *outBytes;
                err_code = ia_drc_dec_api(mMpegDDrcHandle, IA_API_CMD_SET_INPUT_BYTES,
                                          0, outBytes);
                RETURN_IF_FATAL(err_code, "IA_API_CMD_SET_INPUT_BYTES");

        err_code =
            ia_drc_dec_api(mMpegDDrcHandle, IA_API_CMD_EXECUTE, IA_CMD_TYPE_DO_EXECUTE, NULL);
                err_code = ia_drc_dec_api(mMpegDDrcHandle, IA_API_CMD_EXECUTE,
                                          IA_CMD_TYPE_DO_EXECUTE, NULL);
                RETURN_IF_FATAL(err_code, "IA_CMD_TYPE_DO_EXECUTE");

                memcpy(mOutputBuffer, mDrcOutBuf, *outBytes);
            }
#endif
            i_num_preroll--;
        } while (i_num_preroll > 0);
    }
    return IA_NO_ERROR;
}