]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/flacenc.c
10l: Rename missed occurrences of CONFIG_EBX_AVAILABLE to HAVE_EBX_AVAILABLE.
[ffmpeg] / libavcodec / flacenc.c
index 983ac06786de833bb0c29c6ede081cd870d79af9..9dd6c7eb87b8b004cb098d3312d15cc38233a05a 100644 (file)
@@ -244,7 +244,7 @@ static int flac_encode_init(AVCodecContext *avctx)
 
     /* set compression option overrides from AVCodecContext */
     if(avctx->use_lpc >= 0) {
-        s->options.use_lpc = clip(avctx->use_lpc, 0, 11);
+        s->options.use_lpc = av_clip(avctx->use_lpc, 0, 11);
     }
     if(s->options.use_lpc == 1)
         av_log(avctx, AV_LOG_DEBUG, " use lpc: Levinson-Durbin recursion with Welch window\n");
@@ -712,7 +712,7 @@ static void quantize_lpc_coefs(double *lpc_in, int order, int precision,
     error=0;
     for(i=0; i<order; i++) {
         error += lpc_in[i] * (1 << sh);
-        lpc_out[i] = clip(lrintf(error), -qmax, qmax);
+        lpc_out[i] = av_clip(lrintf(error), -qmax, qmax);
         error -= lpc_out[i];
     }
     *shift = sh;
@@ -1032,10 +1032,10 @@ static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
     for(i=2; i<n; i++) {
         lt = left_ch[i] - 2*left_ch[i-1] + left_ch[i-2];
         rt = right_ch[i] - 2*right_ch[i-1] + right_ch[i-2];
-        sum[2] += ABS((lt + rt) >> 1);
-        sum[3] += ABS(lt - rt);
-        sum[0] += ABS(lt);
-        sum[1] += ABS(rt);
+        sum[2] += FFABS((lt + rt) >> 1);
+        sum[3] += FFABS(lt - rt);
+        sum[0] += FFABS(lt);
+        sum[1] += FFABS(rt);
     }
     /* estimate bit counts */
     for(i=0; i<4; i++) {
@@ -1122,20 +1122,8 @@ static void put_sbits(PutBitContext *pb, int bits, int32_t val)
 
 static void write_utf8(PutBitContext *pb, uint32_t val)
 {
-    int bytes, shift;
-
-    if(val < 0x80){
-        put_bits(pb, 8, val);
-        return;
-    }
-
-    bytes= (av_log2(val)+4) / 5;
-    shift = (bytes - 1) * 6;
-    put_bits(pb, 8, (256 - (256>>bytes)) | (val >> shift));
-    while(shift >= 6){
-        shift -= 6;
-        put_bits(pb, 8, 0x80 | ((val >> shift) & 0x3F));
-    }
+    uint8_t tmp;
+    PUT_UTF8(val, tmp, put_bits(pb, 8, tmp);)
 }
 
 static void output_frame_header(FlacEncodeContext *s)