OSDN Git Service
(root)
/
handbrake-jp
/
handbrake-jp-git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
WinGui:
[handbrake-jp/handbrake-jp-git.git]
/
libhb
/
encx264.c
diff --git
a/libhb/encx264.c
b/libhb/encx264.c
index
47f3b5a
..
2a3c2b6
100644
(file)
--- a/
libhb/encx264.c
+++ b/
libhb/encx264.c
@@
-132,8
+132,17
@@
int encx264Init( hb_work_object_t * w, hb_job_t * job )
param.i_height = job->height;
param.i_fps_num = job->vrate;
param.i_fps_den = job->vrate_base;
param.i_height = job->height;
param.i_fps_num = job->vrate;
param.i_fps_den = job->vrate_base;
- param.i_timebase_num = 1;
- param.i_timebase_den = 90000;
+ if ( job->cfr == 1 )
+ {
+ param.i_timebase_num = 0;
+ param.i_timebase_den = 0;
+ param.b_vfr_input = 0;
+ }
+ else
+ {
+ param.i_timebase_num = 1;
+ param.i_timebase_den = 90000;
+ }
/* Disable annexb. Inserts size into nal header instead of start code */
param.b_annexb = 0;
/* Disable annexb. Inserts size into nal header instead of start code */
param.b_annexb = 0;
@@
-149,20
+158,13
@@
int encx264Init( hb_work_object_t * w, hb_job_t * job )
we still want the same keyframe intervals as the 1st pass,
so the 1st pass stats won't conflict on frame decisions. */
hb_interjob_t * interjob = hb_interjob_get( job->h );
we still want the same keyframe intervals as the 1st pass,
so the 1st pass stats won't conflict on frame decisions. */
hb_interjob_t * interjob = hb_interjob_get( job->h );
- param.i_keyint_min = ( interjob->vrate / interjob->vrate_base ) + 1;
- param.i_keyint_max = ( 10 * interjob->vrate / interjob->vrate_base ) + 1;
+ param.i_keyint_max = ( ( 10 * (double)interjob->vrate / (double)interjob->vrate_base ) + 0.5 );
}
else
{
}
else
{
- int fps = job->vrate / job->vrate_base;
-
- /* adjust +1 when fps has remainder to bump
+ /* adjust +0.5 for when fps has remainder to bump
{ 23.976, 29.976, 59.94 } to { 24, 30, 60 } */
{ 23.976, 29.976, 59.94 } to { 24, 30, 60 } */
- if (job->vrate % job->vrate_base)
- fps += 1;
-
- param.i_keyint_min = fps;
- param.i_keyint_max = fps * 10;
+ param.i_keyint_max = ( ( 10 * (double)job->vrate / (double)job->vrate_base ) + 0.5 );
}
}
}
}
@@
-216,18
+218,6
@@
int encx264Init( hb_work_object_t * w, hb_job_t * job )
value++;
}
value++;
}
- if( !( strcmp( name, "b-pyramid" ) ) )
- {
- if( value == NULL || !strcmp( value, "1" ) )
- {
- value = "normal";
- }
- else if( !strcmp( value, "0" ) )
- {
- value = "none";
- }
- }
-
/* Here's where the strings are passed to libx264 for parsing. */
ret = x264_param_parse( ¶m, name, value );
/* Here's where the strings are passed to libx264 for parsing. */
ret = x264_param_parse( ¶m, name, value );
@@
-260,8
+250,9
@@
int encx264Init( hb_work_object_t * w, hb_job_t * job )
job->areBframes = 0;
}
job->areBframes = 0;
}
- if( param.i_keyint_min != 25 || param.i_keyint_max != 250 )
- hb_log("encx264: keyint-min: %i, keyint-max: %i", param.i_keyint_min, param.i_keyint_max);
+ if( param.i_keyint_min != X264_KEYINT_MIN_AUTO || param.i_keyint_max != 250 )
+ hb_log("encx264: min-keyint: %i, keyint: %i", param.i_keyint_min == X264_KEYINT_MIN_AUTO ? param.i_keyint_max / 10 : param.i_keyint_min,
+ param.i_keyint_max);
/* set up the VUI color model & gamma to match what the COLR atom
* set in muxmp4.c says. See libhb/muxmp4.c for notes. */
/* set up the VUI color model & gamma to match what the COLR atom
* set in muxmp4.c says. See libhb/muxmp4.c for notes. */
@@
-344,12
+335,12
@@
int encx264Init( hb_work_object_t * w, hb_job_t * job )
x264_encoder_headers( pv->x264, &nal, &nal_count );
/* Sequence Parameter Set */
x264_encoder_headers( pv->x264, &nal, &nal_count );
/* Sequence Parameter Set */
- memcpy(w->config->h264.sps, nal[
1].p_payload + 4, nal[1
].i_payload - 4);
- w->config->h264.sps_length = nal[
1
].i_payload - 4;
+ memcpy(w->config->h264.sps, nal[
0].p_payload + 4, nal[0
].i_payload - 4);
+ w->config->h264.sps_length = nal[
0
].i_payload - 4;
/* Picture Parameter Set */
/* Picture Parameter Set */
- memcpy(w->config->h264.pps, nal[
2].p_payload + 4, nal[2
].i_payload - 4);
- w->config->h264.pps_length = nal[
2
].i_payload - 4;
+ memcpy(w->config->h264.pps, nal[
1].p_payload + 4, nal[1
].i_payload - 4);
+ w->config->h264.pps_length = nal[
1
].i_payload - 4;
x264_picture_alloc( &pv->pic_in, X264_CSP_I420,
job->width, job->height );
x264_picture_alloc( &pv->pic_in, X264_CSP_I420,
job->width, job->height );
@@
-616,10
+607,12
@@
int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in,
x264_nal_t *nal;
hb_buffer_t *last_buf = NULL;
x264_nal_t *nal;
hb_buffer_t *last_buf = NULL;
- while (
1
)
+ while (
x264_encoder_delayed_frames( pv->x264 )
)
{
x264_encoder_encode( pv->x264, &nal, &i_nal, NULL, &pic_out );
{
x264_encoder_encode( pv->x264, &nal, &i_nal, NULL, &pic_out );
- if ( i_nal <= 0 )
+ if ( i_nal == 0 )
+ continue;
+ if ( i_nal < 0 )
break;
hb_buffer_t *buf = nal_encode( w, &pic_out, i_nal, nal );
break;
hb_buffer_t *buf = nal_encode( w, &pic_out, i_nal, nal );