"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libavcodec/cook.c" between
libav-11.7.tar.gz and libav-11.8.tar.gz

About: libav provides cross-platform tools ("avconv") and libraries to convert, manipulate and stream a wide range of multimedia (audio and video) formats and protocols.

cook.c  (libav-11.7):cook.c  (libav-11.8)
skipping to change at line 1035 skipping to change at line 1035
#endif #endif
/** /**
* Cook initialization * Cook initialization
* *
* @param avctx pointer to the AVCodecContext * @param avctx pointer to the AVCodecContext
*/ */
static av_cold int cook_decode_init(AVCodecContext *avctx) static av_cold int cook_decode_init(AVCodecContext *avctx)
{ {
COOKContext *q = avctx->priv_data; COOKContext *q = avctx->priv_data;
const uint8_t *edata_ptr = avctx->extradata; GetByteContext gb;
const uint8_t *edata_ptr_end = edata_ptr + avctx->extradata_size;
int extradata_size = avctx->extradata_size;
int s = 0; int s = 0;
unsigned int channel_mask = 0; unsigned int channel_mask = 0;
int samples_per_frame; int samples_per_frame;
int ret; int ret;
q->avctx = avctx; q->avctx = avctx;
/* Take care of the codec specific extradata. */ /* Take care of the codec specific extradata. */
if (extradata_size < 8) { if (avctx->extradata_size < 8) {
av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n"); av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->extradata_size); av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->extradata_size);
bytestream2_init(&gb, avctx->extradata, avctx->extradata_size);
/* Take data from the AVCodecContext (RM container). */ /* Take data from the AVCodecContext (RM container). */
if (!avctx->channels) { if (!avctx->channels) {
av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
/* Initialize RNG. */ /* Initialize RNG. */
av_lfg_init(&q->random_state, 0); av_lfg_init(&q->random_state, 0);
ff_audiodsp_init(&q->adsp); ff_audiodsp_init(&q->adsp);
while (edata_ptr < edata_ptr_end) { while (bytestream2_get_bytes_left(&gb)) {
/* 8 for mono, 16 for stereo, ? for multichannel /* 8 for mono, 16 for stereo, ? for multichannel
Swap to right endianness so we don't need to care later on. */ Swap to right endianness so we don't need to care later on. */
if (extradata_size >= 8) { q->subpacket[s].cookversion = bytestream2_get_be32(&gb);
q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr); samples_per_frame = bytestream2_get_be16(&gb);
samples_per_frame = bytestream_get_be16(&edata_ptr); q->subpacket[s].subbands = bytestream2_get_be16(&gb);
q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr); bytestream2_get_be32(&gb); // Unknown unused
extradata_size -= 8; q->subpacket[s].js_subband_start = bytestream2_get_be16(&gb);
} q->subpacket[s].js_vlc_bits = bytestream2_get_be16(&gb);
if (extradata_size >= 8) {
bytestream_get_be32(&edata_ptr); // Unknown unused
q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr);
q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr);
extradata_size -= 8;
}
/* Initialize extradata related variables. */ /* Initialize extradata related variables. */
q->subpacket[s].samples_per_channel = samples_per_frame / avctx->channel s; q->subpacket[s].samples_per_channel = samples_per_frame / avctx->channel s;
q->subpacket[s].bits_per_subpacket = avctx->block_align * 8; q->subpacket[s].bits_per_subpacket = avctx->block_align * 8;
/* Initialize default data states. */ /* Initialize default data states. */
q->subpacket[s].log2_numvector_size = 5; q->subpacket[s].log2_numvector_size = 5;
q->subpacket[s].total_subbands = q->subpacket[s].subbands; q->subpacket[s].total_subbands = q->subpacket[s].subbands;
q->subpacket[s].num_channels = 1; q->subpacket[s].num_channels = 1;
skipping to change at line 1128 skipping to change at line 1122
} }
if (q->subpacket[s].samples_per_channel > 256) { if (q->subpacket[s].samples_per_channel > 256) {
q->subpacket[s].log2_numvector_size = 6; q->subpacket[s].log2_numvector_size = 6;
} }
if (q->subpacket[s].samples_per_channel > 512) { if (q->subpacket[s].samples_per_channel > 512) {
q->subpacket[s].log2_numvector_size = 7; q->subpacket[s].log2_numvector_size = 7;
} }
break; break;
case MC_COOK: case MC_COOK:
av_log(avctx, AV_LOG_DEBUG, "MULTI_CHANNEL\n"); av_log(avctx, AV_LOG_DEBUG, "MULTI_CHANNEL\n");
if (extradata_size >= 4) channel_mask |= q->subpacket[s].channel_mask = bytestream2_get_be32(
channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be &gb);
32(&edata_ptr);
if (av_get_channel_layout_nb_channels(q->subpacket[s].channel_mask) > 1) { if (av_get_channel_layout_nb_channels(q->subpacket[s].channel_mask) > 1) {
q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].total_subbands = q->subpacket[s].subbands +
q->subpacket[s].js_subband_star t; q->subpacket[s].js_subband_star t;
q->subpacket[s].joint_stereo = 1; q->subpacket[s].joint_stereo = 1;
q->subpacket[s].num_channels = 2; q->subpacket[s].num_channels = 2;
q->subpacket[s].samples_per_channel = samples_per_frame >> 1; q->subpacket[s].samples_per_channel = samples_per_frame >> 1;
if (q->subpacket[s].samples_per_channel > 256) { if (q->subpacket[s].samples_per_channel > 256) {
q->subpacket[s].log2_numvector_size = 6; q->subpacket[s].log2_numvector_size = 6;
 End of changes. 6 change blocks. 
20 lines changed or deleted 13 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS