annotate libmpcodecs/ve_x264.c @ 14916:68582488a5d6

sync to x264 r150: new option 'b_pyramid'
author lorenm
date Fri, 04 Mar 2005 13:11:01 +0000
parents 5723c4b2a2ea
children 4f43e3452b36
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
1 /*****************************************************************************
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
2 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
3 * - H.264 encoder for mencoder using x264 -
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
4 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
5 * Copyright (C) 2004 LINUX4MEDIA GmbH
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
6 * Copyright (C) 2004 Ark Linux
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
7 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
8 * Written by Bernhard Rosenkraenzer <bero@arklinux.org>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
9 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
11 * it under the terms of the GNU General Public License version 2 as
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
12 * published by the Free Software Foundation, or if, and only if,
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
13 * version 2 is ruled invalid in a court of law, any later version
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
14 * of the GNU General Public License published by the Free Software
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
15 * Foundation.
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
16 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
19 * MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
20 * GNU General Public License for more details.
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
21 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
25 *
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
26 *****************************************************************************/
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
27
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
28 #include <stdio.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
29 #include <stdlib.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
30 #include <string.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
31 #include <errno.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
32
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
33 #include "../config.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
34 #include "../mp_msg.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
35
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
36 #ifdef HAVE_X264
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
37
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
38 #include "m_option.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
39 #include "codec-cfg.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
40 #include "stream.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
41 #include "demuxer.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
42 #include "stheader.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
43
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
44 #include "muxer.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
45
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
46 #include "img_format.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
47 #include "mp_image.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
48 #include "vf.h"
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
49
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
50 #include <x264.h>
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
51
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
52 typedef struct _h264_module_t {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
53 muxer_stream_t *mux;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
54 x264_param_t param;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
55 x264_t * x264;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
56 x264_picture_t pic;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
57 } h264_module_t;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
58
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
59 extern char* passtmpfile;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
60
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
61 static int bitrate = -1;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
62 static int qp_constant = 26;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
63 static int frame_ref = 1;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
64 static int keyint_max = 250;
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
65 static int keyint_min = -1;
13584
17cb9c6a99f6 Adds a parameter 'scenecut', to control the threshold for inserting extra I-frames.
iive
parents: 13496
diff changeset
66 static int scenecut_threshold = 40;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
67 static int bframe = 0;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
68 static int bframe_adaptive = 1;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
69 static int bframe_bias = 0;
14916
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
70 static int bframe_pyramid = 0;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
71 static int deblock = 1;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
72 static int deblockalpha = 0;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
73 static int deblockbeta = 0;
13496
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
74 static int cabac = 1;
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
75 static int cabacidc = -1;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
76 static int p4x4mv = 0;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
77 static int p8x8mv = 1;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
78 static int b8x8mv = 1;
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
79 static int direct_pred = X264_DIRECT_PRED_TEMPORAL;
14759
8c1d40548612 Sync to x264 r134: weighted prediction for B-frames.
lorenm
parents: 14738
diff changeset
80 static int weight_b = 0;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
81 static float ip_factor = 1.4;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
82 static float pb_factor = 1.3;
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
83 static int rc_buffer_size = -1;
14307
2e35259a1558 change rc_init_buffer to be a fraction of total buffer size.
lorenm
parents: 14257
diff changeset
84 static float rc_init_buffer = 0.25;
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
85 static int rc_sens = 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
86 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
87 static int qp_max = 51;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
88 static int qp_step = 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
89 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
90 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
91 static float qblur = 0.5;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
92 static float complexity_blur = 20;
14719
a76f1a68ed75 sync to x264 r129: modified ratecontrol equation.
lorenm
parents: 14468
diff changeset
93 static char *rc_eq = "blurCplx^(1-qComp)";
14411
fba04febec4e x264: disable subq=0 (the huge bitrate penalty wasn't worth the speed),
lorenm
parents: 14307
diff changeset
94 static int subq = 5;
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
95 static int level_idc = 40;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
96 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
97 static int log_level = 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
98
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
99 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
100 {"bitrate", &bitrate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, 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
101 {"qp_constant", &qp_constant, CONF_TYPE_INT, CONF_RANGE, 1, 51, 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
102 {"frameref", &frame_ref, CONF_TYPE_INT, CONF_RANGE, 1, 15, NULL},
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
103 {"keyint", &keyint_max, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL},
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
104 {"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
105 {"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
106 {"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
107 {"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
108 {"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
109 {"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
110 {"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
111 {"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
112 {"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
113 {"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
114 {"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
115 {"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
116 {"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
117 {"nocabac", &cabac, 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
118 {"cabacidc", &cabacidc, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL},
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
119 {"4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
120 {"no4x4mv", &p4x4mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
121 {"8x8mv", &p8x8mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
122 {"no8x8mv", &p8x8mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
123 {"b8x8mv", &b8x8mv, CONF_TYPE_FLAG, 0, 0, 1, NULL},
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
124 {"nob8x8mv", &b8x8mv, CONF_TYPE_FLAG, 0, 1, 0, NULL},
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
125 {"direct_pred", &direct_pred, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
14759
8c1d40548612 Sync to x264 r134: weighted prediction for B-frames.
lorenm
parents: 14738
diff changeset
126 {"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
127 {"noweight_b", &weight_b, 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
128 {"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
129 {"pb_factor", &pb_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
130 {"rc_buffer_size", &rc_buffer_size, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL},
14307
2e35259a1558 change rc_init_buffer to be a fraction of total buffer size.
lorenm
parents: 14257
diff changeset
131 {"rc_init_buffer", &rc_init_buffer, CONF_TYPE_FLOAT, CONF_RANGE, 0, 24000000, 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
132 {"rc_sens", &rc_sens, CONF_TYPE_INT, CONF_RANGE, 0, 100, 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
133 {"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
134 {"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
135 {"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
136 {"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
137 {"rc_eq", &rc_eq, CONF_TYPE_STRING, 0, 0, 0, NULL},
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
138 {"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
139 {"qblur", &qblur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL},
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
140 {"cplx_blur", &complexity_blur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 999, NULL},
14411
fba04febec4e x264: disable subq=0 (the huge bitrate penalty wasn't worth the speed),
lorenm
parents: 14307
diff changeset
141 {"subq", &subq, CONF_TYPE_INT, CONF_RANGE, 1, 5, NULL},
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
142 {"level_idc", &level_idc, CONF_TYPE_INT, CONF_RANGE, 10, 51, 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
143 {"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
144 {"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
145 {"log", &log_level, 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
146 {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
147 };
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
148
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
149 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi);
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
150 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
151
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
152 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
153 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
154 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
155 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
156 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
157
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
158 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
159 mod->param.i_frame_reference = frame_ref;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
160 mod->param.i_keyint_max = keyint_max;
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
161 mod->param.i_keyint_min = keyint_min > 0 ? keyint_min : keyint_max * 2 / 5;
13584
17cb9c6a99f6 Adds a parameter 'scenecut', to control the threshold for inserting extra I-frames.
iive
parents: 13496
diff changeset
162 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
163 mod->param.i_bframe = bframe;
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
164 mod->param.b_bframe_adaptive = bframe_adaptive;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
165 mod->param.i_bframe_bias = bframe_bias;
14916
68582488a5d6 sync to x264 r150: new option 'b_pyramid'
lorenm
parents: 14878
diff changeset
166 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
167 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
168 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
169 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
170 mod->param.b_cabac = cabac;
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
171 mod->param.i_cabac_init_idc = cabacidc;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
172
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
173 mod->param.rc.i_qp_constant = qp_constant;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
174 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
175 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
176 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
177 qp_max = qp_constant;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
178 mod->param.rc.i_qp_min = qp_min;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
179 mod->param.rc.i_qp_max = qp_max;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
180 mod->param.rc.i_qp_step = qp_step;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
181 mod->param.rc.psz_rc_eq = rc_eq;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
182 mod->param.rc.f_qcompress = qcomp;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
183 mod->param.rc.f_qblur = qblur;
13965
b825bd2efe14 sync to x264 r61 (improved 2pass ratecontrol)
lorenm
parents: 13658
diff changeset
184 mod->param.rc.f_complexity_blur = complexity_blur;
13431
15efa8ab93e3 add support for subpel quality refinement option in x264.
iive
parents: 13376
diff changeset
185 mod->param.analyse.i_subpel_refine = subq;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
186 mod->param.rc.psz_stat_out = passtmpfile;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
187 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
188 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
189 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
190 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
191 "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
192 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
193 }
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
194 switch(pass) {
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
195 case 0:
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
196 mod->param.rc.b_stat_write = 0;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
197 mod->param.rc.b_stat_read = 0;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
198 break;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
199 case 1:
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
200 mod->param.rc.b_stat_write = 1;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
201 mod->param.rc.b_stat_read = 0;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
202 break;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
203 case 2:
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
204 mod->param.rc.b_stat_write = 0;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
205 mod->param.rc.b_stat_read = 1;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
206 break;
13496
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
207 case 3:
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
208 mod->param.rc.b_stat_write = 1;
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
209 mod->param.rc.b_stat_read = 1;
0bdcb3eea569 better default parameter,added counterpart option, better names for few options, 3-pass support and improved documentation.
iive
parents: 13431
diff changeset
210 break;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
211 }
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
212 if(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
213 if(rc_buffer_size <= 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
214 rc_buffer_size = bitrate;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
215 mod->param.rc.b_cbr = 1;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
216 mod->param.rc.i_bitrate = bitrate;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
217 mod->param.rc.i_rc_buffer_size = rc_buffer_size;
14307
2e35259a1558 change rc_init_buffer to be a fraction of total buffer size.
lorenm
parents: 14257
diff changeset
218 if(rc_init_buffer > 1)
2e35259a1558 change rc_init_buffer to be a fraction of total buffer size.
lorenm
parents: 14257
diff changeset
219 mod->param.rc.i_rc_init_buffer = rc_init_buffer;
2e35259a1558 change rc_init_buffer to be a fraction of total buffer size.
lorenm
parents: 14257
diff changeset
220 else
2e35259a1558 change rc_init_buffer to be a fraction of total buffer size.
lorenm
parents: 14257
diff changeset
221 mod->param.rc.i_rc_init_buffer = rc_buffer_size * rc_init_buffer;
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
222 mod->param.rc.i_rc_sens = rc_sens;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
223 }
13325
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
224 mod->param.rc.f_ip_factor = ip_factor;
f26d2c9aec04 2pass encoding support for x264(r46).
iive
parents: 13166
diff changeset
225 mod->param.rc.f_pb_factor = pb_factor;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
226 mod->param.analyse.inter = X264_ANALYSE_I4x4;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
227 if(p4x4mv)
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
228 mod->param.analyse.inter |= X264_ANALYSE_PSUB8x8;
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
229 if(p8x8mv)
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
230 mod->param.analyse.inter |= X264_ANALYSE_PSUB16x16;
14257
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
231 if(b8x8mv)
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
232 mod->param.analyse.inter |= X264_ANALYSE_BSUB16x16;
a99ccb34a59c sync to x264 r72.
lorenm
parents: 14023
diff changeset
233 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
234 mod->param.analyse.b_weighted_bipred = weight_b;
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
235
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
237 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
238 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
239 mod->param.i_fps_den = mod->mux->h.dwScale;
14738
408d14601dca x264: expose option "level_idc".
lorenm
parents: 14722
diff changeset
240 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
241 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
242 mod->param.i_log_level = log_level;
14023
b055a075999a set sample aspect ratio
lorenm
parents: 13965
diff changeset
243 mod->param.vui.i_sar_width = d_width*height;
b055a075999a set sample aspect ratio
lorenm
parents: 13965
diff changeset
244 mod->param.vui.i_sar_height = d_height*width;
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
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
247 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
248 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
249 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
250 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
251 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
252 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
253 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
254 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
255 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
256 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
257 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
258 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
259 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
260 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
261 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
262 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
263 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
264 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
265 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
266 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
267 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
268 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
269 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
270 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
271 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
272 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
273 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
274 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
275 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
276 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
277 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
278 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
279 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
280 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
281 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
282 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
283
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
285 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
286 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
287 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
288 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
289
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
290 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
291 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
292
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
293 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
294 {
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
295 switch(request){
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
296 case VFCTRL_FLUSH_FRAMES:
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
297 if(bframe)
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
298 while(encode_frame(vf, NULL) > 0);
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
299 return CONTROL_TRUE;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
300 default:
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
301 return CONTROL_UNKNOWN;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
302 }
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
303 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
304
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
305 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
306 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
307 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
308 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
309 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
310 case IMGFMT_YV12:
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
311 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
312 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
313 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
314 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
315 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
316 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
317 /* 2004/08/05: There seems to be some, but not complete,
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 support for these colorspaces in X264. Better to stay
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 on the safe side for now. */
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
320 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
321 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
322 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
323 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
325 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi)
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
326 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
327 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
328 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
329
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
330 memset(&mod->pic, 0, sizeof(x264_picture_t));
14846
073b10b68565 memory leak
lorenm
parents: 14784
diff changeset
331 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
332 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
333 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
334 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
335 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
336 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
337
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
338 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
339
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
340 return encode_frame(vf, &mod->pic) >= 0;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
341 }
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
342
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
343 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
344 {
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
345 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
346 x264_picture_t pic_out;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
347 x264_nal_t *nal;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
348 int i_nal;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
349 int i_size = 0;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
350 int i;
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
351
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
352 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
353 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
354 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
355 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
356
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
357 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
358 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
359 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
360 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
361 if(i_size>0) {
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
362 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
363 (pic_out.i_type == X264_TYPE_I
14468
05518b274cdf sync to x264 r93:
lorenm
parents: 14411
diff changeset
364 && frame_ref == 1 && !bframe);
13658
8c93573e0cdf Mark I-frames as seekable only if we encode with one reference frame, IDR are always seekable
iive
parents: 13584
diff changeset
365 muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0);
13166
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
366 }
14784
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
367
53d306774ce2 sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents: 14759
diff changeset
368 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
369 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
370
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
371 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
372 {
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
373 // FIXME: flush delayed frames
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
374 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
375 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
376 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
377
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff changeset
378 static int vf_open(vf_instance_t *vf, char *args) {
13334
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
379 h264_module_t *mod;
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
380
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
381 vf->config = config;
14878
5723c4b2a2ea fixes for encoding of multiple files
henry
parents: 14846
diff changeset
382 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
383 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
384 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
385 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
386 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
387 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
388
13334
04f7b5e75785 fix compile on gcc 2.95.3
iive
parents: 13325
diff changeset
389 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
390 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
391 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
392 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
393 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
394 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
395 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
396 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
397
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
399 }
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 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
402 "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
403 "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
404 "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
405 "(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
406 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
407 };
d198f255bee9 x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, 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 #endif