diff dnxhdenc.c @ 5971:405be936dac4 libavcodec

dnxhd 720p encoding and decoding support
author bcoudurier
date Sun, 02 Dec 2007 19:27:19 +0000
parents e1ac22f75cf6
children f855600f6f0f
line wrap: on
line diff
--- a/dnxhdenc.c	Sun Dec 02 19:22:38 2007 +0000
+++ b/dnxhdenc.c	Sun Dec 02 19:27:19 2007 +0000
@@ -171,6 +171,7 @@
     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;
@@ -184,7 +185,14 @@
         else if (avctx->bit_rate ==  36000000)
             ctx->cid = 1253;
     }
-    if (!ctx->cid || avctx->width != 1920 || avctx->height != 1080 || avctx->pix_fmt != PIX_FMT_YUV422P) {
+    } 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;
+    }
+    if (!ctx->cid || avctx->pix_fmt != PIX_FMT_YUV422P) {
         av_log(avctx, AV_LOG_ERROR, "video parameters incompatible with DNxHD\n");
         return -1;
     }
@@ -421,7 +429,7 @@
     dsp->get_pixels(ctx->blocks[2], ptr_u    , ctx->m.uvlinesize);
     dsp->get_pixels(ctx->blocks[3], ptr_v    , ctx->m.uvlinesize);
 
-    if (mb_y+1 == ctx->m.mb_height) {
+    if (mb_y+1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) {
         if (ctx->interlaced) {
             dnxhd_get_pixels_4x8(ctx->blocks[4], ptr_y + ctx->dct_y_offset    , ctx->m.linesize);
             dnxhd_get_pixels_4x8(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize);