changeset 13386:d8ba5b72fc6c

New lavc flag: "turbo" mode which is supposed to speed up 2-pass encoding while preserving quality as much as possible. Inspired by XviD "turbo" mode.
author gpoirier
date Sun, 19 Sep 2004 09:59:05 +0000
parents e488b3c628db
children d1abaa60967a
files DOCS/man/en/mplayer.1 DOCS/man/fr/mplayer.1 libmpcodecs/ve_lavc.c
diffstat 3 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Sat Sep 18 23:20:09 2004 +0000
+++ b/DOCS/man/en/mplayer.1	Sun Sep 19 09:59:05 2004 +0000
@@ -5327,6 +5327,13 @@
 .PD 1
 .
 .TP
+.B turbo (2-pass only)
+Dramatically speeds up pass 1 using faster algorithms and disabling
+CPU-intensive options.
+This will probably reduce global PSNR a little bit (around 0.01dB) and
+change individual frame type and PSNR little bit more (up to 0.03dB).
+.
+.TP
 .B aspect=<x/\:y>
 Store movie aspect internally, just like MPEG files.
 Much nicer solution than rescaling, because quality isn't decreased.
--- a/DOCS/man/fr/mplayer.1	Sat Sep 18 23:20:09 2004 +0000
+++ b/DOCS/man/fr/mplayer.1	Sun Sep 19 09:59:05 2004 +0000
@@ -1,4 +1,4 @@
-.\" synced with 1.722
+.\" synced with 1.723
 .\" MPlayer (C) 2000-2004 MPlayer Team
 .\" This man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann
 .\" Traduction: Nicolas Le Gaillart < nicolas AT legaillart.com >
@@ -5568,6 +5568,13 @@
 .PD 1
 .
 .TP
+.B turbo (2-pass uniquement)
+Accélère énormément la première passe en utilisant des algorithmes plus
+rapides et en désactivant des options gourmandes en temps processeur.
+Cela va sans doute diminuer le PSNR global (d'environ 0.01dB) et changer
+un peu plus le type et le PSNR des trames générées (jusqu'à 0.03dB).
+.
+.TP
 .B aspect=<x/\:y>
 Stocke le rapport hauteur/\:largeur du film en interne, tout comme les fichiers
 MPEG.
--- a/libmpcodecs/ve_lavc.c	Sat Sep 18 23:20:09 2004 +0000
+++ b/libmpcodecs/ve_lavc.c	Sun Sep 19 09:59:05 2004 +0000
@@ -153,6 +153,7 @@
 static int lavc_param_closed_gop = 0;
 static int lavc_param_dc_precision = 8;
 static int lavc_param_threads= 1;
+static int lavc_param_turbo = 0;
 
 
 char *lavc_param_acodec = "mp2";
@@ -302,6 +303,7 @@
         {"qns", &lavc_param_qns, CONF_TYPE_INT, CONF_RANGE, 0, 1000000, NULL},
         {"nssew", &lavc_param_nssew, CONF_TYPE_INT, CONF_RANGE, 0, 1000000, NULL},
 	{"threads", &lavc_param_threads, CONF_TYPE_INT, CONF_RANGE, 1, 8, NULL},
+	{"turbo", &lavc_param_turbo, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 #endif
@@ -666,6 +668,30 @@
 	    mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile);
             return 0;
 	}
+	if(lavc_param_turbo) {
+	  /* uses SAD comparison functions instead of other hungrier */
+	  lavc_venc_context->me_pre_cmp = 0;
+	  lavc_venc_context->me_cmp = 0;
+	  lavc_venc_context->me_sub_cmp = 0;
+	  lavc_venc_context->mb_cmp = 2;
+
+	  /* Disables diamond motion estimation */
+	  lavc_venc_context->pre_dia_size = 0;
+	  lavc_venc_context->dia_size = 0;
+
+	  lavc_venc_context->quantizer_noise_shaping = 0; // qns=0
+	  lavc_venc_context->noise_reduction = 0; // nr=0
+
+	  if (lavc_param_mb_decision) {
+	    lavc_venc_context->mb_decision = 1; // mbd=0 ("realtime" encoding)
+	  }
+	  lavc_venc_context->flags &= ~CODEC_FLAG_QPEL;
+	  lavc_venc_context->flags &= ~CODEC_FLAG_4MV;
+	  lavc_venc_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
+	  lavc_venc_context->flags &= ~CODEC_FLAG_CBP_RD;
+	  lavc_venc_context->flags &= ~CODEC_FLAG_QP_RD;
+	  lavc_venc_context->flags &= ~CODEC_FLAG_MV0;
+	}
 	break;
     }
     }