annotate libmpcodecs/ve_x264.c @ 17268:2ec81c50a763

sync to x264 r390 (bime)
author lorenm
date Fri, 30 Dec 2005 05:15:27 +0000
parents 3c4b93bc0db3
children 5a5a351734f2
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
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16898
diff changeset
33 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16898
diff changeset
34 #include "mp_msg.h"
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
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;
16846
cbd11ea4d424 sync to x264 r334 (crf)
lorenm
parents: 16712
diff changeset
63 static int rf_constant = 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
64 static int frame_ref = 1;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
65 static int keyint_max = 250;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
66 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
67 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
68 static int bframe = 0;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
69 static int bframe_adaptive = 1;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
70 static int bframe_bias = 0;
14916
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
71 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
72 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
73 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
74 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
75 static int cabac = 1;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
76 static int p4x4mv = 0;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
77 static int p8x8mv = 1;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
78 static int b8x8mv = 1;
15654
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
79 static int i8x8 = 1;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
80 static int i4x4 = 1;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
81 static int dct8 = 0;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
82 static int direct_pred = X264_DIRECT_PRED_TEMPORAL;
14759
8c1d40548612 Sync to x264 r134: weighted prediction for B-frames.
lorenm
parents: 14738
diff changeset
83 static int weight_b = 0;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
84 static int chroma_me = 1;
16712
2059bee8c11c sync to x264 r318 (mixed_refs)
lorenm
parents: 16366
diff changeset
85 static int mixed_references = 0;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
86 static int chroma_qp_offset = 0;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
87 static float ip_factor = 1.4;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
88 static float pb_factor = 1.3;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
89 static float ratetol = 1.0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
90 static int vbv_maxrate = 0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
91 static int vbv_bufsize = 0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
92 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
93 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
94 static int qp_max = 51;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
95 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
96 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
97 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
98 static float qblur = 0.5;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
99 static float complexity_blur = 20;
14719
a76f1a68ed75 sync to x264 r129: modified ratecontrol equation.
lorenm
parents: 14468
diff changeset
100 static char *rc_eq = "blurCplx^(1-qComp)";
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
101 static char *zones = NULL;
14411
fba04febec4e x264: disable subq=0 (the huge bitrate penalty wasn't worth the speed),
lorenm
parents: 14307
diff changeset
102 static int subq = 5;
17025
8e458f513c48 sync to x264 r373 (brdo)
lorenm
parents: 17012
diff changeset
103 static int bframe_rdo = 0;
17268
2ec81c50a763 sync to x264 r390 (bime)
lorenm
parents: 17026
diff changeset
104 static int bidir_me = 0;
15352
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
105 static int me_method = 2;
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
106 static int me_range = 16;
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
107 static int trellis = 1;
15590
e848b20cd449 sync to x264 r240 (threads)
lorenm
parents: 15557
diff changeset
108 static int threads = 1;
17026
lorenm
parents: 17025
diff changeset
109 static int level_idc = 51;
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
110 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
111 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
112 static int turbo = 0;
16016
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
113 static int visualize = 0;
16366
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
114 static char *cqm = NULL;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
115 static char *cqm4iy = NULL;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
116 static char *cqm4ic = NULL;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
117 static char *cqm4py = NULL;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
118 static char *cqm4pc = NULL;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
119 static char *cqm8iy = NULL;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
120 static char *cqm8py = 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
121
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
122 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
123 {"bitrate", &bitrate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL},
15744
268cb6b8484e sync to x264 rev264 (lossless)
lorenm
parents: 15724
diff changeset
124 {"qp_constant", &qp_constant, CONF_TYPE_INT, CONF_RANGE, 0, 51, NULL},
16846
cbd11ea4d424 sync to x264 r334 (crf)
lorenm
parents: 16712
diff changeset
125 {"qp", &qp_constant, CONF_TYPE_INT, CONF_RANGE, 0, 51, NULL},
cbd11ea4d424 sync to x264 r334 (crf)
lorenm
parents: 16712
diff changeset
126 {"crf", &rf_constant, CONF_TYPE_INT, CONF_RANGE, 1, 50, NULL},
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
127 {"frameref", &frame_ref, CONF_TYPE_INT, CONF_RANGE, 1, 16, NULL},
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
128 {"keyint", &keyint_max, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL},
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
129 {"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
130 {"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
131 {"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
132 {"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
133 {"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
134 {"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
135 {"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
136 {"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
137 {"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
138 {"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
139 {"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
140 {"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
141 {"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
142 {"nocabac", &cabac, CONF_TYPE_FLAG, 0, 1, 0, NULL},
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
143 {"4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
144 {"no4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
145 {"8x8mv", &p8x8mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
146 {"no8x8mv", &p8x8mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
147 {"b8x8mv", &b8x8mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
148 {"nob8x8mv", &b8x8mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
15654
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
149 {"i4x4", &i4x4, CONF_TYPE_FLAG, 0, 0, 1, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
150 {"noi4x4", &i4x4, CONF_TYPE_FLAG, 0, 0, 0, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
151 {"i8x8", &i8x8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
152 {"noi8x8", &i8x8, CONF_TYPE_FLAG, 0, 0, 0, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
153 {"8x8dct", &dct8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
154 {"no8x8dct", &dct8, CONF_TYPE_FLAG, 0, 0, 0, NULL},
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
155 {"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
156 {"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
157 {"noweight_b", &weight_b, CONF_TYPE_FLAG, 0, 1, 0, NULL},
17268
2ec81c50a763 sync to x264 r390 (bime)
lorenm
parents: 17026
diff changeset
158 {"bime", &bidir_me, CONF_TYPE_FLAG, 0, 0, 1, NULL},
2ec81c50a763 sync to x264 r390 (bime)
lorenm
parents: 17026
diff changeset
159 {"nobime", &bidir_me, CONF_TYPE_FLAG, 0, 0, 0, NULL},
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
160 {"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
161 {"nochroma_me", &chroma_me, CONF_TYPE_FLAG, 0, 1, 0, NULL},
16712
2059bee8c11c sync to x264 r318 (mixed_refs)
lorenm
parents: 16366
diff changeset
162 {"mixed_refs", &mixed_references, CONF_TYPE_FLAG, 0, 0, 1, NULL},
2059bee8c11c sync to x264 r318 (mixed_refs)
lorenm
parents: 16366
diff changeset
163 {"nomixed_refs", &mixed_references, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
164 {"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
165 {"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
166 {"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
167 {"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
168 {"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
169 {"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
170 {"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
171 {"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
172 {"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
173 {"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
174 {"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
175 {"rc_eq", &rc_eq, CONF_TYPE_STRING, 0, 0, 0, NULL},
16366
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
176 {"cqm", &cqm, CONF_TYPE_STRING, 0, 0, 0, NULL},
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
177 {"cqm4iy", &cqm4iy, CONF_TYPE_STRING, 0, 0, 0, NULL},
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
178 {"cqm4ic", &cqm4ic, CONF_TYPE_STRING, 0, 0, 0, NULL},
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
179 {"cqm4py", &cqm4py, CONF_TYPE_STRING, 0, 0, 0, NULL},
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
180 {"cqm4pc", &cqm4pc, CONF_TYPE_STRING, 0, 0, 0, NULL},
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
181 {"cqm8iy", &cqm8iy, CONF_TYPE_STRING, 0, 0, 0, NULL},
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
182 {"cqm8py", &cqm8py, CONF_TYPE_STRING, 0, 0, 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
183 {"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
184 {"qblur", &qblur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL},
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
185 {"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
186 {"zones", &zones, CONF_TYPE_STRING, 0, 0, 0, NULL},
15724
35d05a4d14fd sync to x264 rev263 (RDO)
lorenm
parents: 15654
diff changeset
187 {"subq", &subq, CONF_TYPE_INT, CONF_RANGE, 1, 6, NULL},
17025
8e458f513c48 sync to x264 r373 (brdo)
lorenm
parents: 17012
diff changeset
188 {"brdo", &bframe_rdo, CONF_TYPE_FLAG, 0, 0, 1, NULL},
8e458f513c48 sync to x264 r373 (brdo)
lorenm
parents: 17012
diff changeset
189 {"nobrdo", &bframe_rdo, CONF_TYPE_FLAG, 0, 0, 0, NULL},
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
190 {"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
191 {"me_range", &me_range, CONF_TYPE_INT, CONF_RANGE, 4, 64, NULL},
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
192 {"trellis", &trellis, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
193 {"level_idc", &level_idc, CONF_TYPE_INT, CONF_RANGE, 10, 51, NULL},
15590
e848b20cd449 sync to x264 r240 (threads)
lorenm
parents: 15557
diff changeset
194 {"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
195 {"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
196 {"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
197 {"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
198 {"turbo", &turbo, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
16016
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
199 {"visualize", &visualize, CONF_TYPE_FLAG, 0, 0, 1, NULL},
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
200 {"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
201 {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
202 };
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
203
16366
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
204 static int parse_cqm(const char *str, uint8_t *cqm, int length,
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
205 h264_module_t *mod, char *matrix_name) {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
206 int i;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
207 if (!str) return 0;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
208 for (i = 0; i < length; i++) {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
209 long coef = strtol(str, &str, 0);
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
210 if (coef < 1 || coef > 255 || str[0] != ((i + 1 == length)?0:',')) {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
211 mp_msg( MSGT_MENCODER, MSGL_ERR, "x264: Invalid entry in cqm%s at position %d.\n", matrix_name, i+1 );
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
212 return -1;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
213 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
214 cqm[i] = coef;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
215 str = &str[1];
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
216 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
217 mod->param.i_cqm_preset = X264_CQM_CUSTOM;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
218 return 0;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
219 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
220
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
221 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
222 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
223
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
224 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
225 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
226 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
227 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
228 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
229
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
230 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
231 mod->param.i_frame_reference = frame_ref;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
232 mod->param.i_keyint_max = keyint_max;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
233 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
234 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
235 mod->param.i_bframe = bframe;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
236 mod->param.b_bframe_adaptive = bframe_adaptive;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
237 mod->param.i_bframe_bias = bframe_bias;
14916
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
238 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
239 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
240 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
241 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
242 mod->param.b_cabac = cabac;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
243
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
244 mod->param.rc.i_qp_constant = qp_constant;
16846
cbd11ea4d424 sync to x264 r334 (crf)
lorenm
parents: 16712
diff changeset
245 mod->param.rc.i_rf_constant = rf_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
246 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
247 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
248 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
249 qp_max = qp_constant;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
250 mod->param.rc.i_qp_min = qp_min;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
251 mod->param.rc.i_qp_max = qp_max;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
252 mod->param.rc.i_qp_step = qp_step;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
253 mod->param.rc.psz_rc_eq = rc_eq;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
254 mod->param.rc.f_qcompress = qcomp;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
255 mod->param.rc.f_qblur = qblur;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
256 mod->param.rc.f_complexity_blur = complexity_blur;
13431
15efa8ab93e3 add support for subpel quality refinement option in x264.
iive
parents: 13376
diff changeset
257 mod->param.analyse.i_subpel_refine = subq;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
258 mod->param.rc.psz_stat_out = passtmpfile;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
259 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
260 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
261 {
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
262 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
263 "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
264 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
265 }
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
266 if(bitrate > 0) {
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
267 if((vbv_maxrate > 0) != (vbv_bufsize > 0)) {
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
268 mp_msg(MSGT_MENCODER, MSGL_ERR,
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
269 "VBV requires both vbv_maxrate and vbv_bufsize.\n");
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
270 return 0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
271 }
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
272 mod->param.rc.b_cbr = 1;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
273 mod->param.rc.i_bitrate = bitrate;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
274 mod->param.rc.f_rate_tolerance = ratetol;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
275 mod->param.rc.i_vbv_max_bitrate = vbv_maxrate;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
276 mod->param.rc.i_vbv_buffer_size = vbv_bufsize;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
277 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
278 }
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
279 mod->param.rc.f_ip_factor = ip_factor;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
280 mod->param.rc.f_pb_factor = pb_factor;
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
281 mod->param.rc.psz_zones = zones;
15352
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
282 switch(me_method) {
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
283 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
284 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
285 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
286 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
287 }
15654
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
288 mod->param.analyse.inter = 0;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
289 if(p4x4mv) mod->param.analyse.inter |= X264_ANALYSE_PSUB8x8;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
290 if(p8x8mv) mod->param.analyse.inter |= X264_ANALYSE_PSUB16x16;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
291 if(b8x8mv) mod->param.analyse.inter |= X264_ANALYSE_BSUB16x16;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
292 if(i4x4) mod->param.analyse.inter |= X264_ANALYSE_I4x4;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
293 if(i8x8) mod->param.analyse.inter |= X264_ANALYSE_I8x8;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
294 mod->param.analyse.b_transform_8x8 = dct8;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
295 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
296 mod->param.analyse.b_weighted_bipred = weight_b;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
297 mod->param.analyse.i_chroma_qp_offset = chroma_qp_offset;
17268
2ec81c50a763 sync to x264 r390 (bime)
lorenm
parents: 17026
diff changeset
298 mod->param.analyse.b_bidir_me = bidir_me;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
299 mod->param.analyse.b_chroma_me = chroma_me;
16712
2059bee8c11c sync to x264 r318 (mixed_refs)
lorenm
parents: 16366
diff changeset
300 mod->param.analyse.b_mixed_references = mixed_references;
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
301 mod->param.analyse.i_trellis = trellis;
17025
8e458f513c48 sync to x264 r373 (brdo)
lorenm
parents: 17012
diff changeset
302 mod->param.analyse.b_bframe_rdo = bframe_rdo;
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
303
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
304 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
305 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
306 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
307 mod->param.i_fps_den = mod->mux->h.dwScale;
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
308 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
309 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
310 mod->param.i_log_level = log_level;
16016
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
311 mod->param.b_visualize = visualize;
14023
b055a075999a set sample aspect ratio
lorenm
parents: 13965
diff changeset
312 mod->param.vui.i_sar_width = d_width*height;
b055a075999a set sample aspect ratio
lorenm
parents: 13965
diff changeset
313 mod->param.vui.i_sar_height = d_height*width;
15590
e848b20cd449 sync to x264 r240 (threads)
lorenm
parents: 15557
diff changeset
314 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
315
16366
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
316 if(cqm != NULL)
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
317 {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
318 if( !strcmp(cqm, "flat") )
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
319 mod->param.i_cqm_preset = X264_CQM_FLAT;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
320 else if( !strcmp(cqm, "jvt") )
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
321 mod->param.i_cqm_preset = X264_CQM_JVT;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
322 else
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
323 {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
324 FILE *cqm_test;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
325 cqm_test = fopen( cqm, "rb" );
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
326 if( cqm_test )
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
327 {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
328 mod->param.i_cqm_preset = X264_CQM_CUSTOM;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
329 mod->param.psz_cqm_file = cqm;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
330 fclose( cqm_test );
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
331 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
332 else
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
333 {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
334 mp_msg( MSGT_MENCODER, MSGL_ERR, "x264: CQM file failed to open.\n" );
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
335 return 0;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
336 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
337 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
338 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
339
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
340 if( (parse_cqm(cqm4iy, mod->param.cqm_4iy, 16, mod, "4iy") < 0) ||
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
341 (parse_cqm(cqm4ic, mod->param.cqm_4ic, 16, mod, "4ic") < 0) ||
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
342 (parse_cqm(cqm4py, mod->param.cqm_4py, 16, mod, "4py") < 0) ||
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
343 (parse_cqm(cqm4pc, mod->param.cqm_4pc, 16, mod, "4pc") < 0) ||
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
344 (parse_cqm(cqm8iy, mod->param.cqm_8iy, 64, mod, "8iy") < 0) ||
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
345 (parse_cqm(cqm8py, mod->param.cqm_8py, 64, mod, "8py") < 0) )
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
346 return 0;
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
347
15964
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
348 switch(pass) {
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
349 case 0:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
350 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
351 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
352 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
353 case 1:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
354 /* 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
355 if(turbo == 1)
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
356 {
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
357 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
358 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
359 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
360 mod->param.analyse.inter &= ( ~X264_ANALYSE_BSUB16x16 );
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
361 mod->param.analyse.i_trellis = 0;
15964
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
362 }
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
363 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
364 {
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
365 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
366 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
367 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
368 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
369 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
370 mod->param.analyse.b_weighted_bipred = 0;
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
371 mod->param.analyse.i_trellis = 0;
15964
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
372 }
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
373 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
374 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
375 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
376 case 2:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
377 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
378 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
379 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
380 case 3:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
381 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
382 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
383 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
384 }
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
385
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
386 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
387 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
388
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
389 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
390 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
391 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
392 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
393 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
394 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
395 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
396 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
397 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
398 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
399 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
400 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
401 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
402 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
403 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
404 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
405 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
406 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
407 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
408 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
409 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
410 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
411 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
412 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
413 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
414 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
415 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
416 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
417 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
418 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
419 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
420 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
421 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
422 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
423 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
424 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
425 }
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
426
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 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
428 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
429 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
430 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
431 }
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
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 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
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
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
436 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
437 {
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
438 switch(request){
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
439 case VFCTRL_FLUSH_FRAMES:
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
440 if(bframe)
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
441 while(encode_frame(vf, NULL) > 0);
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
442 return CONTROL_TRUE;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
443 default:
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
444 return CONTROL_UNKNOWN;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
445 }
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
446 }
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
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 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
449 {
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 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
451 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
452 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
453 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
454 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
455 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
456 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
457 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
458 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
459 case IMGFMT_BGR32:
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
460 /* These colorspaces are supported, but they'll just have
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
461 * 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
462 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
463 }
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 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
465 }
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
466
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
467 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
468 {
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
469 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
470 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
471
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
472 memset(&mod->pic, 0, sizeof(x264_picture_t));
14846
073b10b68565 memory leak
lorenm
parents: 14784
diff changeset
473 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
474 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
475 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
476 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
477 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
478 }
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
479
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
480 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
481
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
482 return encode_frame(vf, &mod->pic) >= 0;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
483 }
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
484
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
485 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
486 {
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
487 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
488 x264_picture_t pic_out;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
489 x264_nal_t *nal;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
490 int i_nal;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
491 int i_size = 0;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
492 int i;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
493
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
494 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
495 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
496 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
497 }
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
498
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
499 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
500 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
501 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
502 }
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
503 if(i_size>0) {
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
504 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
505 (pic_out.i_type == X264_TYPE_I
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
506 && 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
507 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
508 }
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
509
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
510 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
511 }
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
512
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
513 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
514 {
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
515 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
516 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
517 }
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
518
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
519 static int vf_open(vf_instance_t *vf, char *args) {
13334
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
520 h264_module_t *mod;
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
521
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
522 vf->config = config;
14878
5723c4b2a2ea fixes for encoding of multiple files
henry
parents: 14846
diff changeset
523 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
524 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
525 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
526 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
527 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
528 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
529
13334
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
530 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
531 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
532 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
533 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
534 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
535 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
536 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
537 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
538
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
539 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
540 }
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
541
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
542 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
543 "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
544 "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
545 "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
546 "(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
547 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
548 };
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
549 #endif