[FFmpeg-devel] [PATCH] Update lix264.c for x264 API change (X264_BUILD 79)

Matthieu mcrapet
Fri Nov 20 11:49:42 CET 2009


Grettings,

A new parameter "weightp" (int i_weighted_pred) has been added.
http://git.videolan.org/?p=x264.git;a=commit;h=87de2346225721e8ca68a1b59bc87133fc598a42

Default value is X264_WEIGHTP_SMART (2), so Baseline profile will be never
selected.

--- a/encoder/set.c+++ b/encoder/set.c
@@  -80,7 +80,7 @@ void x264_sps_init( x264_sps_t *sps, int i_id,
x264_param_t *param )
       sps->i_profile_idc  = PROFILE_HIGH444_PREDICTIVE;
     else if( param->analyse.b_transform_8x8 || param->i_cqm_preset !=
X264_CQM_FLAT )
       sps->i_profile_idc  = PROFILE_HIGH;
-    else if( param->b_cabac || param->i_bframe > 0 || param->b_interlaced )
+    else if( param->b_cabac || param->i_bframe > 0 || param->b_interlaced
|| param->analyse.i_weighted_pred > 0 )
       sps->i_profile_idc  = PROFILE_MAIN;
     else         sps->i_profile_idc  = PROFILE_BASELINE;

This patch does not expose the libx264 option to ffmpeg, but just detect
baseline profile requirement
and set weightp to X264_WEIGHTP_NONE.

Matthieu Crapet

---

--- configure.orig 2009-11-20 11:40:32.003283500 +0100
+++ configure 2009-11-20 11:41:06.199257500 +0100
@@ -2378,8 +2378,8 @@ enabled libspeex   && require  libspeex
 enabled libtheora  && require  libtheora theora/theora.h theora_info_init
-ltheora -logg
 enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h
vorbis_info_init -lvorbisenc -lvorbis -logg
 enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264
-lm &&
-                      { check_cpp_condition x264.h "X264_BUILD >= 78" ||
-                        die "ERROR: libx264 version must be >= 0.78."; }
+                      { check_cpp_condition x264.h "X264_BUILD >= 79" ||
+                        die "ERROR: libx264 version must be >= 0.79."; }
 enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
 enabled mlib       && require  mediaLib mlib_types.h
mlib_VectorSub_S16_U8_Mod -lmlib

--- libavcodec/libx264.orig.c 2009-11-20 10:47:31.312986200 +0100
+++ libavcodec/libx264.c 2009-11-20 11:25:02.566790500 +0100
@@ -227,6 +227,9 @@ static av_cold int X264_init(AVCodecCont

     x4->params.analyse.i_direct_mv_pred  = avctx->directpred;

+    if (x4->params.i_bframe == 0 && x4->params.b_cabac == 0)
+        x4->params.analyse.i_weighted_pred = X264_WEIGHTP_NONE;
+
     x4->params.analyse.b_weighted_bipred = avctx->flags2 &
CODEC_FLAG2_WPRED;

     if (avctx->me_method == ME_EPZS)



More information about the ffmpeg-devel mailing list