xine-lib 1.2.13-20230125hg15249
|
#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_t * | tvtime_new_context (void) |
void | tvtime_reset_context (tvtime_t *tvtime) |
#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.
Referenced by tvtime_build_deinterlaced_frame().
|
static |
References diff_factor_packed422_scanline, tvtime_t::last_botdiff, tvtime_t::last_topdiff, and width.
Referenced by tvtime_build_deinterlaced_frame().
|
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().
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 ) |
References blit_packed422_scanline, quarter_blit_vertical_packed422_scanline, and width.
Referenced by deinterlace_build_output_field().
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 ) |
References deinterlace_scanline_data_s::b0, deinterlace_scanline_data_s::b1, deinterlace_scanline_data_s::b2, deinterlace_scanline_data_s::bb0, deinterlace_scanline_data_s::bb1, deinterlace_scanline_data_s::bb2, deinterlace_scanline_data_s::bb3, blit_packed422_scanline, deinterlace_scanline_data_s::bottom_field, deinterlace_scanline_data_s::bytes_left, calculate_pulldown_score_vektor(), deinterlace_method_s::copy_scanline, tvtime_t::curmethod, deinterlace_method_s::deinterlace_frame, determine_pulldown_offset_short_history_new(), deinterlace_frame_data_s::f0, deinterlace_frame_data_s::f1, deinterlace_frame_data_s::f2, tvtime_t::filmmode, deinterlace_method_s::interpolate_scanline, tvtime_t::last_botdiff, tvtime_t::last_topdiff, deinterlace_scanline_data_s::m0, deinterlace_scanline_data_s::m1, deinterlace_scanline_data_s::m2, deinterlace_scanline_data_s::m3, tvtime_t::pderror, tvtime_t::pdlastbusted, tvtime_t::pdoffset, tvtime_t::pulldown_alg, pulldown_drop(), PULLDOWN_ERROR_THRESHOLD, tvtime_t::pulldown_error_wait, pulldown_merge_fields(), PULLDOWN_SEQ_AA, PULLDOWN_SEQ_DD, pulldown_source(), PULLDOWN_VEKTOR, deinterlace_method_s::scanlinemode, deinterlace_scanline_data_s::t0, deinterlace_scanline_data_s::t1, deinterlace_scanline_data_s::t2, deinterlace_scanline_data_s::tt0, deinterlace_scanline_data_s::tt1, deinterlace_scanline_data_s::tt2, deinterlace_scanline_data_s::tt3, and width.
Referenced by deinterlace_build_output_field().
tvtime_t * tvtime_new_context | ( | void | ) |
References tvtime_t::curmethod, NULL, tvtime_t::pulldown_alg, PULLDOWN_NONE, and tvtime_reset_context().
Referenced by deinterlace_open_plugin().
void tvtime_reset_context | ( | tvtime_t * | tvtime | ) |
References tvtime_t::filmmode, tvtime_t::last_botdiff, tvtime_t::last_topdiff, tvtime_t::pderror, tvtime_t::pdlastbusted, tvtime_t::pdoffset, tvtime_t::pulldown_error_wait, and PULLDOWN_SEQ_AA.
Referenced by deinterlace_draw(), and tvtime_new_context().