]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/wavpack.c
add AltiVec implementation of weight_h264_pixels(16|8)x(16|8|4)
[ffmpeg] / libavcodec / wavpack.c
index f6764b26572ad40083f109b10fa944f520f8d47e..b89723e2f23dc32403a49d8ef2b9536c81893471 100644 (file)
@@ -161,7 +161,7 @@ static int wv_get_value(WavpackContext *ctx, GetBitContext *gb, int *median, int
             if(ctx->zeroes)
                 return 0;
         }else{
-            t = get_unary(gb, 0, 33);
+            t = get_unary_0_33(gb);
             if(t >= 2) t = get_bits(gb, t - 1) | (1 << (t-1));
             ctx->zeroes = t;
             if(ctx->zeroes){
@@ -180,13 +180,13 @@ static int wv_get_value(WavpackContext *ctx, GetBitContext *gb, int *median, int
         t = 0;
         ctx->zero = 0;
     }else{
-        t = get_unary(gb, 0, 33);
+        t = get_unary_0_33(gb);
         if(get_bits_count(gb) >= ctx->data_size){
             *last = 1;
             return 0;
         }
         if(t == 16) {
-            t2 = get_unary(gb, 0, 33);
+            t2 = get_unary_0_33(gb);
             if(t2 < 2) t += t2;
             else t += get_bits(gb, t2 - 1) | (1 << (t2 - 1));
         }
@@ -354,32 +354,27 @@ static int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, int16_t *dst)
     return count;
 }
 
-static int wavpack_decode_init(AVCodecContext *avctx)
+static av_cold int wavpack_decode_init(AVCodecContext *avctx)
 {
     WavpackContext *s = avctx->priv_data;
 
     s->avctx = avctx;
     s->stereo = (avctx->channels == 2);
-
-    return 0;
-}
-
-static int wavpack_decode_close(AVCodecContext *avctx)
-{
-//    WavpackContext *s = avctx->priv_data;
+    avctx->sample_fmt = SAMPLE_FMT_S16;
+    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
 
     return 0;
 }
 
 static int wavpack_decode_frame(AVCodecContext *avctx,
                             void *data, int *data_size,
-                            uint8_t *buf, int buf_size)
+                            const uint8_t *buf, int buf_size)
 {
     WavpackContext *s = avctx->priv_data;
     int16_t *samples = data;
     int samplecount;
     int got_terms = 0, got_weights = 0, got_samples = 0, got_entropy = 0, got_bs = 0;
-    uint8_t* buf_end = buf + buf_size;
+    const uint8_t* buf_end = buf + buf_size;
     int i, j, id, size, ssize, weights, t;
 
     if (buf_size == 0){
@@ -587,6 +582,7 @@ AVCodec wavpack_decoder = {
     sizeof(WavpackContext),
     wavpack_decode_init,
     NULL,
-    wavpack_decode_close,
+    NULL,
     wavpack_decode_frame,
+    .long_name = NULL_IF_CONFIG_SMALL("WavPack"),
 };