Mercurial > libavcodec.hg
comparison wavpack.c @ 4364:05e932ddaaa9 libavcodec
rename BE/LE_8/16/32 to AV_RL/B_8/16/32
author | alex |
---|---|
date | Fri, 19 Jan 2007 22:12:59 +0000 |
parents | d6f83e2f8804 |
children | 41ee67dd4bef |
comparison
equal
deleted
inserted
replaced
4363:9b7662fa4905 | 4364:05e932ddaaa9 |
---|---|
385 | 385 |
386 if (buf_size == 0) return 0; | 386 if (buf_size == 0) return 0; |
387 | 387 |
388 memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); | 388 memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); |
389 | 389 |
390 s->samples = LE_32(buf); buf += 4; | 390 s->samples = AV_RL32(buf); buf += 4; |
391 if(!s->samples) return buf_size; | 391 if(!s->samples) return buf_size; |
392 /* should not happen but who knows */ | 392 /* should not happen but who knows */ |
393 if(s->samples * 2 * avctx->channels > AVCODEC_MAX_AUDIO_FRAME_SIZE){ | 393 if(s->samples * 2 * avctx->channels > AVCODEC_MAX_AUDIO_FRAME_SIZE){ |
394 av_log(avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); | 394 av_log(avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); |
395 return -1; | 395 return -1; |
396 } | 396 } |
397 s->joint = LE_32(buf) & WV_JOINT; buf += 4; | 397 s->joint = AV_RL32(buf) & WV_JOINT; buf += 4; |
398 s->CRC = LE_32(buf); buf += 4; | 398 s->CRC = AV_RL32(buf); buf += 4; |
399 // parse metadata blocks | 399 // parse metadata blocks |
400 while(buf < buf_end){ | 400 while(buf < buf_end){ |
401 id = *buf++; | 401 id = *buf++; |
402 size = *buf++; | 402 size = *buf++; |
403 if(id & WP_IDF_LONG) { | 403 if(id & WP_IDF_LONG) { |
465 continue; | 465 continue; |
466 } | 466 } |
467 t = 0; | 467 t = 0; |
468 for(i = s->terms - 1; (i >= 0) && (t < size); i--) { | 468 for(i = s->terms - 1; (i >= 0) && (t < size); i--) { |
469 if(s->decorr[i].value > 8){ | 469 if(s->decorr[i].value > 8){ |
470 s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2; | 470 s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; |
471 s->decorr[i].samplesA[1] = wp_exp2(LE_16(buf)); buf += 2; | 471 s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2; |
472 if(s->stereo){ | 472 if(s->stereo){ |
473 s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2; | 473 s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; |
474 s->decorr[i].samplesB[1] = wp_exp2(LE_16(buf)); buf += 2; | 474 s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2; |
475 t += 4; | 475 t += 4; |
476 } | 476 } |
477 t += 4; | 477 t += 4; |
478 }else if(s->decorr[i].value < 0){ | 478 }else if(s->decorr[i].value < 0){ |
479 s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2; | 479 s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2; |
480 s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2; | 480 s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2; |
481 t += 4; | 481 t += 4; |
482 }else{ | 482 }else{ |
483 for(j = 0; j < s->decorr[i].value; j++){ | 483 for(j = 0; j < s->decorr[i].value; j++){ |
484 s->decorr[i].samplesA[j] = wp_exp2(LE_16(buf)); buf += 2; | 484 s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2; |
485 if(s->stereo){ | 485 if(s->stereo){ |
486 s->decorr[i].samplesB[j] = wp_exp2(LE_16(buf)); buf += 2; | 486 s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2; |
487 } | 487 } |
488 } | 488 } |
489 t += s->decorr[i].value * 2 * avctx->channels; | 489 t += s->decorr[i].value * 2 * avctx->channels; |
490 } | 490 } |
491 } | 491 } |
496 av_log(avctx, AV_LOG_ERROR, "Entropy vars size should be %i, got %i", 6 * avctx->channels, size); | 496 av_log(avctx, AV_LOG_ERROR, "Entropy vars size should be %i, got %i", 6 * avctx->channels, size); |
497 buf += ssize; | 497 buf += ssize; |
498 continue; | 498 continue; |
499 } | 499 } |
500 for(i = 0; i < 3 * avctx->channels; i++){ | 500 for(i = 0; i < 3 * avctx->channels; i++){ |
501 s->median[i] = wp_exp2(LE_16(buf)); | 501 s->median[i] = wp_exp2(AV_RL16(buf)); |
502 buf += 2; | 502 buf += 2; |
503 } | 503 } |
504 got_entropy = 1; | 504 got_entropy = 1; |
505 break; | 505 break; |
506 case WP_ID_DATA: | 506 case WP_ID_DATA: |