Changeset 2117 for pjproject


Ignore:
Timestamp:
Jul 10, 2008 7:26:03 PM (16 years ago)
Author:
nanang
Message:

Added config settings for search range in WSOLA expand()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/wsola.c

    r2115 r2117  
    4040 
    4141/* Buffer size including history, in frames */ 
    42 #define FRAME_CNT       5 
     42#define FRAME_CNT       6 
    4343 
    4444/* Number of history frames in buffer */ 
     
    5353/* Number of frames in erase buffer */ 
    5454#define ERASE_CNT       ((unsigned)3) 
     55 
     56/* Minimum distance from template for find_pitch() of expansion, in frames */ 
     57#define EXP_MIN_DIST    0.5 
     58 
     59/* Maximum distance from template for find_pitch() of expansion, in frames */ 
     60#define EXP_MAX_DIST    HIST_CNT 
    5561 
    5662 
     
    114120    pj_uint16_t          min_extra;         /* Minimum extra (const)        */ 
    115121    pj_uint16_t          expand_cnt;        /* Consecutive expansion count  */ 
     122    pj_uint16_t          expand_sr_min_dist;/* Minimum distance from template  
     123                                               for find_pitch() on expansion 
     124                                               (const)                      */ 
     125    pj_uint16_t          expand_sr_max_dist;/* Maximum distance from template  
     126                                               for find_pitch() on expansion 
     127                                               (const)                      */ 
    116128 
    117129#if defined(PJ_HAS_FLOATING_POINT) && PJ_HAS_FLOATING_POINT!=0 
     
    480492    if ((options & PJMEDIA_WSOLA_NO_PLC) == 0) { 
    481493        wsola->min_extra = wsola->hanning_size; 
     494        wsola->expand_sr_min_dist = (pj_uint16_t) 
     495                                    (EXP_MIN_DIST * wsola->samples_per_frame); 
     496        wsola->expand_sr_max_dist = (pj_uint16_t) 
     497                                    (EXP_MAX_DIST * wsola->samples_per_frame); 
    482498    } 
    483499 
     
    539555    for (rep=1;; ++rep) { 
    540556        pj_int16_t *start, *templ; 
    541         unsigned min_dist, max_dist, dist; 
     557        unsigned dist; 
    542558 
    543559        templ = reg1 + reg1_len - wsola->hanning_size; 
    544560        CHECK_(templ - reg1 >= wsola->hist_size); 
    545561 
    546         max_dist = wsola->hist_size; 
    547         min_dist = wsola->hanning_size >> 1; 
    548  
    549         start = find_pitch(templ, templ - max_dist, templ - min_dist, 
    550                            wsola->templ_size, 1); 
     562        start = find_pitch(templ,  
     563                           templ - wsola->expand_sr_max_dist,  
     564                           templ - wsola->expand_sr_min_dist, 
     565                           wsola->templ_size,  
     566                           1); 
    551567 
    552568        /* Should we make sure that "start" is really aligned to 
Note: See TracChangeset for help on using the changeset viewer.