@@ -0,0 +1,1009 @@
+--- vlc-0.8.6i/modules/codec/x264.c 2008-07-08 22:59:23.000000000 +0200
++++ vlc-0.9.8a/modules/codec/x264.c 2008-10-15 21:31:20.000000000 +0200
+@@ -2,7 +2,7 @@
+ * x264.c: h264 video encoder
+ *****************************************************************************
+ * Copyright (C) 2004-2006 the VideoLAN team
+- * $Id: 4785cbb09dace1146140af028c0cf11becd1d200 $
++ * $Id: d48bb0d6159d40eb629458c9307cd14e09879eec $
+ *
+ * Authors: Laurent Aimar <fenrir@via.ecp.fr>
+ *
+@@ -24,11 +24,19 @@
+ /*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+-#include <vlc/vlc.h>
+-#include <vlc/vout.h>
+-#include <vlc/sout.h>
+-#include <vlc/decoder.h>
++#ifdef HAVE_CONFIG_H
++# include "config.h"
++#endif
++
++#include <vlc_common.h>
++#include <vlc_plugin.h>
++#include <vlc_vout.h>
++#include <vlc_sout.h>
++#include <vlc_codec.h>
+
++#ifdef PTW32_STATIC_LIB
++#include <pthread.h>
++#endif
+ #include <x264.h>
+
+ #define SOUT_CFG_PREFIX "sout-x264-"
+@@ -67,6 +75,12 @@
+ "I-frames are inserted only every other keyint frames, which probably " \
+ "leads to ugly encoding artifacts. Range 1 to 100." )
+
++#if X264_BUILD >= 55 /* r607 */
++#define PRESCENE_TEXT N_("Faster, less precise scenecut detection" )
++#define PRESCENE_LONGTEXT N_( "Faster, less precise scenecut detection. " \
++ "Required and implied by multi-threading." )
++#endif
++
+ #define BFRAMES_TEXT N_("B-frames between I and P")
+ #define BFRAMES_LONGTEXT N_( "Number of consecutive B-frames between I and " \
+ "P-frames. Range 1 to 16." )
+@@ -102,7 +116,7 @@
+ #define FILTER_LONGTEXT N_( "Loop filter AlphaC0 and Beta parameters. " \
+ "Range -6 to 6 for both alpha and beta parameters. -6 means light " \
+ "filter, 6 means strong.")
+-
++
+ #define LEVEL_TEXT N_("H.264 level")
+ #define LEVEL_LONGTEXT N_( "Specify H.264 level (as defined by Annex A " \
+ "of the standard). Levels are not enforced; it's up to the user to select " \
+@@ -152,6 +166,20 @@
+ #define VBV_INIT_LONGTEXT N_( "Sets the initial buffer occupancy as a " \
+ "fraction of the buffer size. Range 0.0 to 1.0.")
+
++#if X264_BUILD >= 59
++#define AQ_MODE_TEXT N_("How AQ distributes bits")
++#define AQ_MODE_LONGTEXT N_("Defines bitdistribution mode for AQ, default 2\n" \
++ " - 0: Disabled\n"\
++ " - 1: Avoid moving bits between frames\n"\
++ " - 2: Move bits between frames")
++
++#define AQ_STRENGTH_TEXT N_("Strength of AQ")
++#define AQ_STRENGTH_LONGTEXT N_("Strength to reduce blocking and blurring in flat\n"\
++ "and textured areas, default 1.0 recommented to be between 0..2\n"\
++ " - 0.5: weak AQ\n"\
++ " - 1.5: strong AQ")
++#endif
++
+ /* IP Ratio < 1 is technically valid but should never improve quality */
+ #define IPRATIO_TEXT N_("QP factor between I and P")
+ #define IPRATIO_LONGTEXT N_( "QP factor between I and P. Range 1.0 to 2.0.")
+@@ -163,6 +191,12 @@
+ #define CHROMA_QP_OFFSET_TEXT N_("QP difference between chroma and luma")
+ #define CHROMA_QP_OFFSET_LONGTEXT N_( "QP difference between chroma and luma.")
+
++#define PASS_TEXT N_("Multipass ratecontrol")
++#define PASS_LONGTEXT N_( "Multipass ratecontrol:\n" \
++ " - 1: First pass, creates stats file\n" \
++ " - 2: Last pass, does not overwrite stats file\n" \
++ " - 3: Nth pass, overwrites stats file\n" )
++
+ #define QCOMP_TEXT N_("QP curve compression")
+ #define QCOMP_LONGTEXT N_( "QP curve compression. Range 0.0 (CBR) to 1.0 (QCP).")
+
+@@ -200,21 +234,47 @@
+ #define WEIGHTB_LONGTEXT N_( "Weighted prediction for B-frames.")
+
+ #define ME_TEXT N_("Integer pixel motion estimation method")
++#if X264_BUILD >= 58 /* r728 */
++#define ME_LONGTEXT N_( "Selects the motion estimation algorithm: "\
++ " - dia: diamond search, radius 1 (fast)\n" \
++ " - hex: hexagonal search, radius 2\n" \
++ " - umh: uneven multi-hexagon search (better but slower)\n" \
++ " - esa: exhaustive search (extremely slow, primarily for testing)\n" \
++ " - tesa: hadamard exhaustive search (extremely slow, primarily for testing)\n" )
++#else
+ #define ME_LONGTEXT N_( "Selects the motion estimation algorithm: "\
+ " - dia: diamond search, radius 1 (fast)\n" \
+ " - hex: hexagonal search, radius 2\n" \
+ " - umh: uneven multi-hexagon search (better but slower)\n" \
+ " - esa: exhaustive search (extremely slow, primarily for testing)\n" )
++#endif
+
++#if X264_BUILD >= 24
+ #define MERANGE_TEXT N_("Maximum motion vector search range")
+ #define MERANGE_LONGTEXT N_( "Maximum distance to search for " \
+ "motion estimation, measured from predicted position(s). " \
+ "Default of 16 is good for most footage, high motion sequences may " \
+ "benefit from settings between 24 and 32. Range 0 to 64." )
+
++#define MVRANGE_TEXT N_("Maximum motion vector length")
++#define MVRANGE_LONGTEXT N_( "Maximum motion vector length in pixels. " \
++ "-1 is automatic, based on level." )
++#endif
++
++#if X264_BUILD >= 55 /* r607 */
++#define MVRANGE_THREAD_TEXT N_("Minimum buffer space between threads")
++#define MVRANGE_THREAD_LONGTEXT N_( "Minimum buffer space between threads. " \
++ "-1 is automatic, based on number of threads." )
++#endif
++
+ #define SUBME_TEXT N_("Subpixel motion estimation and partition decision " \
+ "quality")
+-#if X264_BUILD >= 46 /* r477 */
++#if X264_BUILD >= 65
++#define SUBME_MAX 9
++#define SUBME_LONGTEXT N_( "This parameter controls quality versus speed " \
++ "tradeoffs involved in the motion estimation decision process " \
++ "(lower = quicker and higher = better quality). Range 1 to 9." )
++#elif X264_BUILD >= 46 /* r477 */
+ #define SUBME_MAX 7
+ #define SUBME_LONGTEXT N_( "This parameter controls quality versus speed " \
+ "tradeoffs involved in the motion estimation decision process " \
+@@ -282,9 +342,18 @@
+
+ /* Input/Output */
+
++#if X264_BUILD >= 55 /* r607 */
++#define NON_DETERMINISTIC_TEXT N_("Non-deterministic optimizations when threaded")
++#define NON_DETERMINISTIC_LONGTEXT N_( "Slightly improve quality of SMP, " \
++ "at the cost of repeatability.")
++#endif
++
+ #define ASM_TEXT N_("CPU optimizations")
+ #define ASM_LONGTEXT N_( "Use assembler CPU optimizations.")
+
++#define STATS_TEXT N_("Filename for 2 pass stats file")
++#define STATS_LONGTEXT N_( "Filename for 2 pass stats file for multi-pass encoding.")
++
+ #define PSNR_TEXT N_("PSNR computation")
+ #define PSNR_LONGTEXT N_( "Compute and print PSNR stats. This has no effect on " \
+ "the actual encoding quality." )
+@@ -308,32 +377,39 @@
+ #define AUD_TEXT N_("Access unit delimiters")
+ #define AUD_LONGTEXT N_( "Generate access unit delimiter NAL units.")
+
+-#if X264_BUILD >= 24
+-static char *enc_me_list[] =
++#if X264_BUILD >= 24 && X264_BUILD < 58
++static const char *const enc_me_list[] =
+ { "dia", "hex", "umh", "esa" };
+-static char *enc_me_list_text[] =
++static const char *const enc_me_list_text[] =
+ { N_("dia"), N_("hex"), N_("umh"), N_("esa") };
+ #endif
+
+-static char *enc_analyse_list[] =
++#if X264_BUILD >= 58 /* r728 */
++static const char *const enc_me_list[] =
++ { "dia", "hex", "umh", "esa", "tesa" };
++static const char *const enc_me_list_text[] =
++ { N_("dia"), N_("hex"), N_("umh"), N_("esa"), N_("tesa") };
++#endif
++
++static const char *const enc_analyse_list[] =
+ { "none", "fast", "normal", "slow", "all" };
+-static char *enc_analyse_list_text[] =
++static const char *const enc_analyse_list_text[] =
+ { N_("none"), N_("fast"), N_("normal"), N_("slow"), N_("all") };
+
+ #if X264_BUILD >= 45 /* r457 */
+-static char *direct_pred_list[] =
++static const char *const direct_pred_list[] =
+ { "none", "spatial", "temporal", "auto" };
+-static char *direct_pred_list_text[] =
++static const char *const direct_pred_list_text[] =
+ { N_("none"), N_("spatial"), N_("temporal"), N_("auto") };
+ #else
+-static char *direct_pred_list[] =
++static const char *const direct_pred_list[] =
+ { "none", "spatial", "temporal" };
+-static char *direct_pred_list_text[] =
|