diff options
author | jstebbins <[email protected]> | 2012-05-05 18:22:37 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2012-05-05 18:22:37 +0000 |
commit | 06254850dc2c1ec43d57f4d8e2026fa67967d5b9 (patch) | |
tree | c7ff6a64e1310d79f4f17b1a6bfe9aebaf88a958 /libhb | |
parent | 1c8309d77ea303954f8c9e3919c595de54f173f2 (diff) |
libhb: Fix problem with positions of burned-in subs
When cropping and/or scaling, the position of burned-in SSA subs was broken.
Also, when scaling, the position of all other burned-in subs was broken.
Part of this fix is to revert a bit of filter initialization changes that
were made in this commit https://trac.handbrake.fr/changeset/4605
The other part of the fix is to add cropping parameters to the initialization
of the subtitle rendering filter. This filter needs the *original* title
dimensions and the crop values in order to compute the positions properly.
The changes that I am reverting gave it the scaled job dimensions and the
crop values. This was wrong in so many ways it's embarassing :p
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4642 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.h | 1 | ||||
-rw-r--r-- | libhb/cropscale.c | 1 | ||||
-rw-r--r-- | libhb/deblock.c | 1 | ||||
-rw-r--r-- | libhb/decomb.c | 1 | ||||
-rw-r--r-- | libhb/deinterlace.c | 1 | ||||
-rw-r--r-- | libhb/denoise.c | 1 | ||||
-rw-r--r-- | libhb/detelecine.c | 1 | ||||
-rw-r--r-- | libhb/rendersub.c | 26 | ||||
-rw-r--r-- | libhb/rotate.c | 1 | ||||
-rw-r--r-- | libhb/vfr.c | 1 | ||||
-rw-r--r-- | libhb/work.c | 56 |
11 files changed, 16 insertions, 75 deletions
diff --git a/libhb/common.h b/libhb/common.h index 741c32e03..ab1a0c169 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -931,7 +931,6 @@ struct hb_filter_object_s { int id; int enforce_order; - int init_index; char * name; char * settings; diff --git a/libhb/cropscale.c b/libhb/cropscale.c index c11e931ee..11a22a44e 100644 --- a/libhb/cropscale.c +++ b/libhb/cropscale.c @@ -30,7 +30,6 @@ hb_filter_object_t hb_filter_crop_scale = { .id = HB_FILTER_CROP_SCALE, .enforce_order = 1, - .init_index = 0, .name = "Crop and Scale", .settings = NULL, .init = hb_crop_scale_init, diff --git a/libhb/deblock.c b/libhb/deblock.c index 6d1f1aaec..dab622abc 100644 --- a/libhb/deblock.c +++ b/libhb/deblock.c @@ -63,7 +63,6 @@ hb_filter_object_t hb_filter_deblock = { .id = HB_FILTER_DEBLOCK, .enforce_order = 1, - .init_index = 0, .name = "Deblock (pp7)", .settings = NULL, .init = hb_deblock_init, diff --git a/libhb/decomb.c b/libhb/decomb.c index 166d72f16..50773b772 100644 --- a/libhb/decomb.c +++ b/libhb/decomb.c @@ -232,7 +232,6 @@ hb_filter_object_t hb_filter_decomb = { .id = HB_FILTER_DECOMB, .enforce_order = 1, - .init_index = 0, .name = "Decomb", .settings = NULL, .init = hb_decomb_init, diff --git a/libhb/deinterlace.c b/libhb/deinterlace.c index 4911f4bbc..49681512c 100644 --- a/libhb/deinterlace.c +++ b/libhb/deinterlace.c @@ -84,7 +84,6 @@ hb_filter_object_t hb_filter_deinterlace = { .id = HB_FILTER_DEINTERLACE, .enforce_order = 1, - .init_index = 0, .name = "Deinterlace (ffmpeg or yadif/mcdeint)", .settings = NULL, .init = hb_deinterlace_init, diff --git a/libhb/denoise.c b/libhb/denoise.c index 48addf8e9..dfc58863d 100644 --- a/libhb/denoise.c +++ b/libhb/denoise.c @@ -46,7 +46,6 @@ hb_filter_object_t hb_filter_denoise = { .id = HB_FILTER_DENOISE, .enforce_order = 1, - .init_index = 0, .name = "Denoise (hqdn3d)", .settings = NULL, .init = hb_denoise_init, diff --git a/libhb/detelecine.c b/libhb/detelecine.c index 0ec02303a..0437730f2 100644 --- a/libhb/detelecine.c +++ b/libhb/detelecine.c @@ -98,7 +98,6 @@ hb_filter_object_t hb_filter_detelecine = { .id = HB_FILTER_DETELECINE, .enforce_order = 1, - .init_index = 0, .name = "Detelecine (pullup)", .settings = NULL, .init = hb_detelecine_init, diff --git a/libhb/rendersub.c b/libhb/rendersub.c index 40eaba5fe..4032a48df 100644 --- a/libhb/rendersub.c +++ b/libhb/rendersub.c @@ -62,7 +62,6 @@ hb_filter_object_t hb_filter_render_sub = { .id = HB_FILTER_RENDER_SUB, .enforce_order = 1, - .init_index = 1, .name = "Subtitle renderer", .settings = NULL, .init = hb_rendersub_init, @@ -268,9 +267,6 @@ static int vobsub_init( hb_filter_object_t * filter, { hb_filter_private_t * pv = filter->private_data; - // VOBSUB render filter has no settings - memcpy( pv->crop, init->crop, sizeof( int[4] ) ); - pv->sub_list = hb_list_init(); return 0; @@ -419,8 +415,6 @@ static int ssa_init( hb_filter_object_t * filter, { hb_filter_private_t * pv = filter->private_data; - memcpy( pv->crop, init->crop, sizeof( int[4] ) ); - pv->ssa = ass_library_init(); if ( !pv->ssa ) { hb_error( "decssasub: libass initialization failed\n" ); @@ -481,13 +475,17 @@ static int ssa_init( hb_filter_object_t * filter, ass_process_codec_private( pv->ssaTrack, (char *)filter->subtitle->extradata, filter->subtitle->extradata_size ); - int width = init->width - ( init->crop[2] + init->crop[3] ); - int height = init->height - ( init->crop[0] + init->crop[1] ); + int width = init->width - ( pv->crop[2] + pv->crop[3] ); + int height = init->height - ( pv->crop[0] + pv->crop[1] ); ass_set_frame_size( pv->renderer, width, height); double par = (double)init->par_width / init->par_height; ass_set_aspect_ratio( pv->renderer, 1, par ); + // libass will take care of positioning for us, so we don't need to + // compensate for crop. + pv->crop[0] = pv->crop[1] = pv->crop[2] = pv->crop[3] = 0; + return 0; } @@ -600,9 +598,6 @@ static int pgssub_init( hb_filter_object_t * filter, { hb_filter_private_t * pv = filter->private_data; - // PGS render filter has no settings - memcpy( pv->crop, init->crop, sizeof( int[4] ) ); - pv->sub_list = hb_list_init(); return 0; @@ -661,6 +656,15 @@ static int hb_rendersub_init( hb_filter_object_t * filter, hb_subtitle_t *subtitle; int ii; + if( filter->settings ) + { + sscanf( filter->settings, "%d:%d:%d:%d", + &pv->crop[0], + &pv->crop[1], + &pv->crop[2], + &pv->crop[3]); + } + // Find the subtitle we need for( ii = 0; ii < hb_list_count(init->job->title->list_subtitle); ii++ ) { diff --git a/libhb/rotate.c b/libhb/rotate.c index a96e6927d..5f9558764 100644 --- a/libhb/rotate.c +++ b/libhb/rotate.c @@ -46,7 +46,6 @@ hb_filter_object_t hb_filter_rotate = { .id = HB_FILTER_ROTATE, .enforce_order = 0, - .init_index = 2, .name = "Rotate (rotate & flip image axes)", .settings = NULL, .init = hb_rotate_init, diff --git a/libhb/vfr.c b/libhb/vfr.c index 7c70c21d4..9c3e2e2a8 100644 --- a/libhb/vfr.c +++ b/libhb/vfr.c @@ -46,7 +46,6 @@ hb_filter_object_t hb_filter_vfr = { .id = HB_FILTER_VFR, .enforce_order = 1, - .init_index = 0, .name = "Framerate Shaper", .settings = NULL, .init = hb_vfr_init, diff --git a/libhb/work.c b/libhb/work.c index f237a0a9b..50596093f 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -504,47 +504,6 @@ void correct_framerate( hb_job_t * job ) interjob->vrate_base = job->vrate_base; } -void hb_filter_init_next( hb_list_t * list, int *score, int *ret_pos ) -{ - int count = hb_list_count( list ); - int pos = *ret_pos + 1; - int ii = 0; - if ( pos == 0 ) - { - hb_filter_object_t * filter = hb_list_item( list, pos ); - if ( filter->init_index == *score ) - { - *ret_pos = pos; - return; - } - pos++; - } - while (1) - { - if ( pos == count ) - { - pos = 0; - (*score)++; - ii = 0; - } - hb_filter_object_t * filter = hb_list_item( list, pos ); - if ( filter->init_index == *score ) - { - *ret_pos = pos; - return; - } - pos++; - ii++; - if (ii > count) - { - // This is an error that should never happen - hb_error("internal error during filter initialization"); - *ret_pos = -1; - return; - } - } -} - /** * Job initialization rountine. * Initializes fifos. @@ -723,7 +682,6 @@ static void do_job( hb_job_t * job ) if( job->list_filter && hb_list_count( job->list_filter ) ) { hb_filter_init_t init; - int pos = -1, score = 0; init.job = job; init.pix_fmt = PIX_FMT_YUV420P; @@ -737,19 +695,7 @@ static void do_job( hb_job_t * job ) init.cfr = 0; for( i = 0; i < hb_list_count( job->list_filter ); i++ ) { - // Some filters need to be initialized in a different order - // than they are executed in the pipeline. e.g. rendersub - // needs to be initialized after cropscale so that it knows - // the crop settings, but it needs to be executed before - // cropscale. so hb_filter_init_next() finds returns the - // position of filters in initialization order. - hb_filter_init_next( job->list_filter, &score, &pos ); - if( pos == -1) - { - // This is an error that should never happen! - break; - } - hb_filter_object_t * filter = hb_list_item( job->list_filter, pos ); + hb_filter_object_t * filter = hb_list_item( job->list_filter, i ); if( filter->init( filter, &init ) ) { hb_log( "Failure to initialise filter '%s', disabling", |