annotate libmpcodecs/ve_x264.c @ 18540:fb07cde79487

only include sys/mman.h if HAVE_SYS_MMAN_H is defined
author ivo
date Thu, 18 May 2006 09:21:45 +0000
parents a08a78145d9b
children 2ec2301183cd
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 #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
37 #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
38 #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
39 #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
40 #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
41
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 "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
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 "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
45 #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
46 #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
47
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 <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
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 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
51 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
52 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
53 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
54 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
55 } 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
56
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
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 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
60 static int qp_constant = 26;
16846
cbd11ea4d424 sync to x264 r334 (crf)
lorenm
parents: 16712
diff changeset
61 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
62 static int frame_ref = 1;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
63 static int keyint_max = 250;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
64 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
65 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
66 static int bframe = 0;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
67 static int bframe_adaptive = 1;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
68 static int bframe_bias = 0;
14916
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
69 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
70 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
71 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
72 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
73 static int cabac = 1;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
74 static int p4x4mv = 0;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
75 static int p8x8mv = 1;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
76 static int b8x8mv = 1;
15654
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
77 static int i8x8 = 1;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
78 static int i4x4 = 1;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
79 static int dct8 = 0;
17731
a3dd033ec92e sync to x264 r457 (direct_pred=3)
lorenm
parents: 17659
diff changeset
80 static int direct_pred = X264_DIRECT_PRED_SPATIAL;
14759
8c1d40548612 Sync to x264 r134: weighted prediction for B-frames.
lorenm
parents: 14738
diff changeset
81 static int weight_b = 0;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
82 static int chroma_me = 1;
16712
2059bee8c11c sync to x264 r318 (mixed_refs)
lorenm
parents: 16366
diff changeset
83 static int mixed_references = 0;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
84 static int chroma_qp_offset = 0;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
85 static float ip_factor = 1.4;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
86 static float pb_factor = 1.3;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
87 static float ratetol = 1.0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
88 static int vbv_maxrate = 0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
89 static int vbv_bufsize = 0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
90 static float vbv_init = 0.9;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
91 static int qp_min = 10;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
92 static int qp_max = 51;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
93 static int qp_step = 2;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
94 static int pass = 0;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
95 static float qcomp = 0.6;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
96 static float qblur = 0.5;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
97 static float complexity_blur = 20;
14719
a76f1a68ed75 sync to x264 r129: modified ratecontrol equation.
lorenm
parents: 14468
diff changeset
98 static char *rc_eq = "blurCplx^(1-qComp)";
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
99 static char *zones = NULL;
14411
fba04febec4e x264: disable subq=0 (the huge bitrate penalty wasn't worth the speed),
lorenm
parents: 14307
diff changeset
100 static int subq = 5;
17025
8e458f513c48 sync to x264 r373 (brdo)
lorenm
parents: 17012
diff changeset
101 static int bframe_rdo = 0;
17268
2ec81c50a763 sync to x264 r390 (bime)
lorenm
parents: 17026
diff changeset
102 static int bidir_me = 0;
15352
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
103 static int me_method = 2;
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
104 static int me_range = 16;
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
105 static int trellis = 1;
17402
5a5a351734f2 sync to x264 r398.
lorenm
parents: 17268
diff changeset
106 static int fast_pskip = 1;
18207
a08a78145d9b sync to x264 r503 (dct_decimate)
lorenm
parents: 17906
diff changeset
107 static int dct_decimate = 1;
17402
5a5a351734f2 sync to x264 r398.
lorenm
parents: 17268
diff changeset
108 static int noise_reduction = 0;
15590
e848b20cd449 sync to x264 r240 (threads)
lorenm
parents: 15557
diff changeset
109 static int threads = 1;
17026
lorenm
parents: 17025
diff changeset
110 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
111 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
112 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
113 static int turbo = 0;
16016
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
114 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
115 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
116 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
117 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
118 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
119 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
120 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
121 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
122
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
124 {"bitrate", &bitrate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL},
15744
268cb6b8484e sync to x264 rev264 (lossless)
lorenm
parents: 15724
diff changeset
125 {"qp_constant", &qp_constant, CONF_TYPE_INT, CONF_RANGE, 0, 51, NULL},
16846
cbd11ea4d424 sync to x264 r334 (crf)
lorenm
parents: 16712
diff changeset
126 {"qp", &qp_constant, CONF_TYPE_INT, CONF_RANGE, 0, 51, NULL},
cbd11ea4d424 sync to x264 r334 (crf)
lorenm
parents: 16712
diff changeset
127 {"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
128 {"frameref", &frame_ref, CONF_TYPE_INT, CONF_RANGE, 1, 16, NULL},
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
129 {"keyint", &keyint_max, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL},
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
130 {"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
131 {"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
132 {"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
133 {"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
134 {"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
135 {"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
136 {"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
137 {"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
138 {"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
139 {"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
140 {"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
141 {"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
142 {"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
143 {"nocabac", &cabac, CONF_TYPE_FLAG, 0, 1, 0, NULL},
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
144 {"4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
145 {"no4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
146 {"8x8mv", &p8x8mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
147 {"no8x8mv", &p8x8mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
148 {"b8x8mv", &b8x8mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
149 {"nob8x8mv", &b8x8mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
15654
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
150 {"i4x4", &i4x4, CONF_TYPE_FLAG, 0, 0, 1, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
151 {"noi4x4", &i4x4, CONF_TYPE_FLAG, 0, 0, 0, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
152 {"i8x8", &i8x8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
153 {"noi8x8", &i8x8, CONF_TYPE_FLAG, 0, 0, 0, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
154 {"8x8dct", &dct8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
155 {"no8x8dct", &dct8, CONF_TYPE_FLAG, 0, 0, 0, NULL},
17731
a3dd033ec92e sync to x264 r457 (direct_pred=3)
lorenm
parents: 17659
diff changeset
156 {"direct_pred", &direct_pred, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
14759
8c1d40548612 Sync to x264 r134: weighted prediction for B-frames.
lorenm
parents: 14738
diff changeset
157 {"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
158 {"noweight_b", &weight_b, CONF_TYPE_FLAG, 0, 1, 0, NULL},
17268
2ec81c50a763 sync to x264 r390 (bime)
lorenm
parents: 17026
diff changeset
159 {"bime", &bidir_me, CONF_TYPE_FLAG, 0, 0, 1, NULL},
2ec81c50a763 sync to x264 r390 (bime)
lorenm
parents: 17026
diff changeset
160 {"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
161 {"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
162 {"nochroma_me", &chroma_me, CONF_TYPE_FLAG, 0, 1, 0, NULL},
16712
2059bee8c11c sync to x264 r318 (mixed_refs)
lorenm
parents: 16366
diff changeset
163 {"mixed_refs", &mixed_references, CONF_TYPE_FLAG, 0, 0, 1, NULL},
2059bee8c11c sync to x264 r318 (mixed_refs)
lorenm
parents: 16366
diff changeset
164 {"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
165 {"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
166 {"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
167 {"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
168 {"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
169 {"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
170 {"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
171 {"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
172 {"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
173 {"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
174 {"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
175 {"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
176 {"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
177 {"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
178 {"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
179 {"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
180 {"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
181 {"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
182 {"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
183 {"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
184 {"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
185 {"qblur", &qblur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL},
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
186 {"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
187 {"zones", &zones, CONF_TYPE_STRING, 0, 0, 0, NULL},
17902
578074a74d4e sync to x264 r476 (subq=7)
lorenm
parents: 17731
diff changeset
188 {"subq", &subq, CONF_TYPE_INT, CONF_RANGE, 1, 7, NULL},
17025
8e458f513c48 sync to x264 r373 (brdo)
lorenm
parents: 17012
diff changeset
189 {"brdo", &bframe_rdo, CONF_TYPE_FLAG, 0, 0, 1, NULL},
8e458f513c48 sync to x264 r373 (brdo)
lorenm
parents: 17012
diff changeset
190 {"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
191 {"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
192 {"me_range", &me_range, CONF_TYPE_INT, CONF_RANGE, 4, 64, NULL},
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
193 {"trellis", &trellis, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
17402
5a5a351734f2 sync to x264 r398.
lorenm
parents: 17268
diff changeset
194 {"fast_pskip", &fast_pskip, CONF_TYPE_FLAG, 0, 0, 1, NULL},
5a5a351734f2 sync to x264 r398.
lorenm
parents: 17268
diff changeset
195 {"nofast_pskip", &fast_pskip, CONF_TYPE_FLAG, 0, 0, 0, NULL},
18207
a08a78145d9b sync to x264 r503 (dct_decimate)
lorenm
parents: 17906
diff changeset
196 {"dct_decimate", &dct_decimate, CONF_TYPE_FLAG, 0, 0, 1, NULL},
a08a78145d9b sync to x264 r503 (dct_decimate)
lorenm
parents: 17906
diff changeset
197 {"nodct_decimate", &dct_decimate, CONF_TYPE_FLAG, 0, 0, 0, NULL},
17402
5a5a351734f2 sync to x264 r398.
lorenm
parents: 17268
diff changeset
198 {"nr", &noise_reduction, CONF_TYPE_INT, CONF_RANGE, 0, 100000, NULL},
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
199 {"level_idc", &level_idc, CONF_TYPE_INT, CONF_RANGE, 10, 51, NULL},
15590
e848b20cd449 sync to x264 r240 (threads)
lorenm
parents: 15557
diff changeset
200 {"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
201 {"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
202 {"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
203 {"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
204 {"turbo", &turbo, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
16016
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
205 {"visualize", &visualize, CONF_TYPE_FLAG, 0, 0, 1, NULL},
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
206 {"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
207 {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
208 };
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
209
16366
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
210 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
211 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
212 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
213 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
214 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
215 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
216 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
217 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
218 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
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 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
221 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
222 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
223 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
224 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
225 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
226
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17902
diff changeset
227 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts);
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
228 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
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 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
231 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
232 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
233 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
234 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
235
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
236 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
237 mod->param.i_frame_reference = frame_ref;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
238 mod->param.i_keyint_max = keyint_max;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
239 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
240 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
241 mod->param.i_bframe = bframe;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
242 mod->param.b_bframe_adaptive = bframe_adaptive;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
243 mod->param.i_bframe_bias = bframe_bias;
14916
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
244 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
245 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
246 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
247 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
248 mod->param.b_cabac = cabac;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
249
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
250 mod->param.rc.i_qp_constant = qp_constant;
16846
cbd11ea4d424 sync to x264 r334 (crf)
lorenm
parents: 16712
diff changeset
251 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
252 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
253 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
254 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
255 qp_max = qp_constant;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
256 mod->param.rc.i_qp_min = qp_min;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
257 mod->param.rc.i_qp_max = qp_max;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
258 mod->param.rc.i_qp_step = qp_step;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
259 mod->param.rc.psz_rc_eq = rc_eq;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
260 mod->param.rc.f_qcompress = qcomp;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
261 mod->param.rc.f_qblur = qblur;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
262 mod->param.rc.f_complexity_blur = complexity_blur;
13431
15efa8ab93e3 add support for subpel quality refinement option in x264.
iive
parents: 13376
diff changeset
263 mod->param.analyse.i_subpel_refine = subq;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
264 mod->param.rc.psz_stat_out = passtmpfile;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
265 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
266 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
267 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
268 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
269 "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
270 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
271 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
272 if(bitrate > 0) {
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
273 if((vbv_maxrate > 0) != (vbv_bufsize > 0)) {
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
274 mp_msg(MSGT_MENCODER, MSGL_ERR,
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
275 "VBV requires both vbv_maxrate and vbv_bufsize.\n");
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
276 return 0;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
277 }
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
278 mod->param.rc.b_cbr = 1;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
279 mod->param.rc.i_bitrate = bitrate;
15413
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
280 mod->param.rc.f_rate_tolerance = ratetol;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
281 mod->param.rc.i_vbv_max_bitrate = vbv_maxrate;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
282 mod->param.rc.i_vbv_buffer_size = vbv_bufsize;
561f617e8944 sync to x264 rev223 (options: ratetol, vbv_*)
lorenm
parents: 15352
diff changeset
283 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
284 }
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
285 mod->param.rc.f_ip_factor = ip_factor;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
286 mod->param.rc.f_pb_factor = pb_factor;
15557
40d5e0ccce93 sync to x264 r239 (zoned ratecontrol and UMHex ME)
lorenm
parents: 15413
diff changeset
287 mod->param.rc.psz_zones = zones;
15352
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
288 switch(me_method) {
d8ee4d45ec8d expose x264 options 'me' and 'me_range'.
lorenm
parents: 15149
diff changeset
289 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
290 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
291 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
292 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
293 }
15654
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
294 mod->param.analyse.inter = 0;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
295 if(p4x4mv) mod->param.analyse.inter |= X264_ANALYSE_PSUB8x8;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
296 if(p8x8mv) mod->param.analyse.inter |= X264_ANALYSE_PSUB16x16;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
297 if(b8x8mv) mod->param.analyse.inter |= X264_ANALYSE_BSUB16x16;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
298 if(i4x4) mod->param.analyse.inter |= X264_ANALYSE_I4x4;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
299 if(i8x8) mod->param.analyse.inter |= X264_ANALYSE_I8x8;
c515b4dcec6b sync to x264 r252 (8x8dct)
lorenm
parents: 15590
diff changeset
300 mod->param.analyse.b_transform_8x8 = dct8;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
301 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
302 mod->param.analyse.b_weighted_bipred = weight_b;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
303 mod->param.analyse.i_chroma_qp_offset = chroma_qp_offset;
17268
2ec81c50a763 sync to x264 r390 (bime)
lorenm
parents: 17026
diff changeset
304 mod->param.analyse.b_bidir_me = bidir_me;
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
305 mod->param.analyse.b_chroma_me = chroma_me;
16712
2059bee8c11c sync to x264 r318 (mixed_refs)
lorenm
parents: 16366
diff changeset
306 mod->param.analyse.b_mixed_references = mixed_references;
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
307 mod->param.analyse.i_trellis = trellis;
17402
5a5a351734f2 sync to x264 r398.
lorenm
parents: 17268
diff changeset
308 mod->param.analyse.b_fast_pskip = fast_pskip;
18207
a08a78145d9b sync to x264 r503 (dct_decimate)
lorenm
parents: 17906
diff changeset
309 mod->param.analyse.b_dct_decimate = dct_decimate;
17402
5a5a351734f2 sync to x264 r398.
lorenm
parents: 17268
diff changeset
310 mod->param.analyse.i_noise_reduction = noise_reduction;
17025
8e458f513c48 sync to x264 r373 (brdo)
lorenm
parents: 17012
diff changeset
311 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
312
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
313 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
314 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
315 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
316 mod->param.i_fps_den = mod->mux->h.dwScale;
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
317 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
318 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
319 mod->param.i_log_level = log_level;
16016
a5d3b3b4bd4a add (no)visualize options
iive
parents: 15966
diff changeset
320 mod->param.b_visualize = visualize;
14023
b055a075999a set sample aspect ratio
lorenm
parents: 13965
diff changeset
321 mod->param.vui.i_sar_width = d_width*height;
b055a075999a set sample aspect ratio
lorenm
parents: 13965
diff changeset
322 mod->param.vui.i_sar_height = d_height*width;
15590
e848b20cd449 sync to x264 r240 (threads)
lorenm
parents: 15557
diff changeset
323 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
324
16366
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
325 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
326 {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
327 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
328 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
329 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
330 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
331 else
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
332 {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
333 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
334 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
335 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
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 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
338 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
339 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
340 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
341 else
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
342 {
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
343 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
344 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
345 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
346 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
347 }
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
348
e054a3c93a26 custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents: 16016
diff changeset
349 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
350 (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
351 (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
352 (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
353 (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
354 (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
355 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
356
15964
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
357 switch(pass) {
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
358 case 0:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
359 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
360 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
361 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
362 case 1:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
363 /* 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
364 if(turbo == 1)
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
365 {
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
366 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
367 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
368 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
369 mod->param.analyse.inter &= ( ~X264_ANALYSE_BSUB16x16 );
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
370 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
371 }
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
372 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
373 {
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
374 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
375 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
376 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
377 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
378 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
379 mod->param.analyse.b_weighted_bipred = 0;
16898
b29f79085d90 sync to x264 r360 (trellis)
lorenm
parents: 16846
diff changeset
380 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
381 }
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_write = 1;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
383 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
384 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
385 case 2:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
386 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
387 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
388 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
389 case 3:
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
390 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
391 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
392 break;
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
393 }
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
394
d244178a3105 x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents: 15744
diff changeset
395 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
396 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
397
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
398 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
399 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
400 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
401 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
402 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
403 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
404 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
405 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
406 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
407 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
408 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
409 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
410 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
411 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
412 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
413 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
414 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
415 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
416 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
417 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
418 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
419 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
420 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
421 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
422 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
423 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
424 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
425 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
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 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
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 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
437 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
438 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
439 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
440 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
441
17659
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17523
diff changeset
442 if (mod->param.i_bframe > 1 && mod->param.b_bframe_pyramid)
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17523
diff changeset
443 mod->mux->decoder_delay = 2;
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17523
diff changeset
444 else
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17523
diff changeset
445 mod->mux->decoder_delay = mod->param.i_bframe ? 1 : 0;
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17523
diff changeset
446
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
447 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
448 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
451 {
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
452 switch(request){
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
453 case VFCTRL_FLUSH_FRAMES:
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
454 if(bframe)
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
455 while(encode_frame(vf, NULL) > 0);
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
456 return CONTROL_TRUE;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
457 default:
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
458 return CONTROL_UNKNOWN;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
459 }
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
460 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
461
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
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 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
465 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
466 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
467 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
468 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
469 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
470 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
471 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
472 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
473 case IMGFMT_BGR32:
14943
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
474 /* These colorspaces are supported, but they'll just have
4f43e3452b36 sync to x264 171: chroma_me, chroma_qp_offset
lorenm
parents: 14916
diff changeset
475 * 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
476 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
477 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
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
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17902
diff changeset
481 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts)
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
482 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
483 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
484 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
485
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
486 memset(&mod->pic, 0, sizeof(x264_picture_t));
14846
073b10b68565 memory leak
lorenm
parents: 14784
diff changeset
487 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
488 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
489 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
490 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
491 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
492 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
493
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
494 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
495
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
496 return encode_frame(vf, &mod->pic) >= 0;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
497 }
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
498
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
499 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
500 {
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
501 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
502 x264_picture_t pic_out;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
503 x264_nal_t *nal;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
504 int i_nal;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
505 int i_size = 0;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
506 int i;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
507
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
508 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
509 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
510 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
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 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
514 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
515 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
516 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 if(i_size>0) {
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
518 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
519 (pic_out.i_type == X264_TYPE_I
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
520 && frame_ref == 1 && !bframe);
17487
fa17424b4c7b change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents: 17402
diff changeset
521 muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
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 }
17659
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17523
diff changeset
523 else
92ac78a93625 Fix video delay when encoding with B-frames.
corey
parents: 17523
diff changeset
524 ++mod->mux->encoder_delay;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
525
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
526 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
527 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
530 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
532 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
533 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 static int vf_open(vf_instance_t *vf, char *args) {
13334
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
536 h264_module_t *mod;
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
537
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
538 vf->config = config;
14878
5723c4b2a2ea fixes for encoding of multiple files
henry
parents: 14846
diff changeset
539 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
540 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
541 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
542 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
543 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
544 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
545
13334
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
546 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
547 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
548 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
549 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
550 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
551 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
552 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
553 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
554
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
555 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
556 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
557
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
558 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
559 "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
560 "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
561 "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
562 "(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
563 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
564 };