]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/wmaenc.c
configure: Print list of enabled programs
[ffmpeg] / libavcodec / wmaenc.c
index e801663d66b1ff6dccf2a012b098237dfc73b9bf..800c000bfe8d579539d8dd49f1c9681a83a22be8 100644 (file)
@@ -57,16 +57,20 @@ static av_cold int encode_init(AVCodecContext *avctx)
         return AVERROR(EINVAL);
     }
 
-    /* extract flag infos */
+    /* extract flag info */
     flags1 = 0;
     flags2 = 1;
     if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
         extradata             = av_malloc(4);
+        if (!extradata)
+            return AVERROR(ENOMEM);
         avctx->extradata_size = 4;
         AV_WL16(extradata, flags1);
         AV_WL16(extradata + 2, flags2);
     } else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
         extradata             = av_mallocz(10);
+        if (!extradata)
+            return AVERROR(ENOMEM);
         avctx->extradata_size = 10;
         AV_WL32(extradata, flags1);
         AV_WL16(extradata + 4, flags2);
@@ -382,7 +386,6 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
         return ret;
     }
 
-#if 1
     total_gain = 128;
     for (i = 64; i; i >>= 1) {
         int error = encode_frame(s, s->coefs, avpkt->data, avpkt->size,
@@ -390,22 +393,6 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
         if (error < 0)
             total_gain -= i;
     }
-#else
-    total_gain = 90;
-    best = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain);
-    for (i = 32; i; i >>= 1) {
-        int scoreL = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain - i);
-        int scoreR = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain + i);
-        av_log(NULL, AV_LOG_ERROR, "%d %d %d (%d)\n", scoreL, best, scoreR, total_gain);
-        if (scoreL < FFMIN(best, scoreR)) {
-            best        = scoreL;
-            total_gain -= i;
-        } else if (scoreR < best) {
-            best        = scoreR;
-            total_gain += i;
-        }
-    }
-#endif /* 1 */
 
     if ((i = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain)) >= 0) {
         av_log(avctx, AV_LOG_ERROR, "required frame size too large. please "