1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 /* 19 ------------------------------------------------------------------------------ 20 21 PacketVideo Corp. 22 MP3 Decoder Library 23 24 Filename: pvmp3_mpeg2_stereo_proc.cpp 25 26 Functions: 27 28 pvmp3_st_intensity_ver2 29 pvmp3_mpeg2_stereo_proc 30 31 Date: 09/21/2007 32 33 ------------------------------------------------------------------------------ 34 REVISION HISTORY 35 36 37 Description: 38 39 40 ------------------------------------------------------------------------------ 41 42 pvmp3_st_intensity_ver2 43 44 INPUT AND OUTPUT DEFINITIONS 45 46 Input 47 48 int32 xr[], input channel 49 int32 xl[], 50 int32 m, selecting index: io = 2(1/4) (m=0), io = 2(1/8) (m=1) 51 int32 is_pos, index on table is_pos_pow_eitgh_root_of_2 52 int32 Start, Location of first element where stereo intensity is applied 53 int32 Number number of elements affected 54 55 Returns 56 57 int32 xl[], generated stereo channel 58 59 60 61 62 ------------------------------------------------------------------------------ 63 64 pvmp3_mpeg2_stereo_proc 65 66 INPUT AND OUTPUT DEFINITIONS 67 68 Input 69 70 int32 xr[], input channel 71 int32 xl[], 72 mp3ScaleFactors *scalefac, scale factors structure for Right channel 73 granuleInfo *gr_info_l, granule structure for the left channel 74 granuleInfo *gr_info_r, granule structure for the rigth channel 75 uint32 *scalefac_IIP_buffer, auxiliary scale factor vector 76 mp3Header *info mp3 header info 77 Returns 78 79 int32 xl[], generated stereo channel 80 81 82 ------------------------------------------------------------------------------ 83 FUNCTION DESCRIPTION 84 85 stereo processing for mpeg2 layer III LSF extension 86 87 ------------------------------------------------------------------------------ 88 REQUIREMENTS 89 90 91 ------------------------------------------------------------------------------ 92 REFERENCES 93 94 [1] ISO MPEG Audio Subgroup Software Simulation Group (1996) 95 ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension 96 97 ------------------------------------------------------------------------------ 98 PSEUDO-CODE 99 100 ------------------------------------------------------------------------------ 101 */ 102 103 104 /*---------------------------------------------------------------------------- 105 ; INCLUDES 106 ----------------------------------------------------------------------------*/ 107 108 #include "pvmp3_mpeg2_stereo_proc.h" 109 #include "pvmp3_stereo_proc.h" 110 #include "pv_mp3dec_fxd_op.h" 111 #include "pvmp3_tables.h" 112 #include "mp3_mem_funcs.h" 113 114 /*---------------------------------------------------------------------------- 115 ; MACROS 116 ; Define module specific macros here 117 ----------------------------------------------------------------------------*/ 118 119 120 /*---------------------------------------------------------------------------- 121 ; DEFINES 122 ; Include all pre-processor statements here. Include conditional 123 ; compile variables also. 124 ----------------------------------------------------------------------------*/ 125 126 #define Q31_fmt(a) (int32(double(0x7FFFFFFF)*a)) 127 128 /*---------------------------------------------------------------------------- 129 ; LOCAL FUNCTION DEFINITIONS 130 ; Function Prototype declaration 131 ----------------------------------------------------------------------------*/ 132 133 /*---------------------------------------------------------------------------- 134 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS 135 ; Variable declaration - defined here and used outside this module 136 ----------------------------------------------------------------------------*/ 137 const int32 is_pos_pow_eitgh_root_of_2[8] = 138 { 139 /* --- 2^(1/8) ----- */ 140 Q31_fmt(1.00000000000000), Q31_fmt(0.91700404320467), Q31_fmt(0.84089641525371), 141 Q31_fmt(0.77110541270397), Q31_fmt(0.70710678118655), Q31_fmt(0.64841977732550), 142 Q31_fmt(0.59460355750136), Q31_fmt(0.54525386633263) 143 }; 144 145 /*---------------------------------------------------------------------------- 146 ; EXTERNAL FUNCTION REFERENCES 147 ; Declare functions defined elsewhere and referenced in this module 148 ----------------------------------------------------------------------------*/ 149 150 /*---------------------------------------------------------------------------- 151 ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES 152 ; Declare variables used in this module but defined elsewhere 153 ----------------------------------------------------------------------------*/ 154 155 /*---------------------------------------------------------------------------- 156 ; FUNCTION CODE 157 ----------------------------------------------------------------------------*/ 158 159 void pvmp3_st_intensity_ver2(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS], 160 int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS], 161 int32 m, 162 int32 is_pos, 163 int32 Start, 164 int32 Number) 165 { 166 int32 k[2]; 167 168 /* pow(io, ((is_pos + 1)>>1)); io = 2(1/4) (m=0), io = 2(1/8) (m=1) */ 169 k[0] = is_pos_pow_eitgh_root_of_2[((is_pos+1)&(3+(m<<2)))<<(1-m)] >> ((is_pos + 1) >> (2 + m)); 170 /* pow(io, (is_pos>>1)); io = 2(1/4) (m=0), io = 2(1/8) (m=1) */ 171 k[1] = is_pos_pow_eitgh_root_of_2[(is_pos&(3+(m<<2)))<<(1-m)] >> (is_pos >> (2 + m)); 172 173 174 int32 *pt_xr = &xr[Start]; 175 int32 *pt_xl = &xl[Start]; 176 177 if (is_pos == 0) /* 0 < is_pos < 31 */ 178 { 179 pv_memcpy(pt_xl, pt_xr, Number*sizeof(*pt_xr)); 180 } 181 else if (is_pos & 1) 182 { 183 for (int32 i = Number >> 1; i != 0; i--) 184 { 185 *(pt_xl++) = (*pt_xr); 186 *(pt_xr) = fxp_mul32_Q32((*pt_xr) << 1, k[0]); 187 pt_xr++; 188 *(pt_xl++) = (*pt_xr); 189 *(pt_xr) = fxp_mul32_Q32((*pt_xr) << 1, k[0]); 190 pt_xr++; 191 } 192 if (Number&1) 193 { 194 *(pt_xl) = (*pt_xr); 195 *(pt_xr) = fxp_mul32_Q32((*pt_xr) << 1, k[0]); 196 } 197 } 198 else 199 { 200 for (int32 i = Number >> 1; i != 0; i--) 201 { 202 *(pt_xl++) = fxp_mul32_Q32((*(pt_xr++)) << 1, k[1]); 203 *(pt_xl++) = fxp_mul32_Q32((*(pt_xr++)) << 1, k[1]); 204 } 205 if (Number&1) 206 { 207 *(pt_xl) = fxp_mul32_Q32((*pt_xr) << 1, k[1]); 208 } 209 } 210 211 } 212 213 214 215 /*---------------------------------------------------------------------------- 216 ; FUNCTION CODE 217 ----------------------------------------------------------------------------*/ 218 void pvmp3_mpeg2_stereo_proc(int32 xr[SUBBANDS_NUMBER*FILTERBANK_BANDS], 219 int32 xl[SUBBANDS_NUMBER*FILTERBANK_BANDS], 220 mp3ScaleFactors *scalefac_R, 221 granuleInfo *gr_info_l, 222 granuleInfo *gr_info_r, 223 uint32 *scalefac_IIP_buffer, 224 int32 used_freq_lines, 225 mp3Header *info) 226 { 227 228 int32 sfreq; 229 int32 sb; 230 int32 ss; 231 int32 sfbNo; 232 int32 sfbStart; 233 int32 sfb; 234 int32 sfbTemp; 235 int32 i; 236 int32 j; 237 int32 io; 238 239 240 int32 i_stereo = (info->mode == MPG_MD_JOINT_STEREO) && 241 (info->mode_ext & 0x1); 242 243 int32 ms_stereo = (info->mode == MPG_MD_JOINT_STEREO) && 244 (info->mode_ext & 0x2); 245 246 247 if (i_stereo) 248 { 249 if (gr_info_r->scalefac_compress & 1) 250 { 251 io = 0; /* 2^(-1/4) */ 252 } 253 else 254 { 255 io = 1; /* 2^(-1/8) */ 256 } 257 258 sfreq = info->version_x + (info->version_x << 1); 259 sfreq += info->sampling_frequency; 260 261 if (gr_info_l->window_switching_flag && (gr_info_l->block_type == 2)) 262 { 263 if (gr_info_l->mixed_block_flag) 264 { 265 /* 266 * mixed blocks processing 267 */ 268 i = 31; 269 ss = 17; 270 sb = -1; 271 272 while (i >= 0) 273 { 274 if (xl[(i*FILTERBANK_BANDS) + ss]) 275 { 276 sb = (i << 4) + (i << 1) + ss; 277 i = -1; 278 } 279 else 280 { 281 ss--; 282 if (ss < 0) 283 { 284 i--; 285 ss = 17; 286 } 287 } 288 } /* now sb is the number of highest line with value != 0 */ 289 /* can be between -1 (all lines zero) and 575 (no line zero) */ 290 291 if (sb < 36) /* was (sb <= 36) */ 292 { 293 /* 294 * mixed blocks processing: intensity bound inside long blocks 295 */ 296 /* 1. long blocks up to intensity border: Stereo or M/S */ 297 if (mp3_sfBandIndex[sfreq].l[4] <= sb) 298 { 299 i = 4; 300 } 301 else 302 { 303 i = 0; 304 } 305 306 while (mp3_sfBandIndex[sfreq].l[i] <= sb) 307 { 308 i++; 309 } 310 sfbTemp = i; /* from that (long) sfb on we have intensity stereo */ 311 312 sfbNo = mp3_sfBandIndex[sfreq].l[sfbTemp]; /* number of lines to process */ 313 314 /* from sfbStart up sfbNo lines do ms_stereo or normal stereo */ 315 if (ms_stereo) 316 { 317 pvmp3_st_mid_side(xr, xl, 0, sfbNo); 318 } 319 320 /* 2. long blocks from intensity border up to sfb band 6: intensity */ 321 /* calc. MPEG_1_2_Factor[0], MPEG_1_2_Factor[1] */ 322 323 for (sfb = sfbTemp; sfb < 6; sfb++) 324 { 325 sfbStart = mp3_sfBandIndex[sfreq].l[sfb]; /* = Start in 0 ... 575 */ 326 sfbNo = mp3_sfBandIndex[sfreq].l[sfb+1] - mp3_sfBandIndex[sfreq].l[sfb]; /* No of lines to process */ 327 328 if ((uint32)(scalefac_R->l[sfb]) != scalefac_IIP_buffer[sfb]) 329 { 330 pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->l[sfb], sfbStart, sfbNo); 331 } 332 else if (ms_stereo) 333 { 334 pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo); 335 } 336 } 337 338 /* 3. now process all sfb with short blocks (3...12), all in intensity mode */ 339 340 for (j = 0; j < 3; j++) 341 { 342 /* first calculate directional factors for intensity stereo, 343 * for all sfb in intensity mode, but only 344 * if they do not have "illegal" position: 345 */ 346 /* to do this for all sfb we have to get information for last scale factor band: 347 * here we clearly have more than one sfb in intensity mode, 348 * so copy factors and legal/illegal information from sfb11 to sfb12 349 */ 350 (scalefac_R->s[j][12]) = (scalefac_R->s[j][11]); 351 scalefac_IIP_buffer[36 + j] = scalefac_IIP_buffer[33 + j]; /* legal/illegal in sfb 12 same as in sfb 11 */ 352 353 for (sfb = 3; sfb < 13; sfb++) 354 { 355 sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; /* No of lines to process */ 356 sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo; 357 358 if ((uint32)(scalefac_R->s[j][sfb]) != scalefac_IIP_buffer[3*sfb + j]) 359 { 360 pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->s[j][sfb], sfbStart, sfbNo); 361 } 362 else if (ms_stereo) 363 { 364 pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo); 365 } 366 } 367 } /* for (j = 0; j < 3; j++) */ 368 } 369 else /* else then (sb >= 36) */ 370 { 371 /* 372 * mixed blocks processing: intensity bound outside long blocks 373 */ 374 375 /* 2. short blocks, do for all 3 */ 376 /* ------------------------------ */ 377 for (j = 0; j < 3; j++) 378 { 379 int32 sfbcnt = -1; 380 381 for (sfb = 12; sfb >= 3; sfb--) 382 { 383 int32 lines = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; 384 385 i = 3 * mp3_sfBandIndex[sfreq].s[sfb] + (j + 1) * lines - 1; 386 387 while (lines > 0) 388 { 389 if (xl[i]) 390 { 391 sfbcnt = sfb; 392 sfb = -10; 393 lines = -10; 394 } 395 lines--; 396 i--; 397 } 398 } 399 400 sfbcnt += 1; 401 if (sfbcnt < 3) 402 { 403 sfbcnt = 3; /* should not be necessary */ 404 } 405 406 sfbTemp = sfbcnt; /* from this (short) sfb on we have intensity mode */ 407 /* can have values between 3 (all short sfb in intensity) */ 408 /* and 13 (no short sfb in intensity mode) */ 409 410 /* 3. from sfbTemp to last sfb calculate is_ratio values: */ 411 /* first calculate directional factors for intensity stereo, */ 412 /* for all sfb in intensity mode, but only */ 413 /* if they do not have "illegal" position: */ 414 415 /* to do this for all sfb we have to get information for last scale factor band: */ 416 /* get factors for last scale factor band: */ 417 /* more than one sfb in intensity mode, 418 copy factors and legal/illegal information from sfb11 to sfb12 */ 419 if (sfbTemp < 12) 420 { 421 (scalefac_R->s[j][12]) = (scalefac_R->s[j][11]); 422 scalefac_IIP_buffer[36 + j] = scalefac_IIP_buffer[33 + j]; /* legal/illegal in sfb 12 same as in sfb 11 */ 423 } 424 else if (sfbTemp == sfb) 425 /* only sfb 12 in intensity mode, use factors corresponding to is_pos[12] == 0 */ 426 { 427 (scalefac_R->s[j][12]) = 0; 428 scalefac_IIP_buffer[36 + j] = 1; /* the scf value 0 in sfb12 is "legal" */ 429 } 430 /* if sfbTemp > sfb (no sfb in intensity mode): do nothing */ 431 432 433 /* 4. do normal stereo or MS stereo from sfb 3 to < sfbTemp: */ 434 for (sfb = 3; sfb < sfbTemp; sfb++) 435 { 436 sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; 437 sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo; 438 439 if (ms_stereo) 440 { 441 pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo); 442 } 443 } 444 445 /* 5. now intensity stereo processing of the remaining sfb's: */ 446 447 for (sfb = sfbTemp; sfb < 13; sfb++) 448 { 449 sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; /* No of lines to process */ 450 sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo; 451 if ((uint32)(scalefac_R->s[j][sfb]) != scalefac_IIP_buffer[3*sfb + j]) 452 { 453 pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->s[j][sfb], sfbStart, sfbNo); 454 } 455 else if (ms_stereo) 456 { 457 pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo); 458 } 459 } 460 /* end of correction by efs 2003-07-04 */ 461 } /* for (j = 0; j < 3; j++) */ 462 463 464 /* long blocks 0 up to sfb band 6: no intensity */ 465 466 sfbNo = mp3_sfBandIndex[sfreq].l[6]; /* number of lines to process */ 467 if (ms_stereo) 468 { 469 pvmp3_st_mid_side(xr, xl, 0, sfbNo); 470 } 471 472 } /* if intensity bound inside or outside long blocks */ 473 } /* if (gr_info->mixed_block_flag) */ 474 else 475 { 476 /* 477 * short block processing 478 */ 479 for (j = 0; j < 3; j++) 480 { 481 int32 sfbcnt = -1; 482 483 for (sfb = 12; sfb >= 0; sfb--) 484 { 485 int32 lines = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; 486 i = 3 * mp3_sfBandIndex[sfreq].s[sfb] + (j + 1) * lines - 1; 487 488 while (lines > 0) 489 { 490 if (xl[i]) 491 { 492 sfbcnt = sfb; 493 sfb = -10; 494 lines = -10; 495 } 496 lines--; 497 i--; 498 } 499 } 500 501 sfbcnt += 1; 502 503 /* start of corrected version by efs 2003-07-04 */ 504 sfbTemp = sfbcnt; /* from this (short) sfb on we have intensity mode */ 505 /* can have values between 3 (all short sfb in intensity) */ 506 /* and 13 (no short sfb in intensity mode) */ 507 508 /* first calculate directional factors for intensity stereo, 509 for all sfb in intensity mode, but only 510 if they do not have "illegal" position: */ 511 512 /* to do this for all sfb we have to get information for last scale factor band: */ 513 /* get factors for last scale factor band: */ 514 /* more than one sfb in intensity mode, 515 copy factors and legal/illegal information from sfb11 to sfb12 */ 516 if (sfbTemp < 12) 517 { 518 (scalefac_R->s[j][12]) = (scalefac_R->s[j][11]); 519 scalefac_IIP_buffer[36 + j] = scalefac_IIP_buffer[33 + j]; /* legal/illegal in sfb 12 same as in sfb 11 */ 520 } 521 else if (sfbTemp == 12) 522 /* only sfb 12 in intensity mode, use factors corresponding to is_pos[12] == 0 */ 523 { 524 (scalefac_R->s[j][12]) = 0; 525 scalefac_IIP_buffer[36 + j] = 1; /* the scf value 0 in sfb12 is "legal" */ 526 } 527 /* if sfbTemp > sfb (no sfb in intensity mode): do nothing */ 528 529 530 /* Now process audio samples */ 531 /* first process lower sfb's not in intensity mode */ 532 for (sfb = 0; sfb < sfbTemp; sfb++) 533 { 534 sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; 535 sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo; 536 537 if (ms_stereo) 538 { 539 pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo); 540 } 541 } 542 543 /* now intensity stereo processing of the remaining sfb's: */ 544 for (sfb = sfbTemp; sfb < 13; sfb++) 545 { 546 sfbNo = mp3_sfBandIndex[sfreq].s[sfb+1] - mp3_sfBandIndex[sfreq].s[sfb]; /* No of lines to process */ 547 sfbStart = 3 * mp3_sfBandIndex[sfreq].s[sfb] + j * sfbNo; 548 549 if ((uint32)(scalefac_R->s[j][sfb]) != scalefac_IIP_buffer[3*sfb + j]) 550 { 551 pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->s[j][sfb], sfbStart, sfbNo); 552 } 553 else if (ms_stereo) 554 { 555 pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo); 556 } 557 } 558 559 } /* for (j = 0; j < 3; j++) */ 560 561 } /* end of else ( gr_info->mixed_block_flag) */ 562 563 } /* if (gr_info->window_switching_flag && (gr_info->block_type == 2)) */ 564 else 565 { 566 /* 567 * long block processing 568 */ 569 i = 31; 570 ss = 17; 571 sb = 0; 572 573 while (i >= 0) 574 { 575 if (xl[(i*FILTERBANK_BANDS) + ss]) 576 { 577 sb = (i << 4) + (i << 1) + ss; 578 /* i = -1 patched RF 24-09-2002 */ 579 i = -2; 580 } 581 else 582 { 583 ss--; 584 if (ss < 0) 585 { 586 i--; 587 ss = 17; 588 } 589 } 590 } 591 592 /* patched RF 24-09-2002 */ 593 if (sb) 594 { 595 if (mp3_sfBandIndex[sfreq].l[14] <= sb) 596 { 597 i = 14; 598 } 599 else if (mp3_sfBandIndex[sfreq].l[7] <= sb) 600 { 601 i = 7; 602 } 603 else 604 { 605 i = 0; 606 } 607 608 while (mp3_sfBandIndex[sfreq].l[i] <= sb) 609 { 610 i++; 611 } 612 } 613 614 else 615 { 616 if (i == -1) 617 { 618 /* all xr[1][][] are 0: set IS bound sfb to 0 */ 619 i = 0; 620 } 621 else 622 { 623 /* xr[1][0][0] is unequal 0 and all others are 0: set IS bound sfb to 1 */ 624 i = 1; 625 } 626 } 627 /* corrected version by efs 2003-07-04 */ 628 sfbTemp = i; /* from this (long) sfb on we have intensity mode */ 629 /* can have values between 0 (all long sfb in intensity) */ 630 /* and 22 (no long sfb in intensity mode) */ 631 632 /* first calculate directional factors for intensity stereo, 633 for all sfb in intensity mode, but only if they 634 do not have "illegal" position: */ 635 636 /* to do this for all sfb we have to get information for last scale factor band: */ 637 if (sfbTemp < 21) 638 /* more than one sfb in intensity mode, */ 639 /* copy factors and legal/illegal information from sfb20 to sfb21 */ 640 { 641 (scalefac_R->l[21]) = (scalefac_R->l[20]); 642 scalefac_IIP_buffer[21] = scalefac_IIP_buffer[20]; /* legal/illegal in sfb 21 same as in sfb 20 */ 643 } 644 else if (sfbTemp == 21) 645 /* only sfb 21 in intensity mode, is_pos[21] = 0 */ 646 { 647 (scalefac_R->l[21]) = 0; 648 scalefac_IIP_buffer[21] = 1; /* the scf value 0 in sfb21 is "legal" */ 649 } 650 /* if sfbTemp > 21 (no sfb in intensity mode): do nothing */ 651 652 653 /* Now process audio samples */ 654 /* first process lower sfb's not in intensity mode */ 655 656 sfbNo = mp3_sfBandIndex[sfreq].l[sfbTemp] - mp3_sfBandIndex[sfreq].l[0]; 657 sfbStart = mp3_sfBandIndex[sfreq].l[0]; 658 659 if (ms_stereo) 660 { 661 pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo); 662 } 663 664 /* now intensity stereo processing of the remaining sfb's: */ 665 for (sfb = sfbTemp; sfb < 22; sfb++) 666 { 667 sfbNo = mp3_sfBandIndex[sfreq].l[sfb+1] - mp3_sfBandIndex[sfreq].l[sfb]; /* number of lines to process */ 668 sfbStart = mp3_sfBandIndex[sfreq].l[sfb]; /* start of sfb */ 669 670 if ((uint32)(scalefac_R->l[sfb]) != scalefac_IIP_buffer[sfb]) /* "legal" position ? */ 671 { 672 pvmp3_st_intensity_ver2(xr, xl, io, scalefac_R->l[sfb], sfbStart, sfbNo); 673 } 674 else if (ms_stereo) 675 { 676 pvmp3_st_mid_side(xr, xl, sfbStart, sfbNo); 677 } 678 679 } /* for (sfb = sfbTemp; sfb < 22; sfb++) */ 680 681 } /* if (gr_info->window_switching_flag && (gr_info->block_type == 2)) */ 682 683 } /* if (i_stereo) */ 684 else 685 { 686 /* 687 * normal or ms stereo processing 688 */ 689 if (ms_stereo) 690 { 691 pvmp3_st_mid_side(xr, xl, 0, used_freq_lines); 692 } 693 694 } /* if (i_stereo) */ 695 696 } 697 698 699 700 701