Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: patched-ffmpeg-mt/libavcodec/tta.c

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * TTA (The Lossless True Audio) decoder 2 * TTA (The Lossless True Audio) decoder
3 * Copyright (c) 2006 Alex Beregszaszi 3 * Copyright (c) 2006 Alex Beregszaszi
4 * 4 *
5 * This file is part of FFmpeg. 5 * This file is part of FFmpeg.
6 * 6 *
7 * FFmpeg is free software; you can redistribute it and/or 7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 if (unary == 0) { 326 if (unary == 0) {
327 depth = 0; 327 depth = 0;
328 k = rice->k0; 328 k = rice->k0;
329 } else { 329 } else {
330 depth = 1; 330 depth = 1;
331 k = rice->k1; 331 k = rice->k1;
332 unary--; 332 unary--;
333 } 333 }
334 334
335 if (k) 335 if (get_bits_left(&s->gb) < k)
336 return -1;
337
338 if (k) {
339 if (k > MIN_CACHE_BITS)
340 return -1;
336 value = (unary << k) + get_bits(&s->gb, k); 341 value = (unary << k) + get_bits(&s->gb, k);
337 else 342 } else
338 value = unary; 343 value = unary;
339 344
340 // FIXME: copy paste from original 345 // FIXME: copy paste from original
341 switch (depth) { 346 switch (depth) {
342 case 1: 347 case 1:
343 rice->sum1 += value - (rice->sum1 >> 4); 348 rice->sum1 += value - (rice->sum1 >> 4);
344 if (rice->k1 > 0 && rice->sum1 < shift_16[rice->k1]) 349 if (rice->k1 > 0 && rice->sum1 < shift_16[rice->k1])
345 rice->k1--; 350 rice->k1--;
346 else if(rice->sum1 > shift_16[rice->k1 + 1]) 351 else if(rice->sum1 > shift_16[rice->k1 + 1])
347 rice->k1++; 352 rice->k1++;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // decorrelate in case of stereo integer 402 // decorrelate in case of stereo integer
398 if (!s->is_float && (s->channels > 1)) { 403 if (!s->is_float && (s->channels > 1)) {
399 int32_t *r = p - 1; 404 int32_t *r = p - 1;
400 for (*p += *r / 2; r > p - s->channels; r--) 405 for (*p += *r / 2; r > p - s->channels; r--)
401 *r = *(r + 1) - *r; 406 *r = *(r + 1) - *r;
402 } 407 }
403 cur_chan = 0; 408 cur_chan = 0;
404 } 409 }
405 } 410 }
406 411
412 if (get_bits_left(&s->gb) < 32)
413 return -1;
407 skip_bits(&s->gb, 32); // frame crc 414 skip_bits(&s->gb, 32); // frame crc
408 415
409 // convert to output buffer 416 // convert to output buffer
410 switch(s->bps) { 417 switch(s->bps) {
411 case 2: { 418 case 2: {
412 uint16_t *samples = data; 419 uint16_t *samples = data;
413 for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s- >channels); p++) { 420 for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s- >channels); p++) {
414 // *samples++ = (unsigned char)*p; 421 // *samples++ = (unsigned char)*p;
415 // *samples++ = (unsigned char)(*p >> 8); 422 // *samples++ = (unsigned char)(*p >> 8);
416 *samples++ = *p; 423 *samples++ = *p;
(...skipping 23 matching lines...) Expand all
440 "tta", 447 "tta",
441 CODEC_TYPE_AUDIO, 448 CODEC_TYPE_AUDIO,
442 CODEC_ID_TTA, 449 CODEC_ID_TTA,
443 sizeof(TTAContext), 450 sizeof(TTAContext),
444 tta_decode_init, 451 tta_decode_init,
445 NULL, 452 NULL,
446 tta_decode_close, 453 tta_decode_close,
447 tta_decode_frame, 454 tta_decode_frame,
448 .long_name = NULL_IF_CONFIG_SMALL("True Audio (TTA)"), 455 .long_name = NULL_IF_CONFIG_SMALL("True Audio (TTA)"),
449 }; 456 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698