diff dnxhdenc.c @ 6041:bb4b486c6775 libavcodec

add bitrate helper to choose all dnxhd variants
author bcoudurier
date Tue, 18 Dec 2007 13:52:07 +0000
parents f855600f6f0f
children dfdff1ca78a7
line wrap: on
line diff
--- a/dnxhdenc.c	Tue Dec 18 13:49:58 2007 +0000
+++ b/dnxhdenc.c	Tue Dec 18 13:52:07 2007 +0000
@@ -171,31 +171,12 @@
     DNXHDEncContext *ctx = avctx->priv_data;
     int i, index;
 
-    if (avctx->width == 1920 && avctx->height == 1080) {
-        if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) {
-            if      (avctx->bit_rate == 120000000)
-                ctx->cid = 1242;
-            else if (avctx->bit_rate == 185000000)
-                ctx->cid = 1243;
-        } else {
-            if      (avctx->bit_rate == 120000000)
-                ctx->cid = 1237;
-            else if (avctx->bit_rate == 185000000)
-                ctx->cid = 1238;
-            else if (avctx->bit_rate ==  36000000)
-                ctx->cid = 1253;
-        }
-    } else if (avctx->width == 1280 && avctx->height == 720 &&
-               !(avctx->flags & CODEC_FLAG_INTERLACED_DCT)) {
-            if      (avctx->bit_rate ==  90000000)
-                ctx->cid = 1251;
-            else if (avctx->bit_rate ==  60000000)
-                ctx->cid = 1252;
-    }
+    ctx->cid = ff_dnxhd_find_cid(avctx);
     if (!ctx->cid || avctx->pix_fmt != PIX_FMT_YUV422P) {
         av_log(avctx, AV_LOG_ERROR, "video parameters incompatible with DNxHD\n");
         return -1;
     }
+    av_log(avctx, AV_LOG_DEBUG, "cid %d\n", ctx->cid);
 
     index = ff_dnxhd_get_cid_table(ctx->cid);
     ctx->cid_table = &ff_dnxhd_cid_table[index];