Changeset 513 for pjproject/trunk/pjmedia/src/pjmedia/resample.c
- Timestamp:
- Jun 16, 2006 3:54:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/resample.c
r495 r513 59 59 * - move stddefs.h and resample.h to this file. 60 60 * - const correctness. 61 * - fixed SrcLinear() may write pass output buffer.62 * - assume the same for SrcUp() and SrcUD(), so put the same63 * protection.64 61 */ 65 62 #include <pjmedia/resample.h> … … 261 258 Yend = Ystart + (unsigned)(nx * pFactor); 262 259 endTime = time + (1<<Np)*(WORD)nx; 263 while (time < endTime && Y < Yend) /* bennylp fix: added Y < Yend */260 while (time < endTime) 264 261 { 265 262 iconst = (time) & Pmask; … … 400 397 Yend = Ystart + (unsigned)(nx * pFactor); 401 398 endTime = time + (1<<Np)*(WORD)nx; 402 while (time < endTime && Y < Yend) /* bennylp fix: protect Y */399 while (time < endTime) 403 400 { 404 401 xp = &X[time>>Np]; /* Ptr to current input sample */ … … 444 441 Yend = Ystart + (unsigned)(nx * pFactor); 445 442 endTime = time + (1<<Np)*(WORD)nx; 446 while (time < endTime && Y < Yend) /* bennylp fix: protect Y */443 while (time < endTime) 447 444 { 448 445 xp = &X[time>>Np]; /* Ptr to current input sample */ … … 496 493 /* 497 494 * If we're downsampling, always use the fast algorithm since it seems 498 * to yield the same performance.495 * to yield the same quality. 499 496 */ 500 497 if (rate_out < rate_in) { 498 //no this is not a good idea. It sounds pretty good with speech, 499 //but very poor with background noise etc. 501 500 //high_quality = 0; 502 501 } … … 534 533 if (high_quality) { 535 534 unsigned size; 536 unsigned i;537 535 538 536 /* This is a bug in xoff calculation, thanks Stephane Lussier … … 552 550 PJ_ASSERT_RETURN(resample->buffer, PJ_ENOMEM); 553 551 554 for (i=0; i<resample->xoff*2; ++i) { 555 resample->buffer[i] = 0; 556 } 552 pjmedia_zero_samples(resample->buffer, resample->xoff*2); 557 553 558 554 … … 562 558 563 559 *p_resample = resample; 560 561 PJ_LOG(5,(THIS_FILE, "resample created: %s qualiy, %s filter, in/out " 562 "rate=%d/%d", 563 (high_quality?"high":"low"), 564 (large_filter?"large":"small"), 565 rate_in, rate_out)); 564 566 return PJ_SUCCESS; 565 567 } … … 574 576 575 577 if (resample->high_quality) { 576 unsigned i;577 578 pj_int16_t *dst_buf; 578 579 const pj_int16_t *src_buf; … … 645 646 */ 646 647 dst_buf = resample->buffer + resample->xoff*2; 647 for (i=0; i<resample->frame_size; ++i) dst_buf[i] = input[i];648 pjmedia_copy_samples(dst_buf, input, resample->frame_size); 648 649 649 650 if (resample->factor >= 1) { … … 689 690 dst_buf = resample->buffer; 690 691 src_buf = input + resample->frame_size - resample->xoff*2; 691 for (i=0; i<resample->xoff * 2; ++i) { 692 dst_buf[i] = src_buf[i]; 693 } 692 pjmedia_copy_samples(dst_buf, src_buf, resample->xoff * 2); 694 693 695 694 } else {
Note: See TracChangeset
for help on using the changeset viewer.