Commit 93c37bbd authored by vaclav's avatar vaclav
Browse files

comments/formatting within MD5

parent 6d4b7ea1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -783,9 +783,9 @@ ivas_error ivas_set_ism_metadata(
    const float azimuth,                                        /* i  : azimuth value                               */
#ifdef TD5
    const float elevation,                                      /* i  : elevation value                             */
    float radius_meta,                                          /* i  : radius                                      */
    float yaw,                                                  /* i  : yaw                                         */
    float pitch                                                 /* i  : pitch                                       */
    const float radius_meta,                                    /* i  : radius                                      */
    const float yaw,                                            /* i  : yaw                                         */
    const float pitch                                           /* i  : pitch                                       */
#else
    const float elevation                                       /* i  : elevation value                             */
#endif 
+30 −15
Original line number Diff line number Diff line
@@ -42,13 +42,15 @@
#endif
#include "wmc_auto.h"

/* Local Functions */

#ifdef TD5
/*-----------------------------------------------------------------------*
 * Local functions
 *-----------------------------------------------------------------------*/

static void decode_angle_indices( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, int16_t *flag_abs_azimuth );
int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *flag_abs_radius );

static int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *flag_abs_radius );
#endif

/*-------------------------------------------------------------------------*
@@ -172,12 +174,15 @@ ivas_error ivas_ism_metadata_dec(
            /* IVAS_fmToDo: more work needed when the number of transported objects is not constant */
            return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" );
        }

#ifdef TD5
        /* read extended metadata presence flag */
        if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE )
        {
            ism_extended_metadata_flag = get_next_indice( st0, ISM_EXTENDED_METADATA_BITS );
        }
