xine-lib 1.2.11
Macros | Functions
tvtime.c File Reference
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <math.h>
#include <stdint.h>
#include "speedy.h"
#include "deinterlace.h"
#include "pulldown.h"
#include "tvtime.h"

Macros

#define PULLDOWN_ERROR_THRESHOLD   2
 

Functions

static void pulldown_merge_fields (uint8_t *output, uint8_t *topfield, uint8_t *botfield, int width, int frame_height, int fieldstride, int outstride)
 
static void calculate_pulldown_score_vektor (tvtime_t *tvtime, uint8_t *curframe, uint8_t *lastframe, int instride, int frame_height, int width)
 
int tvtime_build_deinterlaced_frame (tvtime_t *tvtime, uint8_t *output, uint8_t *curframe, uint8_t *lastframe, uint8_t *secondlastframe, int bottom_field, int second_field, int width, int frame_height, int instride, int outstride)
 
int tvtime_build_copied_field (tvtime_t *tvtime, uint8_t *output, uint8_t *curframe, int bottom_field, int width, int frame_height, int instride, int outstride)
 
tvtime_ttvtime_new_context (void)
 
void tvtime_reset_context (tvtime_t *tvtime)
 

Macro Definition Documentation

◆ PULLDOWN_ERROR_THRESHOLD

#define PULLDOWN_ERROR_THRESHOLD   2

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. This is how many predictions have to be incorrect before we fall back to video mode. Right now, if we mess up, we jump to video mode immediately.

Function Documentation

◆ calculate_pulldown_score_vektor()

static void calculate_pulldown_score_vektor ( tvtime_t tvtime,
uint8_t *  curframe,
uint8_t *  lastframe,
int  instride,
int  frame_height,
int  width 
)
static

◆ pulldown_merge_fields()

static void pulldown_merge_fields ( uint8_t *  output,
uint8_t *  topfield,
uint8_t *  botfield,
int  width,
int  frame_height,
int  fieldstride,
int  outstride 
)
static

Explination of the loop:

We want to build frames so that they look like this: Top field: Bot field: Copy Double Interp Copy Copy Interp Interp Copy Copy –



Copy Interp Interp Copy Copy Interp Double Copy

So, say a frame is n high. For the bottom field, the first scanline is blank (special case). For the top field, the final scanline is blank (special case). For the rest of the scanlines, we alternate between Copy then Interpolate.

To do the loop, I go 'Interp then Copy', and handle the first copy outside the loop for both top and bottom. The top field therefore handles n-2 scanlines in the loop. The bot field handles n-2 scanlines in the loop.

What we pass to the deinterlacing routines:

Each deinterlacing routine can require data from up to four fields. The current field is being output is Field 4:

| Field 3 | Field 2 | Field 1 | Field 0 | | | T2 | | T0 | | M3 | | M1 | | | | B2 | | B0 | | NX3 | | NX1 | |

So, since we currently get frames not individual fields from V4L, there are two possibilities for where these come from:

CASE 1: Deinterlacing the top field: | Field 4 | Field 3 | Field 2 | Field 1 | Field 0 | | T4 | | T2 | | T0 | | | M3 | | M1 | | | B4 | | B2 | | B0 | [– secondlast –] [– lastframe –] [– curframe –]

CASE 2: Deinterlacing the bottom field: | Field 4 | Field 3 | Field 2 | Field 1 | Field 0 | | T4 | | T2 | | T0 | | | M3 | | M1 | | | B4 | | B2 | | B0 | ndlast –] [– lastframe –] [– curframe –]

So, in case 1, we need the previous 2 frames as well as the current frame, and in case 2, we only need the previous frame, since the current frame contains both Field 3 and Field 4.

References blit_packed422_scanline, and width.

Referenced by tvtime_build_deinterlaced_frame().

◆ tvtime_build_copied_field()

int tvtime_build_copied_field ( tvtime_t tvtime,
uint8_t *  output,
uint8_t *  curframe,
int  bottom_field,
int  width,
int  frame_height,
int  instride,
int  outstride 
)

◆ tvtime_build_deinterlaced_frame()

int tvtime_build_deinterlaced_frame ( tvtime_t tvtime,
uint8_t *  output,
uint8_t *  curframe,
uint8_t *  lastframe,
uint8_t *  secondlastframe,
int  bottom_field,
int  second_field,
int  width,
int  frame_height,
int  instride,
int  outstride 
)

◆ tvtime_new_context()

tvtime_t * tvtime_new_context ( void  )

◆ tvtime_reset_context()

void tvtime_reset_context ( tvtime_t tvtime)