summaryrefslogtreecommitdiff
path: root/apps/codecs/libcook/cook.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libcook/cook.c')
-rw-r--r--apps/codecs/libcook/cook.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/apps/codecs/libcook/cook.c b/apps/codecs/libcook/cook.c
index ba5fbab6a1..315fe0aaff 100644
--- a/apps/codecs/libcook/cook.c
+++ b/apps/codecs/libcook/cook.c
@@ -708,16 +708,27 @@ static void dump_cook_context(COOKContext *q)
708 * Cook initialization 708 * Cook initialization
709 */ 709 */
710 710
711int cook_decode_init(RMContext *rmctx, COOKContext *q) 711static inline uint16_t get_uint16be(uint8_t *buf)
712{ 712{
713 return (uint16_t)((buf[0] << 8)|buf[1]);
714}
715
716static inline uint32_t get_uint32be(uint8_t *buf)
717{
718 return (uint32_t)((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]);
719}
720
721 int cook_decode_init(RMContext *rmctx, COOKContext *q)
722 {
723
713 /* cook extradata */ 724 /* cook extradata */
714 q->cookversion = rmctx->cook_version; 725 q->cookversion = get_uint32be(rmctx->codec_extradata);
715 q->samples_per_frame = rmctx->samples_pf_pc; 726 q->samples_per_frame = get_uint16be(&rmctx->codec_extradata[4]);
716 q->subbands = rmctx->nb_subbands; 727 q->subbands = get_uint16be(&rmctx->codec_extradata[6]);
717 q->extradata_size = rmctx->extradata_size; 728 q->extradata_size = rmctx->extradata_size;
718 if (q->extradata_size >= 16){ 729 if (q->extradata_size >= 16){
719 q->js_subband_start = rmctx->js_subband_start; 730 q->js_subband_start = get_uint16be(&rmctx->codec_extradata[12]);
720 q->js_vlc_bits = rmctx->js_vlc_bits; 731 q->js_vlc_bits = get_uint16be(&rmctx->codec_extradata[14]);
721 } 732 }
722 733
723 /* Take data from the RMContext (RM container). */ 734 /* Take data from the RMContext (RM container). */