#endif

        /* Read ISm present flags (one per object) */
        for ( ch = 0; ch < *nchan_transport; ch++ )
        {
@@ -241,6 +246,7 @@ ivas_error ivas_ism_metadata_dec(
                flag_abs_orientation = 0;
                flag_abs_radius = 0;
#endif

                if ( hIsmMeta[ch]->ism_metadata_flag )
                {
#ifdef TD5
@@ -631,18 +637,26 @@ ivas_error ivas_ism_metadata_dec_create(
    return IVAS_ERR_OK;
}


#ifdef TD5
/*-------------------------------------------------------------------------
 * decode_angle_indices()
 *
 * Decoding of an angle
 *-------------------------------------------------------------------------*/

static void decode_angle_indices(
    DEC_CORE_HANDLE st0,             /* i/o: bitstream handle                */
    ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle                    */
    int16_t *flag_abs_azimuth        /* o  : Azimuth encoding mode           */
)
{
    int16_t idx_azimuth, nbits_diff_azimuth, diff, sgn;
    int16_t idx_elevation, nbits_diff_elevation;

    /*----------------------------------------------------------------*
     * Azimuth decoding and dequantization
     *----------------------------------------------------------------*/
    int16_t idx_azimuth, nbits_diff_azimuth, diff, sgn;
    int16_t idx_elevation, nbits_diff_elevation;

    /* Decode azimuth index */
    if ( get_next_indice( st0, 1 ) == 1 ) /* azimuth_abs_flag */
@@ -759,28 +773,32 @@ static void decode_angle_indices(
    {
        idx_elevation = angle->last_elevation_idx;
    }

    /*----------------------------------------------------------------*
     * Final updates
     *----------------------------------------------------------------*/

    /* updates */
    angle->last_azimuth_idx = idx_azimuth;
    angle->last_elevation_idx = idx_elevation;

    return;
}

int16_t decode_radius(

/*-------------------------------------------------------------------------
 * decode_radius()
 *
 * Radius decoding and dequantization
 *-------------------------------------------------------------------------*/

static int16_t decode_radius(
    DEC_CORE_HANDLE st0,      /* i/o: bitstream handle           */
    int16_t *last_radius_idx, /* i/o: last radius index          */
    int16_t *flag_abs_radius  /* o  : Radius encoding mode       */
)
{
    /*----------------------------------------------------------------*
     * Radius decoding and dequantization
     *----------------------------------------------------------------*/
    int16_t idx_radius, nbits_diff_radius, diff, sgn;


    /* Decode radius index */
    if ( get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */
    {
@@ -829,12 +847,9 @@ int16_t decode_radius(
        idx_radius = *last_radius_idx;
    }

    /*----------------------------------------------------------------*
     * Final updates
     *----------------------------------------------------------------*/

    /* updates */
    /* Final updates */
    *last_radius_idx = idx_radius;

    return idx_radius;
}
#endif
+30 −19
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@
 * Local functions
 *-----------------------------------------------------------------------*/
static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HANDLE angle, const int16_t last_ism_metadata_flag, const int16_t ini_frame, const int16_t idx_azimuth_abs, const int16_t idx_elevation_abs, int16_t *flag_abs_azimuth, int16_t *flag_abs_elevation );

static void encode_radius( BSTR_ENC_HANDLE hBstr, int16_t *last_radius_idx, int16_t *radius_diff_cnt, const int16_t last_ism_metadata_flag, const int16_t idx_radius_abs, int16_t *flag_abs_radius );

#endif
@@ -85,9 +86,9 @@ ivas_error ivas_set_ism_metadata(
    const float azimuth,          /* i  : azimuth value         */
#ifdef TD5
    const float elevation,   /* i  : elevation           */
    float radius_meta,     /* i  : radius              */
    float yaw,             /* i  : yaw                 */
    float pitch            /* i  : pitch               */
    const float radius_meta, /* i  : radius              */
    const float yaw,         /* i  : yaw                 */
    const float pitch        /* i  : pitch               */
#else
    const float elevation                   /* i  : elevation value       */
#endif
@@ -108,6 +109,7 @@ ivas_error ivas_set_ism_metadata(
    hIsmMeta->yaw = yaw;
    hIsmMeta->pitch = pitch;
#endif

    return IVAS_ERR_OK;
}

@@ -246,7 +248,6 @@ ivas_error ivas_ism_metadata_enc(
    set_s( flag_abs_radius, 0, num_obj );
#endif


    /*----------------------------------------------------------------*
     * Set Metadata presence / importance flag
     *----------------------------------------------------------------*/
@@ -352,12 +353,15 @@ ivas_error ivas_ism_metadata_enc(
        push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 );
    }
    push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 );

#ifdef TD5
    /* write extended metadata presence flag */
    if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE )
    {
        push_indice( hBstr, IND_ISM_EXTENDED_FLAG, ism_extended_metadata_flag, ISM_EXTENDED_METADATA_BITS );
    }
#endif

    /* write ISm metadata flag (one per object) */
    for ( ch = 0; ch < nchan_transport; ch++ )
    {
@@ -406,11 +410,11 @@ ivas_error ivas_ism_metadata_enc(

            if ( hIsmMeta[ch]->ism_metadata_flag )
            {

#ifdef TD5
                /*----------------------------------------------------------------*
                 * Obtain quantizer indices for azimuth and elevation
                 *----------------------------------------------------------------*/

                if ( ism_mode == ISM_MODE_DISC )
                {
                    idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS );
@@ -433,6 +437,7 @@ ivas_error ivas_ism_metadata_enc(
                    encode_angle_indices( hBstr, &( hIsmMetaData->angle[1] ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_azimuth_abs, idx_elevation_abs, &flag_abs_azimuth_orientation[ch], &flag_abs_elevation[ch] );
                    encode_radius( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] );
                }

                /* save number of metadata bits written */
                if ( ism_mode == ISM_MODE_DISC )
                {
@@ -860,6 +865,7 @@ ivas_error ivas_ism_metadata_enc(
    return error;
}


/*-------------------------------------------------------------------------
 * ivas_ism_metadata_enc_create()
 *
@@ -926,7 +932,14 @@ ivas_error ivas_ism_metadata_enc_create(
    return IVAS_ERR_OK;
}


#ifdef TD5
/*-------------------------------------------------------------------------
 * encode_radius()
 *
 * Radius index encoding
 *-------------------------------------------------------------------------*/

static void encode_radius(
    BSTR_ENC_HANDLE hBstr,                /* i/o: bitstream handle           */
    int16_t *last_radius_idx,             /* i/o: last radius index          */
@@ -938,14 +951,8 @@ static void encode_radius(
{
    int16_t idx_radius, nbits_diff_radius, diff;


    /*----------------------------------------------------------------*
     * Radius index encoding
     *----------------------------------------------------------------*/
    idx_radius = idx_radius_abs;

    nbits_diff_radius = 0;

    *flag_abs_radius = 0; /* differential coding by default */

    if ( *radius_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */
@@ -1023,17 +1030,23 @@ static void encode_radius(
        push_indice( hBstr, IND_ISM_RADIUS, idx_radius, nbits_diff_radius );
    }

    /*----------------------------------------------------------------*
     * Updates
     *----------------------------------------------------------------*/
    /* Updates */
    *last_radius_idx = idx_radius_abs;

    return;
}


/*----------------------------------------------------------------*
 * encode_angle_indices()
 *
 * Encoding of an angle
 *----------------------------------------------------------------*/

static void encode_angle_indices(
    BSTR_ENC_HANDLE hBstr,                /* i/o: bitstream handle                */
    ISM_METADATA_ANGLE_HANDLE angle,      /* i/o: angle handle                    */
    const int16_t last_ism_metadata_flag, /* last frame ism_metadata_flag         */
    const int16_t last_ism_metadata_flag, /* i  : last frame ism_metadata_flag    */
    const int16_t ini_frame,              /* i  : initialization frames counter   */
    const int16_t idx_azimuth_abs,        /* i  : Azimuth index                   */
    const int16_t idx_elevation_abs,      /* i  : Elevation index                 */
@@ -1044,7 +1057,6 @@ static void encode_angle_indices(
    int16_t idx_azimuth, nbits_diff_azimuth, diff;
    int16_t idx_elevation, nbits_diff_elevation;


    /*----------------------------------------------------------------*
     * Azimuth index encoding
     *----------------------------------------------------------------*/
@@ -1145,10 +1157,9 @@ static void encode_angle_indices(
    /*----------------------------------------------------------------*
     * Elevation index encoding
     *----------------------------------------------------------------*/
    idx_elevation = idx_elevation_abs;

    idx_elevation = idx_elevation_abs;
    nbits_diff_elevation = 0;

    *flag_abs_elevation = 0;                      /* differential coding by default */
    if ( angle->elevation_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */
         || last_ism_metadata_flag == 0           /* If last frame had no metadata coded, do not use differential coding */
+3 −4
Original line number Diff line number Diff line
@@ -1013,6 +1013,9 @@ typedef struct encoder_config_structure
    int16_t sba_order;                              /* Ambisonic (SBA) order */
    int16_t sba_planar;                             /* Ambisonic (SBA) planar flag */
    MC_LS_SETUP mc_input_setup;                     /* multichannel input ls setup */
#ifdef TD5
    int16_t ism_extended_metadata_flag;             /* flag indicating extended metadata encoding, including radius and orientation (yaw, pitch) in ISM format */
#endif

    int16_t Opt_AMR_WB;                             /* flag indicating AMR-WB IO mode */

@@ -1027,10 +1030,6 @@ typedef struct encoder_config_structure
    int16_t Opt_SC_VBR;                             /* flag indicating SC-VBR mode */
    int16_t last_Opt_SC_VBR;                        /* flag indicating prev frame's SC-VBR mode */

#ifdef TD5
    int16_t ism_extended_metadata_flag;             /* flag indicating whether extended metadata encoding, including radius and orientation (yaw, pitch) */
#endif

    /* temp. development parameters */
    int16_t Opt_PCA_ON;                             /* flag indicating PCA operation in SBA */

+1 −0
Original line number Diff line number Diff line
@@ -2013,6 +2013,7 @@ static ivas_error sanitizeBitrateISM(
    {
        return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate );
    }

#ifdef TD5
    if ( hEncoderConfig->ivas_total_brate < ISM_EXTENDED_METADATA_BRATE && hEncoderConfig->ism_extended_metadata_flag == 1 )
    {
+2 −2

File changed.

Contains only whitespace changes.

Loading