summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbrjake <[email protected]>2009-10-31 15:09:22 +0000
committerjbrjake <[email protected]>2009-10-31 15:09:22 +0000
commit67cbec53dffe1ef8acf1e0bbe63514c980ee79a2 (patch)
treea9830881a000a017da3060a70184cce46ec67a51
parentedd87e0b7cbe627e7f13f959a2a6cef2cab765c3 (diff)
Adds a parity parameter to detelecine and rewires it in decomb, so that TFF can be set for non-MPEG-2 sources that don't include parity flags, which will be falsely autodetected as BFF.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2903 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/decomb.c5
-rw-r--r--libhb/detelecine.c24
-rw-r--r--test/test.c4
3 files changed, 25 insertions, 8 deletions
diff --git a/libhb/decomb.c b/libhb/decomb.c
index fc5e863b8..370f18e17 100644
--- a/libhb/decomb.c
+++ b/libhb/decomb.c
@@ -1644,7 +1644,7 @@ hb_filter_private_t * hb_decomb_init( int pix_fmt,
if( settings )
{
- sscanf( settings, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
+ sscanf( settings, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
&pv->mode,
&pv->spatial_metric,
&pv->motion_threshold,
@@ -1659,7 +1659,8 @@ hb_filter_private_t * hb_decomb_init( int pix_fmt,
&pv->erosion_threshold,
&pv->noise_threshold,
&pv->maximum_search_distance,
- &pv->post_processing );
+ &pv->post_processing,
+ &pv->parity );
}
pv->cpu_count = hb_get_cpu_count();
diff --git a/libhb/detelecine.c b/libhb/detelecine.c
index 5262b6132..202103828 100644
--- a/libhb/detelecine.c
+++ b/libhb/detelecine.c
@@ -60,6 +60,7 @@ struct pullup_context
int metric_plane;
int strict_breaks;
int strict_pairs;
+ int parity;
/* Internal data */
struct pullup_field *first, *last, *head;
struct pullup_buffer *buffers;
@@ -838,16 +839,18 @@ hb_filter_private_t * hb_detelecine_init( int pix_fmt,
ctx->junk_top = ctx->junk_bottom = 4;
ctx->strict_breaks = -1;
ctx->metric_plane = 0;
-
+ ctx->parity = -1;
+
if( settings )
{
- sscanf( settings, "%d:%d:%d:%d:%d:%d",
+ sscanf( settings, "%d:%d:%d:%d:%d:%d:%d",
&ctx->junk_left,
&ctx->junk_right,
&ctx->junk_top,
&ctx->junk_bottom,
&ctx->strict_breaks,
- &ctx->metric_plane );
+ &ctx->metric_plane,
+ &ctx->parity );
}
ctx->format = PULLUP_FMT_Y;
@@ -947,12 +950,25 @@ int hb_detelecine_work( const hb_buffer_t * buf_in,
memcpy( buf->planes[2], pv->pic_in.data[2],
pv->width[2] * pv->height[2] * sizeof(uint8_t) );
- /* Submit buffer fields based on buffer flags */
+ /* Submit buffer fields based on buffer flags.
+ Detelecine assumes BFF when the TFF flag isn't present. */
int parity = 1;
if( buf_in->flags & PIC_FLAG_TOP_FIELD_FIRST )
{
+ /* Source signals TFF */
parity = 0;
}
+ else if( ctx->parity == 0 )
+ {
+ /* Many non-MPEG-2 sources lack parity flags even though
+ they are TFF, so this allow users to override. */
+ parity = 0;
+ }
+ if( ctx->parity == 1 )
+ {
+ /* Override autodetected parity with BFF */
+ parity = 1;
+ }
pullup_submit_field( ctx, buf, parity );
pullup_submit_field( ctx, buf, parity^1 );
if( buf_in->flags & PIC_FLAG_REPEAT_FIRST_FIELD )
diff --git a/test/test.c b/test/test.c
index 7b5f11b23..913b72372 100644
--- a/test/test.c
+++ b/test/test.c
@@ -2305,12 +2305,12 @@ static void ShowHelp()
" or\n"
" <fast/slow/slower>\n"
" -5, --decomb Selectively deinterlaces when it detects combing\n"
- " <MO:ME:MT:ST:BT:BX:BY> (default: 1:2:6:9:80:16:16)\n"
+ " <MO:ME:MT:ST:BT:BX:BY:FD> (default: 1:2:6:9:80:16:16:-1)\n"
" -9, --detelecine Detelecine (ivtc) video with pullup filter\n"
" Note: this filter drops duplicate frames to\n"
" restore the pre-telecine framerate, unless you\n"
" specify a constant framerate (--rate 29.97)\n"
- " <L:R:T:B:SB:MP> (default 1:1:4:4:0:0)\n"
+ " <L:R:T:B:SB:MP:FD> (default 1:1:4:4:0:0:-1)\n"
" -8, --denoise Denoise video with hqdn3d filter\n"
" <SL:SC:TL:TC> (default 4:3:6:4.5)\n"
" or\n"