xine-lib 1.2.13-20230125hg15249
Macros | Functions | Variables
pulldown.c File Reference
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <stdint.h>
#include "pulldown.h"

Macros

#define HISTORY_SIZE   5
 
#define MAXUP(a, b)   ((a) = ((a)>(b)) ? (a) : (b))
 

Functions

int determine_pulldown_offset (int top_repeat, int bot_repeat, int tff, int last_offset)
 
int determine_pulldown_offset_history (int top_repeat, int bot_repeat, int tff, int *realbest)
 
int determine_pulldown_offset_history_new (int top_repeat, int bot_repeat, int tff, int predicted)
 
int determine_pulldown_offset_short_history_new (int top_repeat, int bot_repeat, int tff, int predicted)
 
int determine_pulldown_offset_dalias (pulldown_metrics_t *old_peak, pulldown_metrics_t *old_relative, pulldown_metrics_t *old_mean, pulldown_metrics_t *new_peak, pulldown_metrics_t *new_relative, pulldown_metrics_t *new_mean)
 
void diff_factor_packed422_frame (pulldown_metrics_t *peak, pulldown_metrics_t *rel, pulldown_metrics_t *mean, uint8_t *old, uint8_t *new, int w, int h, int os, int ns)
 
int pulldown_source (int action, int bottom_field)
 
int pulldown_drop (int action, int bottom_field)
 

Variables

static const int tff_top_pattern [] = { 0, 1, 0, 0, 0 }
 
static const int tff_bot_pattern [] = { 0, 0, 0, 1, 0 }
 
static const int bff_top_pattern [] = { 0, 0, 0, 1, 0 }
 
static const int bff_bot_pattern [] = { 0, 1, 0, 0, 0 }
 
static int tophistory [5]
 
static int bothistory [5]
 
static int tophistory_diff [5]
 
static int bothistory_diff [5]
 
static int histpos = 0
 
static int reference = 0
 

Macro Definition Documentation

◆ HISTORY_SIZE

#define HISTORY_SIZE   5

◆ MAXUP

#define MAXUP ( a,
b )   ((a) = ((a)>(b)) ? (a) : (b))

Function Documentation

◆ determine_pulldown_offset()

int determine_pulldown_offset ( int top_repeat,
int bot_repeat,
int tff,
int last_offset )

Flag Pattern Treat as

on DVD last offset

T B T bff 3 B T bff 4 B T B tff 3 T B tff 4

Detect our pattern.

Truth table:

ref repeat, frame repeat valid ===========+==============+======= 0 0 -> 1 0 1 -> 1 1 0 -> 0 1 1 -> 1

Check if the 3:2 pulldown pattern we previously decided on is valid for this set. If so, we use that.

References bff_bot_pattern, bff_top_pattern, PULLDOWN_SEQ_AA, PULLDOWN_SEQ_DD, tff_bot_pattern, and tff_top_pattern.

◆ determine_pulldown_offset_dalias()

int determine_pulldown_offset_dalias ( pulldown_metrics_t * old_peak,
pulldown_metrics_t * old_relative,
pulldown_metrics_t * old_mean,
pulldown_metrics_t * new_peak,
pulldown_metrics_t * new_relative,
pulldown_metrics_t * new_mean )

◆ determine_pulldown_offset_history()

int determine_pulldown_offset_history ( int top_repeat,
int bot_repeat,
int tff,
int * realbest )

◆ determine_pulldown_offset_history_new()

int determine_pulldown_offset_history_new ( int top_repeat,
int bot_repeat,
int tff,
int predicted )

We have a valid sequence, but it doesn't match our prediction. Return the first 'valid' sequence in the list.

The predicted phase is still valid.

References bothistory, bothistory_diff, HISTORY_SIZE, histpos, reference, tff_bot_pattern, tff_top_pattern, tophistory, and tophistory_diff.

◆ determine_pulldown_offset_short_history_new()

int determine_pulldown_offset_short_history_new ( int top_repeat,
int bot_repeat,
int tff,
int predicted )

We have a valid sequence, but it doesn't match our prediction. Return the first 'valid' sequence in the list.

The predicted phase is still valid.

References bothistory, bothistory_diff, HISTORY_SIZE, histpos, reference, tff_bot_pattern, tff_top_pattern, tophistory, and tophistory_diff.

Referenced by tvtime_build_deinterlaced_frame().

◆ diff_factor_packed422_frame()

void diff_factor_packed422_frame ( pulldown_metrics_t * peak,
pulldown_metrics_t * rel,
pulldown_metrics_t * mean,
uint8_t * old,
uint8_t * new,
int w,
int h,
int os,
int ns )

◆ pulldown_drop()

int pulldown_drop ( int action,
int bottom_field )

◆ pulldown_source()

int pulldown_source ( int action,
int bottom_field )

Returns 1 if the source is the previous field, 0 if it is the next field, for the given action.

References PULLDOWN_SEQ_AA, PULLDOWN_SEQ_AB, PULLDOWN_SEQ_BC, PULLDOWN_SEQ_CC, and PULLDOWN_SEQ_DD.

Referenced by tvtime_build_deinterlaced_frame().

Variable Documentation

◆ bff_bot_pattern

const int bff_bot_pattern[] = { 0, 1, 0, 0, 0 }
static

◆ bff_top_pattern

const int bff_top_pattern[] = { 0, 0, 0, 1, 0 }
static

◆ bothistory

int bothistory[5]
static

◆ bothistory_diff

int bothistory_diff[5]
static

◆ histpos

int histpos = 0
static

◆ reference

int reference = 0
static

◆ tff_bot_pattern

const int tff_bot_pattern[] = { 0, 0, 0, 1, 0 }
static

◆ tff_top_pattern

const int tff_top_pattern[] = { 0, 1, 0, 0, 0 }
static

Copyright (C) 2001, 2002, 2003 Billy Biggs vekto.nosp@m.r@du.nosp@m.mbter.nosp@m.m.ne.nosp@m.t.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA. scratch paper:

A A A B B C C C D D [T B T][B T][B T B][T B] [1 1][2 2][3 3][4 4][5 5] [C C] [M M][C C][C C] D A A A B B C C C D

Top 1 : Drop Bot 1 : Show Top 2 : Drop Bot 2 : Drop Top 3 : Merge Bot 3 : Drop Top 4 : Show Bot 4 : Drop Top 5 : Drop Bot 5 : Show

A A 1 A B 2 B C 4 C C 8 D D 16

D D A A A B B C C C D D A A A +---------— [ ] [* * ] | 1 top AA [ * *] | 0 AA bottom AA

[ ] [* * ] | 1 top AB [* * ] | 1 AB bottom AB

[ ] [ * *] | 0 top BC [* * ] | 1 BC bottom BC

[ ] [ * *] | 0 top CC [ * *] | 0 CC bottom CC

[ ] [* * ] | 1 top DD [ * *] | 0 DD bottom DD

                [* *  ]    | 1    top      AA
                  [  * *]  | 0 AA bottom   AA

Referenced by determine_pulldown_offset(), determine_pulldown_offset_history_new(), and determine_pulldown_offset_short_history_new().

◆ tophistory

int tophistory[5]
static

◆ tophistory_diff

int tophistory_diff[5]
static