annotate libmpcodecs/ve_x264.c @ 16362:b95513343d81

Support D-Cinema audio demuxer and decoder from FFmpeg.
author reimar
date Fri, 02 Sep 2005 19:22:22 +0000
parents a5d3b3b4bd4a
children e054a3c93a26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
1 /*****************************************************************************
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
2 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
3 * - H.264 encoder for mencoder using x264 -
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
4 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
5 * Copyright (C) 2004 LINUX4MEDIA GmbH
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
6 * Copyright (C) 2004 Ark Linux
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
7 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
8 * Written by Bernhard Rosenkraenzer <bero@arklinux.org>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
9 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
11 * it under the terms of the GNU General Public License version 2 as
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
12 * published by the Free Software Foundation, or if, and only if,
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
13 * version 2 is ruled invalid in a court of law, any later version
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
14 * of the GNU General Public License published by the Free Software
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
15 * Foundation.
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
16 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
19 * MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
20 * GNU General Public License for more details.
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
21 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
25 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
26 *****************************************************************************/
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
27
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
28 #include <stdio.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
29 #include <stdlib.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
30 #include <string.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
31 #include <errno.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
32
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
33 #include "../config.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
34 #include "../mp_msg.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
35
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
36 #ifdef HAVE_X264
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
37
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
38 #include "m_option.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
39 #include "codec-cfg.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
40 #include "stream.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
41 #include "demuxer.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
42 #include "stheader.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
43
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
44 #include "muxer.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
45
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
46 #include "img_format.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
47 #include "mp_image.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
48 #include "vf.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
49
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
50 #include <x264.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
51
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
52 typedef struct _h264_module_t {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
53 muxer_stream_t *mux;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
54 x264_param_t param;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
55 x264_t * x264;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
56 x264_picture_t pic;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
57 } h264_module_t;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
58
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
59 extern char* passtmpfile;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
60
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
61 static int bitrate = -1;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
62 static int qp_constant = 26;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
63 static int frame_ref = 1;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
64 static int keyint_max = 250;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
65 static int keyint_min = 25;
13584
17cb9c6a99f6 Adds a parameter 'scenecut', to control the threshold for inserting extra I-frames.
iive
parents: 13496
diff changeset
66 static int scenecut_threshold = 40;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
67 static int bframe = 0;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
68 static int bframe_adaptive = 1;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
69 static int bframe_bias = 0;
14916
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
70 static int bframe_pyramid = 0;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
71 static int deblock = 1;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
72 static int deblockalpha = 0;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
73 static int deblockbeta = 0;
13496
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
74 static int cabac = 1;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
75 static int p4x4mv = 0;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
76 static int p8x8mv = 1;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
77 static int b8x8mv = 1;
15654
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
78 static int i8x8 = 1;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
79 static int i4x4 = 1;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
80 static int dct8 = 0;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
81 static int direct_pred = X264_DIRECT_PRED_TEMPORAL;
14759
8c1d40548612 Sync to x264 r134: weighted prediction for B-frames.
lorenm
parents: 14738
diff changeset
82 static int weight_b = 0;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
83 static int chroma_me = 1;
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
84 static int chroma_qp_offset = 0;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
85 static float ip_factor = 1.4;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
86 static float pb_factor = 1.3;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
87 static float ratetol = 1.0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
88 static int vbv_maxrate = 0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
89 static int vbv_bufsize = 0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
90 static float vbv_init = 0.9;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
91 static int qp_min = 10;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
92 static int qp_max = 51;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
93 static int qp_step = 2;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
94 static int pass = 0;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
95 static float qcomp = 0.6;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
96 static float qblur = 0.5;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
97 static float complexity_blur = 20;
14719
a76f1a68ed75 sync to x264 r129: modified ratecontrol equation.
lorenm
parents: 14468
diff changeset
98 static char *rc_eq = "blurCplx^(1-qComp)";
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
99 static char *zones = NULL;
14411
fba04febec4e x264: disable subq=0 (the huge bitrate penalty wasn't worth the speed),
lorenm
parents: 14307
diff changeset
100 static int subq = 5;
15352
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
101 static int me_method = 2;
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
102 static int me_range = 16;
15590
e848b20cd449 sync to x264 r240 (threads)
lorenm
parents: 15557
diff changeset
103 static int threads = 1;
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
104 static int level_idc = 40;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
105 static int psnr = 0;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
106 static int log_level = 2;
15964
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
107 static int turbo = 0;
16016
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
108 static int visualize = 0;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
109
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
110 m_option_t x264encopts_conf[] = {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
111 {"bitrate", &bitrate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL},
15744
268cb6b8484e sync to x264 rev264 (lossless)
lorenm
parents: 15724
diff changeset
112 {"qp_constant", &qp_constant, CONF_TYPE_INT, CONF_RANGE, 0, 51, NULL},
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
113 {"frameref", &frame_ref, CONF_TYPE_INT, CONF_RANGE, 1, 16, NULL},
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
114 {"keyint", &keyint_max, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL},
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
115 {"keyint_min", &keyint_min, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL},
13584
17cb9c6a99f6 Adds a parameter 'scenecut', to control the threshold for inserting extra I-frames.
iive
parents: 13496
diff changeset
116 {"scenecut", &scenecut_threshold, CONF_TYPE_INT, CONF_RANGE, -1, 100, NULL},
13496
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
117 {"bframes", &bframe, CONF_TYPE_INT, CONF_RANGE, 0, 16, NULL},
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
118 {"b_adapt", &bframe_adaptive, CONF_TYPE_FLAG, 0, 0, 1, NULL},
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
119 {"nob_adapt", &bframe_adaptive, CONF_TYPE_FLAG, 0, 1, 0, NULL},
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
120 {"b_bias", &bframe_bias, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
14916
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
121 {"b_pyramid", &bframe_pyramid, CONF_TYPE_FLAG, 0, 0, 1, NULL},
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
122 {"nob_pyramid", &bframe_pyramid, CONF_TYPE_FLAG, 0, 1, 0, NULL},
13496
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
123 {"deblock", &deblock, CONF_TYPE_FLAG, 0, 0, 1, NULL},
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
124 {"nodeblock", &deblock, CONF_TYPE_FLAG, 0, 1, 0, NULL},
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
125 {"deblockalpha", &deblockalpha, CONF_TYPE_INT, CONF_RANGE, -6, 6, NULL},
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
126 {"deblockbeta", &deblockbeta, CONF_TYPE_INT, CONF_RANGE, -6, 6, NULL},
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
127 {"cabac", &cabac, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13496
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
128 {"nocabac", &cabac, CONF_TYPE_FLAG, 0, 1, 0, NULL},
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
129 {"4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
130 {"no4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
131 {"8x8mv", &p8x8mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
132 {"no8x8mv", &p8x8mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
133 {"b8x8mv", &b8x8mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
134 {"nob8x8mv", &b8x8mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
15654
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
135 {"i4x4", &i4x4, CONF_TYPE_FLAG, 0, 0, 1, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
136 {"noi4x4", &i4x4, CONF_TYPE_FLAG, 0, 0, 0, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
137 {"i8x8", &i8x8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
138 {"noi8x8", &i8x8, CONF_TYPE_FLAG, 0, 0, 0, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
139 {"8x8dct", &dct8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
140 {"no8x8dct", &dct8, CONF_TYPE_FLAG, 0, 0, 0, NULL},
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
141 {"direct_pred", &direct_pred, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
14759
8c1d40548612 Sync to x264 r134: weighted prediction for B-frames.
lorenm
parents: 14738
diff changeset
142 {"weight_b", &weight_b, CONF_TYPE_FLAG, 0, 0, 1, NULL},
8c1d40548612 Sync to x264 r134: weighted prediction for B-frames.
lorenm
parents: 14738
diff changeset
143 {"noweight_b", &weight_b, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
144 {"chroma_me", &chroma_me, CONF_TYPE_FLAG, 0, 0, 1, NULL},
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
145 {"nochroma_me", &chroma_me, CONF_TYPE_FLAG, 0, 1, 0, NULL},
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
146 {"chroma_qp_offset", &chroma_qp_offset, CONF_TYPE_INT, CONF_RANGE, -12, 12, NULL},
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
147 {"ip_factor", &ip_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL},
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
148 {"pb_factor", &pb_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL},
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
149 {"ratetol", &ratetol, CONF_TYPE_FLOAT, CONF_RANGE, 0.1, 100.0, NULL},
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
150 {"vbv_maxrate", &vbv_maxrate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL},
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
151 {"vbv_bufsize", &vbv_bufsize, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL},
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
152 {"vbv_init", &vbv_init, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 1.0, NULL},
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
153 {"qp_min", &qp_min, CONF_TYPE_INT, CONF_RANGE, 1, 51, NULL},
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
154 {"qp_max", &qp_max, CONF_TYPE_INT, CONF_RANGE, 1, 51, NULL},
14307
2e35259a1558 change rc_init_buffer to be a fraction of total buffer size.
lorenm
parents: 14257
diff changeset
155 {"qp_step", &qp_step, CONF_TYPE_INT, CONF_RANGE, 1, 50, NULL},
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
156 {"pass", &pass, CONF_TYPE_INT, CONF_RANGE, 1, 3, NULL},
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
157 {"rc_eq", &rc_eq, CONF_TYPE_STRING, 0, 0, 0, NULL},
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
158 {"qcomp", &qcomp, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1, NULL},
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
159 {"qblur", &qblur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL},
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
160 {"cplx_blur", &complexity_blur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 999, NULL},
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
161 {"zones", &zones, CONF_TYPE_STRING, 0, 0, 0, NULL},
15724
35d05a4d14fd sync to x264 rev263 (RDO)
lorenm
parents: 15654
diff changeset
162 {"subq", &subq, CONF_TYPE_INT, CONF_RANGE, 1, 6, NULL},
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
163 {"me", &me_method, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL},
15352
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
164 {"me_range", &me_range, CONF_TYPE_INT, CONF_RANGE, 4, 64, NULL},
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
165 {"level_idc", &level_idc, CONF_TYPE_INT, CONF_RANGE, 10, 51, NULL},
15590
e848b20cd449 sync to x264 r240 (threads)
lorenm
parents: 15557
diff changeset
166 {"threads", &threads, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL},
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
167 {"psnr", &psnr, CONF_TYPE_FLAG, 0, 0, 1, NULL},
13496
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
168 {"nopsnr", &psnr, CONF_TYPE_FLAG, 0, 1, 0, NULL},
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
169 {"log", &log_level, CONF_TYPE_INT, CONF_RANGE, -1, 3, NULL},
15966
2170729da726 1/2 l: last patch lacked the option name, so it wasn't activeable
gpoirier
parents: 15964
diff changeset
170 {"turbo", &turbo, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
16016
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
171 {"visualize", &visualize, CONF_TYPE_FLAG, 0, 0, 1, NULL},
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
172 {"novisualize", &visualize, CONF_TYPE_FLAG, 0, 1, 0, NULL},
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
173 {NULL, NULL, 0, 0, 0, 0, NULL}
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
174 };
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
175
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
176 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi);
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
177 static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in);
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
178
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
179 static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
180 h264_module_t *mod=(h264_module_t*)vf->priv;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
181 mod->mux->bih->biWidth = width;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
182 mod->mux->bih->biHeight = height;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
183 mod->mux->aspect = (float)d_width/d_height;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
184
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
185 x264_param_default(&mod->param);
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
186 mod->param.i_frame_reference = frame_ref;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
187 mod->param.i_keyint_max = keyint_max;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
188 mod->param.i_keyint_min = keyint_min;
13584
17cb9c6a99f6 Adds a parameter 'scenecut', to control the threshold for inserting extra I-frames.
iive
parents: 13496
diff changeset
189 mod->param.i_scenecut_threshold = scenecut_threshold;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
190 mod->param.i_bframe = bframe;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
191 mod->param.b_bframe_adaptive = bframe_adaptive;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
192 mod->param.i_bframe_bias = bframe_bias;
14916
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
193 mod->param.b_bframe_pyramid = bframe_pyramid;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
194 mod->param.b_deblocking_filter = deblock;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
195 mod->param.i_deblocking_filter_alphac0 = deblockalpha;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
196 mod->param.i_deblocking_filter_beta = deblockbeta;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
197 mod->param.b_cabac = cabac;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
198
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
199 mod->param.rc.i_qp_constant = qp_constant;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
200 if(qp_min > qp_constant)
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
201 qp_min = qp_constant;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
202 if(qp_max < qp_constant)
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
203 qp_max = qp_constant;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
204 mod->param.rc.i_qp_min = qp_min;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
205 mod->param.rc.i_qp_max = qp_max;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
206 mod->param.rc.i_qp_step = qp_step;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
207 mod->param.rc.psz_rc_eq = rc_eq;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
208 mod->param.rc.f_qcompress = qcomp;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
209 mod->param.rc.f_qblur = qblur;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
210 mod->param.rc.f_complexity_blur = complexity_blur;
13431
15efa8ab93e3 add support for subpel quality refinement option in x264.
iive
parents: 13376
diff changeset
211 mod->param.analyse.i_subpel_refine = subq;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
212 mod->param.rc.psz_stat_out = passtmpfile;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
213 mod->param.rc.psz_stat_in = passtmpfile;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
214 if((pass & 2) && bitrate <= 0)
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
215 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
216 mp_msg(MSGT_MENCODER, MSGL_ERR,
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
217 "2 pass encoding enabled, but no bitrate specified.\n");
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
218 return 0;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
219 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
220 if(bitrate > 0) {
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
221 if((vbv_maxrate > 0) != (vbv_bufsize > 0)) {
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
222 mp_msg(MSGT_MENCODER, MSGL_ERR,
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
223 "VBV requires both vbv_maxrate and vbv_bufsize.\n");
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
224 return 0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
225 }
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
226 mod->param.rc.b_cbr = 1;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
227 mod->param.rc.i_bitrate = bitrate;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
228 mod->param.rc.f_rate_tolerance = ratetol;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
229 mod->param.rc.i_vbv_max_bitrate = vbv_maxrate;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
230 mod->param.rc.i_vbv_buffer_size = vbv_bufsize;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
231 mod->param.rc.f_vbv_buffer_init = vbv_init;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
232 }
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
233 mod->param.rc.f_ip_factor = ip_factor;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
234 mod->param.rc.f_pb_factor = pb_factor;
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
235 mod->param.rc.psz_zones = zones;
15352
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
236 switch(me_method) {
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
237 case 1: mod->param.analyse.i_me_method = X264_ME_DIA; break;
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
238 case 2: mod->param.analyse.i_me_method = X264_ME_HEX; break;
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
239 case 3: mod->param.analyse.i_me_method = X264_ME_UMH; break;
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
240 case 4: mod->param.analyse.i_me_method = X264_ME_ESA; break;
15352
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
241 }
15654
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
242 mod->param.analyse.inter = 0;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
243 if(p4x4mv) mod->param.analyse.inter |= X264_ANALYSE_PSUB8x8;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
244 if(p8x8mv) mod->param.analyse.inter |= X264_ANALYSE_PSUB16x16;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
245 if(b8x8mv) mod->param.analyse.inter |= X264_ANALYSE_BSUB16x16;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
246 if(i4x4) mod->param.analyse.inter |= X264_ANALYSE_I4x4;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
247 if(i8x8) mod->param.analyse.inter |= X264_ANALYSE_I8x8;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
248 mod->param.analyse.b_transform_8x8 = dct8;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
249 mod->param.analyse.i_direct_mv_pred = direct_pred;
14759
8c1d40548612 Sync to x264 r134: weighted prediction for B-frames.
lorenm
parents: 14738
diff changeset
250 mod->param.analyse.b_weighted_bipred = weight_b;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
251 mod->param.analyse.i_chroma_qp_offset = chroma_qp_offset;
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
252 mod->param.analyse.b_chroma_me = chroma_me;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
253
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
254 mod->param.i_width = width;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
255 mod->param.i_height = height;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
256 mod->param.i_fps_num = mod->mux->h.dwRate;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
257 mod->param.i_fps_den = mod->mux->h.dwScale;
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
258 mod->param.i_level_idc = level_idc;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
259 mod->param.analyse.b_psnr = psnr;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
260 mod->param.i_log_level = log_level;
16016
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
261 mod->param.b_visualize = visualize;
14023
b055a075999a set sample aspect ratio
lorenm
parents: 13965
diff changeset
262 mod->param.vui.i_sar_width = d_width*height;
b055a075999a set sample aspect ratio
lorenm
parents: 13965
diff changeset
263 mod->param.vui.i_sar_height = d_height*width;
15590
e848b20cd449 sync to x264 r240 (threads)
lorenm
parents: 15557
diff changeset
264 mod->param.i_threads = threads;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
265
15964
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
266 switch(pass) {
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
267 case 0:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
268 mod->param.rc.b_stat_write = 0;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
269 mod->param.rc.b_stat_read = 0;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
270 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
271 case 1:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
272 /* Adjust or disable some flags to gain speed in the first pass */
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
273 if(turbo == 1)
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
274 {
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
275 mod->param.i_frame_reference = ( frame_ref + 1 ) >> 1;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
276 mod->param.analyse.i_subpel_refine = max( min( 3, subq - 1 ), 1 );
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
277 mod->param.analyse.inter &= ( ~X264_ANALYSE_PSUB8x8 );
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
278 mod->param.analyse.inter &= ( ~X264_ANALYSE_BSUB16x16 );
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
279 }
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
280 else if(turbo == 2)
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
281 {
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
282 mod->param.i_frame_reference = 1;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
283 mod->param.analyse.i_subpel_refine = 1;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
284 mod->param.analyse.i_me_method = X264_ME_DIA;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
285 mod->param.analyse.inter = 0;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
286 mod->param.analyse.b_transform_8x8 = 0;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
287 mod->param.analyse.b_weighted_bipred = 0;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
288 }
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
289 mod->param.rc.b_stat_write = 1;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
290 mod->param.rc.b_stat_read = 0;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
291 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
292 case 2:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
293 mod->param.rc.b_stat_write = 0;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
294 mod->param.rc.b_stat_read = 1;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
295 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
296 case 3:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
297 mod->param.rc.b_stat_write = 1;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
298 mod->param.rc.b_stat_read = 1;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
299 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
300 }
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
301
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
302 if(me_method >= 3)
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
303 mod->param.analyse.i_me_range = me_range;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
304
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
305 switch(outfmt) {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
306 case IMGFMT_I420:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
307 mod->param.i_csp = X264_CSP_I420;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
308 mod->mux->bih->biSizeImage = width * height * 3;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
309 break;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
310 case IMGFMT_YV12:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
311 mod->param.i_csp = X264_CSP_YV12;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
312 mod->mux->bih->biSizeImage = width * height * 3;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
313 break;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
314 case IMGFMT_422P:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
315 mod->param.i_csp = X264_CSP_I422;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
316 mod->mux->bih->biSizeImage = width * height * 3;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
317 break;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
318 case IMGFMT_444P:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
319 mod->param.i_csp = X264_CSP_I444;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
320 mod->mux->bih->biSizeImage = width * height * 3;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
321 break;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
322 case IMGFMT_YVYU:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
323 mod->param.i_csp = X264_CSP_YUYV;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
324 mod->mux->bih->biSizeImage = width * height * 3;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
325 break;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
326 case IMGFMT_RGB:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
327 mod->param.i_csp = X264_CSP_RGB;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
328 mod->mux->bih->biSizeImage = width * height * 3;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
329 break;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
330 case IMGFMT_BGR:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
331 mod->param.i_csp = X264_CSP_BGR;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
332 mod->mux->bih->biSizeImage = width * height * 3;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
333 break;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
334 case IMGFMT_BGR32:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
335 mod->param.i_csp = X264_CSP_BGRA;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
336 mod->mux->bih->biSizeImage = width * height * 4;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
337 break;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
338 default:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
339 mp_msg(MSGT_MENCODER, MSGL_ERR, "Wrong colorspace.\n");
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
340 return 0;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
341 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
342
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
343 mod->x264 = x264_encoder_open(&mod->param);
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
344 if(!mod->x264) {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
345 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_open failed.\n");
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
346 return 0;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
347 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
348
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
349 return 1;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
350 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
351
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
352 static int control(struct vf_instance_s* vf, int request, void *data)
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
353 {
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
354 switch(request){
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
355 case VFCTRL_FLUSH_FRAMES:
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
356 if(bframe)
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
357 while(encode_frame(vf, NULL) > 0);
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
358 return CONTROL_TRUE;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
359 default:
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
360 return CONTROL_UNKNOWN;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
361 }
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
362 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
363
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
364 static int query_format(struct vf_instance_s* vf, unsigned int fmt)
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
365 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
366 switch(fmt) {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
367 case IMGFMT_I420:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
368 return (VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW);
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
369 case IMGFMT_YV12:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
370 case IMGFMT_422P:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
371 case IMGFMT_444P:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
372 case IMGFMT_YVYU:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
373 case IMGFMT_RGB:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
374 case IMGFMT_BGR:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
375 case IMGFMT_BGR32:
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
376 /* These colorspaces are supported, but they'll just have
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
377 * to be converted to I420 internally */
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
378 return 0; /* VFCAP_CSP_SUPPORTED */
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
379 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
380 return 0;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
381 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
382
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
383 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi)
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
384 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
385 h264_module_t *mod=(h264_module_t*)vf->priv;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
386 int i;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
387
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
388 memset(&mod->pic, 0, sizeof(x264_picture_t));
14846
073b10b68565 memory leak
lorenm
parents: 14784
diff changeset
389 mod->pic.img.i_csp=mod->param.i_csp;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
390 mod->pic.img.i_plane=3;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
391 for(i=0; i<4; i++) {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
392 mod->pic.img.plane[i] = mpi->planes[i];
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
393 mod->pic.img.i_stride[i] = mpi->stride[i];
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
394 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
395
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
396 mod->pic.i_type = X264_TYPE_AUTO;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
397
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
398 return encode_frame(vf, &mod->pic) >= 0;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
399 }
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
400
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
401 static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in)
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
402 {
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
403 h264_module_t *mod=(h264_module_t*)vf->priv;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
404 x264_picture_t pic_out;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
405 x264_nal_t *nal;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
406 int i_nal;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
407 int i_size = 0;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
408 int i;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
409
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
410 if(x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out) < 0) {
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
411 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_encode failed\n");
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
412 return -1;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
413 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
414
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
415 for(i=0; i < i_nal; i++) {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
416 int i_data = mod->mux->buffer_size - i_size;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
417 i_size += x264_nal_encode(mod->mux->buffer + i_size, &i_data, 1, &nal[i]);
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
418 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
419 if(i_size>0) {
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
420 int keyframe = (pic_out.i_type == X264_TYPE_IDR) ||
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
421 (pic_out.i_type == X264_TYPE_I
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
422 && frame_ref == 1 && !bframe);
13658
8c93573e0cdf Mark I-frames as seekable only if we encode with one reference frame, IDR are always seekable
iive
parents: 13584
diff changeset
423 muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0);
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
424 }
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
425
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
426 return i_size;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
427 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
428
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
429 static void uninit(struct vf_instance_s *vf)
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
430 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
431 h264_module_t *mod=(h264_module_t*)vf->priv;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
432 x264_encoder_close(mod->x264);
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
433 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
434
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
435 static int vf_open(vf_instance_t *vf, char *args) {
13334
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
436 h264_module_t *mod;
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
437
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
438 vf->config = config;
14878
5723c4b2a2ea fixes for encoding of multiple files
henry
parents: 14846
diff changeset
439 vf->default_caps = VFCAP_CONSTANT;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
440 vf->control = control;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
441 vf->query_format = query_format;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
442 vf->put_image = put_image;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
443 vf->uninit = uninit;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
444 vf->priv = malloc(sizeof(h264_module_t));
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
445
13334
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
446 mod=(h264_module_t*)vf->priv;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
447 mod->mux = (muxer_stream_t*)args;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
448 mod->mux->bih = malloc(sizeof(BITMAPINFOHEADER));
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
449 memset(mod->mux->bih, 0, sizeof(BITMAPINFOHEADER));
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
450 mod->mux->bih->biSize = sizeof(BITMAPINFOHEADER);
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
451 mod->mux->bih->biPlanes = 1;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
452 mod->mux->bih->biBitCount = 24;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
453 mod->mux->bih->biCompression = mmioFOURCC('h', '2', '6', '4');
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
454
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
455 return 1;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
456 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
457
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
458 vf_info_t ve_info_x264 = {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
459 "H.264 encoder",
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
460 "x264",
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
461 "Bernhard Rosenkraenzer <bero@arklinux.org>",
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
462 "(C) 2004 LINUX4MEDIA GmbH; (C) 2004 Ark Linux",
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
463 vf_open
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
464 };
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
465 #endif