Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
229fe32c
Commit
229fe32c
authored
Nov 04, 2007
by
Jean-Paul Saman
Committed by
Jean-Paul Saman
Mar 05, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of swscale functionality from trunk.
parent
469e9790
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
948 additions
and
168 deletions
+948
-168
modules/codec/ffmpeg/Modules.am
modules/codec/ffmpeg/Modules.am
+3
-0
modules/codec/ffmpeg/chroma.c
modules/codec/ffmpeg/chroma.c
+2
-0
modules/codec/ffmpeg/deinterlace.c
modules/codec/ffmpeg/deinterlace.c
+150
-0
modules/codec/ffmpeg/ffmpeg.c
modules/codec/ffmpeg/ffmpeg.c
+451
-100
modules/codec/ffmpeg/ffmpeg.h
modules/codec/ffmpeg/ffmpeg.h
+6
-7
modules/codec/ffmpeg/postprocess.c
modules/codec/ffmpeg/postprocess.c
+1
-5
modules/codec/ffmpeg/scale.c
modules/codec/ffmpeg/scale.c
+324
-0
modules/codec/ffmpeg/video.c
modules/codec/ffmpeg/video.c
+8
-55
modules/codec/ffmpeg/video_filter.c
modules/codec/ffmpeg/video_filter.c
+3
-1
No files found.
modules/codec/ffmpeg/Modules.am
View file @
229fe32c
...
@@ -4,11 +4,13 @@ SOURCES_ffmpeg = \
...
@@ -4,11 +4,13 @@ SOURCES_ffmpeg = \
video.c \
video.c \
audio.c \
audio.c \
video_filter.c \
video_filter.c \
deinterlace.c \
chroma.c \
chroma.c \
encoder.c \
encoder.c \
postprocess.c \
postprocess.c \
demux.c \
demux.c \
mux.c \
mux.c \
scale.c \
$(NULL)
$(NULL)
SOURCES_ffmpegaltivec = \
SOURCES_ffmpegaltivec = \
...
@@ -17,6 +19,7 @@ SOURCES_ffmpegaltivec = \
...
@@ -17,6 +19,7 @@ SOURCES_ffmpegaltivec = \
video.c \
video.c \
audio.c \
audio.c \
video_filter.c \
video_filter.c \
deinterlace.c \
chroma.c \
chroma.c \
encoder.c \
encoder.c \
postprocess.c \
postprocess.c \
...
...
modules/codec/ffmpeg/chroma.c
View file @
229fe32c
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include "ffmpeg.h"
#include "ffmpeg.h"
#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE)
void
E_
(
InitLibavcodec
)
(
vlc_object_t
*
p_object
);
void
E_
(
InitLibavcodec
)
(
vlc_object_t
*
p_object
);
static
void
ChromaConversion
(
vout_thread_t
*
,
picture_t
*
,
picture_t
*
);
static
void
ChromaConversion
(
vout_thread_t
*
,
picture_t
*
,
picture_t
*
);
...
@@ -187,3 +188,4 @@ void E_(CloseChroma)( vlc_object_t *p_this )
...
@@ -187,3 +188,4 @@ void E_(CloseChroma)( vlc_object_t *p_this )
}
}
free
(
p_vout
->
chroma
.
p_sys
);
free
(
p_vout
->
chroma
.
p_sys
);
}
}
#endif
modules/codec/ffmpeg/deinterlace.c
0 → 100644
View file @
229fe32c
/*****************************************************************************
* video filter: video filter doing chroma conversion and resizing
* using the ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
* 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 of the License, 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-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc_codec.h>
#include <vlc_filter.h>
/* ffmpeg header */
#ifdef HAVE_FFMPEG_AVCODEC_H
# include <ffmpeg/avcodec.h>
#else
# include <avcodec.h>
#endif
#include "ffmpeg.h"
static
picture_t
*
Deinterlace
(
filter_t
*
p_filter
,
picture_t
*
p_pic
);
/*****************************************************************************
* filter_sys_t : filter descriptor
*****************************************************************************/
struct
filter_sys_t
{
vlc_bool_t
b_resize
;
vlc_bool_t
b_convert
;
vlc_bool_t
b_resize_first
;
vlc_bool_t
b_enable_croppadd
;
es_format_t
fmt_in
;
int
i_src_ffmpeg_chroma
;
es_format_t
fmt_out
;
int
i_dst_ffmpeg_chroma
;
AVPicture
tmp_pic
;
};
/*****************************************************************************
* OpenDeinterlace: probe the filter and return score
*****************************************************************************/
int
E_
(
OpenDeinterlace
)(
vlc_object_t
*
p_this
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
;
/* Check if we can handle that formats */
if
(
E_
(
GetFfmpegChroma
)(
p_filter
->
fmt_in
.
video
.
i_chroma
)
<
0
)
{
return
VLC_EGENERIC
;
}
/* Allocate the memory needed to store the decoder's structure */
if
(
(
p_filter
->
p_sys
=
p_sys
=
(
filter_sys_t
*
)
malloc
(
sizeof
(
filter_sys_t
))
)
==
NULL
)
{
msg_Err
(
p_filter
,
"out of memory"
);
return
VLC_EGENERIC
;
}
/* Misc init */
p_sys
->
i_src_ffmpeg_chroma
=
E_
(
GetFfmpegChroma
)(
p_filter
->
fmt_in
.
video
.
i_chroma
);
p_filter
->
pf_video_filter
=
Deinterlace
;
msg_Dbg
(
p_filter
,
"deinterlacing"
);
/* libavcodec needs to be initialized for some chroma conversions */
E_
(
InitLibavcodec
)(
p_this
);
return
VLC_SUCCESS
;
}
/*****************************************************************************
* CloseDeinterlace: clean up the filter
*****************************************************************************/
void
E_
(
CloseDeinterlace
)(
vlc_object_t
*
p_this
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
free
(
p_sys
);
}
/*****************************************************************************
* Do the processing here
*****************************************************************************/
static
picture_t
*
Deinterlace
(
filter_t
*
p_filter
,
picture_t
*
p_pic
)
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
AVPicture
src_pic
,
dest_pic
;
picture_t
*
p_pic_dst
;
int
i
;
/* Request output picture */
p_pic_dst
=
p_filter
->
pf_vout_buffer_new
(
p_filter
);
if
(
!
p_pic_dst
)
{
msg_Warn
(
p_filter
,
"can't get output picture"
);
return
NULL
;
}
/* Prepare the AVPictures for the conversion */
for
(
i
=
0
;
i
<
p_pic
->
i_planes
;
i
++
)
{
src_pic
.
data
[
i
]
=
p_pic
->
p
[
i
].
p_pixels
;
src_pic
.
linesize
[
i
]
=
p_pic
->
p
[
i
].
i_pitch
;
}
for
(
i
=
0
;
i
<
p_pic_dst
->
i_planes
;
i
++
)
{
dest_pic
.
data
[
i
]
=
p_pic_dst
->
p
[
i
].
p_pixels
;
dest_pic
.
linesize
[
i
]
=
p_pic_dst
->
p
[
i
].
i_pitch
;
}
avpicture_deinterlace
(
&
dest_pic
,
&
src_pic
,
p_sys
->
i_src_ffmpeg_chroma
,
p_filter
->
fmt_in
.
video
.
i_width
,
p_filter
->
fmt_in
.
video
.
i_height
);
p_pic_dst
->
date
=
p_pic
->
date
;
p_pic_dst
->
b_force
=
p_pic
->
b_force
;
p_pic_dst
->
i_nb_fields
=
p_pic
->
i_nb_fields
;
p_pic_dst
->
b_progressive
=
VLC_TRUE
;
p_pic_dst
->
b_top_field_first
=
p_pic
->
b_top_field_first
;
p_pic
->
pf_release
(
p_pic
);
return
p_pic_dst
;
}
modules/codec/ffmpeg/ffmpeg.c
View file @
229fe32c
This diff is collapsed.
Click to expand it.
modules/codec/ffmpeg/ffmpeg.h
View file @
229fe32c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* ffmpeg.h: decoder using the ffmpeg library
* ffmpeg.h: decoder using the ffmpeg library
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 the VideoLAN team
* Copyright (C) 2001 the VideoLAN team
* $Id$
* $Id
: f2ea5ef3a73821145591172cfb79c3d8813f66ad
$
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -23,12 +23,6 @@
...
@@ -23,12 +23,6 @@
#include "codecs.h"
/* BITMAPINFOHEADER */
#include "codecs.h"
/* BITMAPINFOHEADER */
#if LIBAVCODEC_BUILD >= 4663
# define LIBAVCODEC_PP
#else
# undef LIBAVCODEC_PP
#endif
struct
picture_t
;
struct
picture_t
;
struct
AVFrame
;
struct
AVFrame
;
struct
AVCodecContext
;
struct
AVCodecContext
;
...
@@ -78,6 +72,8 @@ int E_(OpenCropPadd)( vlc_object_t * );
...
@@ -78,6 +72,8 @@ int E_(OpenCropPadd)( vlc_object_t * );
void
E_
(
CloseFilter
)(
vlc_object_t
*
);
void
E_
(
CloseFilter
)(
vlc_object_t
*
);
int
E_
(
OpenDeinterlace
)(
vlc_object_t
*
);
int
E_
(
OpenDeinterlace
)(
vlc_object_t
*
);
void
E_
(
CloseDeinterlace
)(
vlc_object_t
*
);
void
E_
(
CloseDeinterlace
)(
vlc_object_t
*
);
int
E_
(
OpenScaler
)(
vlc_object_t
*
);
void
E_
(
CloseScaler
)(
vlc_object_t
*
);
/* Postprocessing module */
/* Postprocessing module */
void
*
E_
(
OpenPostproc
)(
decoder_t
*
,
vlc_bool_t
*
);
void
*
E_
(
OpenPostproc
)(
decoder_t
*
,
vlc_bool_t
*
);
...
@@ -297,3 +293,6 @@ N_("<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...
...
@@ -297,3 +293,6 @@ N_("<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...
#define ENC_CHROMA_ELIM_LONGTEXT N_( "Eliminates chrominance blocks when " \
#define ENC_CHROMA_ELIM_LONGTEXT N_( "Eliminates chrominance blocks when " \
"the PSNR isn't much changed (default: 0.0). The H264 specification " \
"the PSNR isn't much changed (default: 0.0). The H264 specification " \
"recommends 7." )
"recommends 7." )
#define SCALEMODE_TEXT N_("Scaling mode")
#define SCALEMODE_LONGTEXT N_("Scaling mode to use.")
modules/codec/ffmpeg/postprocess.c
View file @
229fe32c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* postprocess.c: video postprocessing using the ffmpeg library
* postprocess.c: video postprocessing using the ffmpeg library
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 the VideoLAN team
* Copyright (C) 1999-2001 the VideoLAN team
* $Id$
* $Id
: 2c9471842b31cdcdd4bfad33cff706829f7d72e9
$
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
* Gildas Bazin <gbazin@netcourrier.com>
...
@@ -35,8 +35,6 @@
...
@@ -35,8 +35,6 @@
#include "ffmpeg.h"
#include "ffmpeg.h"
#ifdef LIBAVCODEC_PP
#ifdef HAVE_POSTPROC_POSTPROCESS_H
#ifdef HAVE_POSTPROC_POSTPROCESS_H
# include <postproc/postprocess.h>
# include <postproc/postprocess.h>
#else
#else
...
@@ -265,5 +263,3 @@ static int PPQCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -265,5 +263,3 @@ static int PPQCallback( vlc_object_t *p_this, char const *psz_cmd,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
#endif
/* LIBAVCODEC_PP */
modules/codec/ffmpeg/scale.c
0 → 100644
View file @
229fe32c
This diff is collapsed.
Click to expand it.
modules/codec/ffmpeg/video.c
View file @
229fe32c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* video.c: video decoder using the ffmpeg library
* video.c: video decoder using the ffmpeg library
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 the VideoLAN team
* Copyright (C) 1999-2001 the VideoLAN team
* $Id$
* $Id
: 5376a0d2d02a3ecdf7cb2c4c200d5749e803182b
$
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@videolan.org>
* Gildas Bazin <gbazin@videolan.org>
...
@@ -130,6 +130,8 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
...
@@ -130,6 +130,8 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
return
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
);
return
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
);
case
PIX_FMT_RGBA32
:
case
PIX_FMT_RGBA32
:
return
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
);
return
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
);
case
PIX_FMT_RGBA
:
return
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
);
case
PIX_FMT_GRAY8
:
case
PIX_FMT_GRAY8
:
return
VLC_FOURCC
(
'G'
,
'R'
,
'E'
,
'Y'
);
return
VLC_FOURCC
(
'G'
,
'R'
,
'E'
,
'Y'
);
...
@@ -170,16 +172,12 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
...
@@ -170,16 +172,12 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
}
}
else
else
{
{
#if LIBAVCODEC_BUILD >= 4687
p_dec
->
fmt_out
.
video
.
i_aspect
=
p_dec
->
fmt_out
.
video
.
i_aspect
=
VOUT_ASPECT_FACTOR
*
(
av_q2d
(
p_context
->
sample_aspect_ratio
)
*
VOUT_ASPECT_FACTOR
*
(
av_q2d
(
p_context
->
sample_aspect_ratio
)
*
p_context
->
width
/
p_context
->
height
);
p_context
->
width
/
p_context
->
height
);
p_dec
->
fmt_out
.
video
.
i_sar_num
=
p_context
->
sample_aspect_ratio
.
num
;
p_dec
->
fmt_out
.
video
.
i_sar_num
=
p_context
->
sample_aspect_ratio
.
num
;
p_dec
->
fmt_out
.
video
.
i_sar_den
=
p_context
->
sample_aspect_ratio
.
den
;
p_dec
->
fmt_out
.
video
.
i_sar_den
=
p_context
->
sample_aspect_ratio
.
den
;
#else
p_dec
->
fmt_out
.
video
.
i_aspect
=
VOUT_ASPECT_FACTOR
*
p_context
->
aspect_ratio
;
#endif
if
(
p_dec
->
fmt_out
.
video
.
i_aspect
==
0
)
if
(
p_dec
->
fmt_out
.
video
.
i_aspect
==
0
)
{
{
p_dec
->
fmt_out
.
video
.
i_aspect
=
p_dec
->
fmt_out
.
video
.
i_aspect
=
...
@@ -195,31 +193,20 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
...
@@ -195,31 +193,20 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
p_dec
->
fmt_out
.
video
.
i_frame_rate_base
=
p_dec
->
fmt_out
.
video
.
i_frame_rate_base
=
p_dec
->
fmt_in
.
video
.
i_frame_rate_base
;
p_dec
->
fmt_in
.
video
.
i_frame_rate_base
;
}
}
else
else
if
(
p_context
->
time_base
.
num
>
0
&&
p_context
->
time_base
.
den
>
0
)
#if LIBAVCODEC_BUILD >= 4754
if
(
p_context
->
time_base
.
num
>
0
&&
p_context
->
time_base
.
den
>
0
)
{
{
p_dec
->
fmt_out
.
video
.
i_frame_rate
=
p_context
->
time_base
.
den
;
p_dec
->
fmt_out
.
video
.
i_frame_rate
=
p_context
->
time_base
.
den
;
p_dec
->
fmt_out
.
video
.
i_frame_rate_base
=
p_context
->
time_base
.
num
;
p_dec
->
fmt_out
.
video
.
i_frame_rate_base
=
p_context
->
time_base
.
num
;
}
}
#else
if
(
p_context
->
frame_rate
>
0
&&
p_context
->
frame_rate_base
>
0
)
{
p_dec
->
fmt_out
.
video
.
i_frame_rate
=
p_context
->
frame_rate
;
p_dec
->
fmt_out
.
video
.
i_frame_rate_base
=
p_context
->
frame_rate_base
;
}
#endif
p_pic
=
p_dec
->
pf_vout_buffer_new
(
p_dec
);
p_pic
=
p_dec
->
pf_vout_buffer_new
(
p_dec
);
#ifdef LIBAVCODEC_PP
if
(
p_sys
->
p_pp
&&
p_sys
->
b_pp
&&
!
p_sys
->
b_pp_init
)
if
(
p_sys
->
p_pp
&&
p_sys
->
b_pp
&&
!
p_sys
->
b_pp_init
)
{
{
E_
(
InitPostproc
)(
p_dec
,
p_sys
->
p_pp
,
p_context
->
width
,
E_
(
InitPostproc
)(
p_dec
,
p_sys
->
p_pp
,
p_context
->
width
,
p_context
->
height
,
p_context
->
pix_fmt
);
p_context
->
height
,
p_context
->
pix_fmt
);
p_sys
->
b_pp_init
=
VLC_TRUE
;
p_sys
->
b_pp_init
=
VLC_TRUE
;
}
}
#endif
return
p_pic
;
return
p_pic
;
}
}
...
@@ -271,25 +258,19 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -271,25 +258,19 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
var_Create
(
p_dec
,
"ffmpeg-vismv"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_dec
,
"ffmpeg-vismv"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_dec
,
"ffmpeg-vismv"
,
&
val
);
var_Get
(
p_dec
,
"ffmpeg-vismv"
,
&
val
);
#if LIBAVCODEC_BUILD >= 4698
if
(
val
.
i_int
)
p_sys
->
p_context
->
debug_mv
=
val
.
i_int
;
if
(
val
.
i_int
)
p_sys
->
p_context
->
debug_mv
=
val
.
i_int
;
#endif
var_Create
(
p_dec
,
"ffmpeg-lowres"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_dec
,
"ffmpeg-lowres"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_dec
,
"ffmpeg-lowres"
,
&
val
);
var_Get
(
p_dec
,
"ffmpeg-lowres"
,
&
val
);
#if LIBAVCODEC_BUILD >= 4723
if
(
val
.
i_int
>
0
&&
val
.
i_int
<=
2
)
p_sys
->
p_context
->
lowres
=
val
.
i_int
;
if
(
val
.
i_int
>
0
&&
val
.
i_int
<=
2
)
p_sys
->
p_context
->
lowres
=
val
.
i_int
;
#endif
var_Create
(
p_dec
,
"ffmpeg-skiploopfilter"
,
var_Create
(
p_dec
,
"ffmpeg-skiploopfilter"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_dec
,
"ffmpeg-skiploopfilter"
,
&
val
);
var_Get
(
p_dec
,
"ffmpeg-skiploopfilter"
,
&
val
);
#if LIBAVCODEC_BUILD >= 4758
if
(
val
.
i_int
>
0
)
p_sys
->
p_context
->
skip_loop_filter
=
AVDISCARD_NONREF
;
if
(
val
.
i_int
>
0
)
p_sys
->
p_context
->
skip_loop_filter
=
AVDISCARD_NONREF
;
if
(
val
.
i_int
>
1
)
p_sys
->
p_context
->
skip_loop_filter
=
AVDISCARD_BIDIR
;
if
(
val
.
i_int
>
1
)
p_sys
->
p_context
->
skip_loop_filter
=
AVDISCARD_BIDIR
;
if
(
val
.
i_int
>
2
)
p_sys
->
p_context
->
skip_loop_filter
=
AVDISCARD_NONKEY
;
if
(
val
.
i_int
>
2
)
p_sys
->
p_context
->
skip_loop_filter
=
AVDISCARD_NONKEY
;
if
(
val
.
i_int
>
3
)
p_sys
->
p_context
->
skip_loop_filter
=
AVDISCARD_ALL
;
if
(
val
.
i_int
>
3
)
p_sys
->
p_context
->
skip_loop_filter
=
AVDISCARD_ALL
;
#endif
/* ***** ffmpeg frame skipping ***** */
/* ***** ffmpeg frame skipping ***** */
var_Create
(
p_dec
,
"ffmpeg-hurry-up"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_dec
,
"ffmpeg-hurry-up"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
...
@@ -305,22 +286,16 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -305,22 +286,16 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_sys
->
p_context
->
pix_fmt
!=
PIX_FMT_YUV422P
&&
p_sys
->
p_context
->
pix_fmt
!=
PIX_FMT_YUV422P
&&
/* H264 uses too many reference frames */
/* H264 uses too many reference frames */
p_sys
->
i_codec_id
!=
CODEC_ID_H264
&&
p_sys
->
i_codec_id
!=
CODEC_ID_H264
&&
#if LIBAVCODEC_BUILD >= 4698
!
p_sys
->
p_context
->
debug_mv
)
!
p_sys
->
p_context
->
debug_mv
)
#else
1
)
#endif
{
{
/* Some codecs set pix_fmt only after the 1st frame has been decoded,
/* Some codecs set pix_fmt only after the 1st frame has been decoded,
* so we need to do another check in ffmpeg_GetFrameBuf() */
* so we need to do another check in ffmpeg_GetFrameBuf() */
p_sys
->
b_direct_rendering
=
1
;
p_sys
->
b_direct_rendering
=
1
;
}
}
#ifdef LIBAVCODEC_PP
p_sys
->
p_pp
=
NULL
;
p_sys
->
p_pp
=
NULL
;
p_sys
->
b_pp
=
p_sys
->
b_pp_async
=
p_sys
->
b_pp_init
=
VLC_FALSE
;
p_sys
->
b_pp
=
p_sys
->
b_pp_async
=
p_sys
->
b_pp_init
=
VLC_FALSE
;
p_sys
->
p_pp
=
E_
(
OpenPostproc
)(
p_dec
,
&
p_sys
->
b_pp_async
);
p_sys
->
p_pp
=
E_
(
OpenPostproc
)(
p_dec
,
&
p_sys
->
b_pp_async
);
#endif
/* ffmpeg doesn't properly release old pictures when frames are skipped */
/* ffmpeg doesn't properly release old pictures when frames are skipped */
//if( p_sys->b_hurry_up ) p_sys->b_direct_rendering = 0;
//if( p_sys->b_hurry_up ) p_sys->b_direct_rendering = 0;
...
@@ -354,13 +329,11 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -354,13 +329,11 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_dec
->
fmt_out
.
i_codec
=
ffmpeg_PixFmtToChroma
(
p_context
->
pix_fmt
);
p_dec
->
fmt_out
.
i_codec
=
ffmpeg_PixFmtToChroma
(
p_context
->
pix_fmt
);
/* Setup palette */
/* Setup palette */
#if LIBAVCODEC_BUILD >= 4688
if
(
p_dec
->
fmt_in
.
video
.
p_palette
)
if
(
p_dec
->
fmt_in
.
video
.
p_palette
)
p_sys
->
p_context
->
palctrl
=
p_sys
->
p_context
->
palctrl
=
(
AVPaletteControl
*
)
p_dec
->
fmt_in
.
video
.
p_palette
;
(
AVPaletteControl
*
)
p_dec
->
fmt_in
.
video
.
p_palette
;
else
else
p_sys
->
p_context
->
palctrl
=
&
palette_control
;
p_sys
->
p_context
->
palctrl
=
&
palette_control
;
#endif
/* ***** Open the codec ***** */
/* ***** Open the codec ***** */
vlc_mutex_lock
(
lockval
.
p_address
);
vlc_mutex_lock
(
lockval
.
p_address
);
...
@@ -374,7 +347,6 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -374,7 +347,6 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
vlc_mutex_unlock
(
lockval
.
p_address
);
vlc_mutex_unlock
(
lockval
.
p_address
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) started"
,
p_sys
->
psz_namecodec
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) started"
,
p_sys
->
psz_namecodec
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -602,7 +574,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
...
@@ -602,7 +574,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
if
(
!
p_dec
->
fmt_in
.
video
.
i_aspect
)
if
(
!
p_dec
->
fmt_in
.
video
.
i_aspect
)
{
{
/* Fetch again the aspect ratio in case it changed */
/* Fetch again the aspect ratio in case it changed */
#if LIBAVCODEC_BUILD >= 4687
p_dec
->
fmt_out
.
video
.
i_aspect
=
p_dec
->
fmt_out
.
video
.
i_aspect
=
VOUT_ASPECT_FACTOR
VOUT_ASPECT_FACTOR
*
(
av_q2d
(
p_sys
->
p_context
->
sample_aspect_ratio
)
*
(
av_q2d
(
p_sys
->
p_context
->
sample_aspect_ratio
)
...
@@ -611,10 +582,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
...
@@ -611,10 +582,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
=
p_sys
->
p_context
->
sample_aspect_ratio
.
num
;
=
p_sys
->
p_context
->
sample_aspect_ratio
.
num
;
p_dec
->
fmt_out
.
video
.
i_sar_den
p_dec
->
fmt_out
.
video
.
i_sar_den
=
p_sys
->
p_context
->
sample_aspect_ratio
.
den
;
=
p_sys
->
p_context
->
sample_aspect_ratio
.
den
;
#else
p_dec
->
fmt_out
.
video
.
i_aspect
=
VOUT_ASPECT_FACTOR
*
p_sys
->
p_context
->
aspect_ratio
;
#endif
if
(
p_dec
->
fmt_out
.
video
.
i_aspect
==
0
)
if
(
p_dec
->
fmt_out
.
video
.
i_aspect
==
0
)
{
{
p_dec
->
fmt_out
.
video
.
i_aspect
=
VOUT_ASPECT_FACTOR
p_dec
->
fmt_out
.
video
.
i_aspect
=
VOUT_ASPECT_FACTOR
...
@@ -628,7 +596,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
...
@@ -628,7 +596,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
p_pic
->
date
=
p_sys
->
i_pts
;
p_pic
->
date
=
p_sys
->
i_pts
;
/* interpolate the next PTS */
/* interpolate the next PTS */
#if LIBAVCODEC_BUILD >= 4754
if
(
p_dec
->
fmt_in
.
video
.
i_frame_rate
>
0
&&
if
(
p_dec
->
fmt_in
.
video
.
i_frame_rate
>
0
&&
p_dec
->
fmt_in
.
video
.
i_frame_rate_base
>
0
)
p_dec
->
fmt_in
.
video
.
i_frame_rate_base
>
0
)
{
{
...
@@ -646,16 +613,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
...
@@ -646,16 +613,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
p_block
->
i_rate
/
INPUT_RATE_DEFAULT
/
p_block
->
i_rate
/
INPUT_RATE_DEFAULT
/
(
2
*
p_sys
->
p_context
->
time_base
.
den
);
(
2
*
p_sys
->
p_context
->
time_base
.
den
);
}
}
#else
if
(
p_sys
->
p_context
->
frame_rate
>
0
)
{
p_sys
->
i_pts
+=
I64C
(
1000000
)
*
(
2
+
p_sys
->
p_ff_pic
->
repeat_pict
)
*
p_sys
->
p_context
->
frame_rate_base
*
p_block
->
i_rate
/
INPUT_RATE_DEFAULT
/
(
2
*
p_sys
->
p_context
->
frame_rate
);
}
#endif
if
(
p_sys
->
b_first_frame
)
if
(
p_sys
->
b_first_frame
)
{
{
...
@@ -665,10 +622,8 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
...
@@ -665,10 +622,8 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
}
}
p_pic
->
i_nb_fields
=
2
+
p_sys
->
p_ff_pic
->
repeat_pict
;
p_pic
->
i_nb_fields
=
2
+
p_sys
->
p_ff_pic
->
repeat_pict
;
#if LIBAVCODEC_BUILD >= 4685
p_pic
->
b_progressive
=
!
p_sys
->
p_ff_pic
->
interlaced_frame
;
p_pic
->
b_progressive
=
!
p_sys
->
p_ff_pic
->
interlaced_frame
;
p_pic
->
b_top_field_first
=
p_sys
->
p_ff_pic
->
top_field_first
;
p_pic
->
b_top_field_first
=
p_sys
->
p_ff_pic
->
top_field_first
;
#endif
return
p_pic
;
return
p_pic
;
}
}
...
@@ -694,9 +649,7 @@ void E_(EndVideoDec)( decoder_t *p_dec )
...
@@ -694,9 +649,7 @@ void E_(EndVideoDec)( decoder_t *p_dec )
if
(
p_sys
->
p_ff_pic
)
av_free
(
p_sys
->
p_ff_pic
);
if
(
p_sys
->
p_ff_pic
)
av_free
(
p_sys
->
p_ff_pic
);
#ifdef LIBAVCODEC_PP
E_
(
ClosePostproc
)(
p_dec
,
p_sys
->
p_pp
);
E_
(
ClosePostproc
)(
p_dec
,
p_sys
->
p_pp
);
#endif
free
(
p_sys
->
p_buffer_orig
);
free
(
p_sys
->
p_buffer_orig
);
}
}
...
@@ -792,11 +745,9 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
...
@@ -792,11 +745,9 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
uint8_t
*
p_dst
,
*
p_src
;
uint8_t
*
p_dst
,
*
p_src
;
int
i_src_stride
,
i_dst_stride
;
int
i_src_stride
,
i_dst_stride
;
#ifdef LIBAVCODEC_PP
if
(
p_sys
->
p_pp
&&
p_sys
->
b_pp
)
if
(
p_sys
->
p_pp
&&
p_sys
->
b_pp
)
E_
(
PostprocPict
)(
p_dec
,
p_sys
->
p_pp
,
p_pic
,
p_ff_pic
);
E_
(
PostprocPict
)(
p_dec
,
p_sys
->
p_pp
,
p_pic
,
p_ff_pic
);
else
else
#endif
for
(
i_plane
=
0
;
i_plane
<
p_pic
->
i_planes
;
i_plane
++
)
for
(
i_plane
=
0
;
i_plane
<
p_pic
->
i_planes
;
i_plane
++
)
{
{
p_src
=
p_ff_pic
->
data
[
i_plane
];
p_src
=
p_ff_pic
->
data
[
i_plane
];
...
@@ -831,11 +782,13 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
...
@@ -831,11 +782,13 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
dest_pic
.
data
[
i
]
=
p_pic
->
p
[
i
].
p_pixels
;
dest_pic
.
data
[
i
]
=
p_pic
->
p
[
i
].
p_pixels
;
dest_pic
.
linesize
[
i
]
=
p_pic
->
p
[
i
].
i_pitch
;
dest_pic
.
linesize
[
i
]
=
p_pic
->
p
[
i
].
i_pitch
;
}
}
#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE)
img_convert
(
&
dest_pic
,
PIX_FMT_YUV420P
,
img_convert
(
&
dest_pic
,
PIX_FMT_YUV420P
,
(
AVPicture
*
)
p_ff_pic
,
(
AVPicture
*
)
p_ff_pic
,
p_sys
->
p_context
->
pix_fmt
,
p_sys
->
p_context
->
pix_fmt
,
p_sys
->
p_context
->
width
,
p_sys
->
p_context
->
width
,
p_sys
->
p_context
->
height
);
p_sys
->
p_context
->
height
);
#endif
break
;
break
;
default:
default:
msg_Err
(
p_dec
,
"don't know how to convert chroma %i"
,
msg_Err
(
p_dec
,
"don't know how to convert chroma %i"
,
...
...
modules/codec/ffmpeg/video_filter.c
View file @
229fe32c
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* using the ffmpeg library
* using the ffmpeg library
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 the VideoLAN team
* Copyright (C) 1999-2001 the VideoLAN team
* $Id$
* $Id
: a6d66457c73a31abbe49d51c6f0ef10b6a57234b
$
*
*
* Authors: Gildas Bazin <gbazin@videolan.org>
* Authors: Gildas Bazin <gbazin@videolan.org>
*
*
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include "ffmpeg.h"
#include "ffmpeg.h"
#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE)
void
E_
(
InitLibavcodec
)
(
vlc_object_t
*
p_object
);
void
E_
(
InitLibavcodec
)
(
vlc_object_t
*
p_object
);
static
int
CheckInit
(
filter_t
*
p_filter
);
static
int
CheckInit
(
filter_t
*
p_filter
);
static
picture_t
*
Process
(
filter_t
*
p_filter
,
picture_t
*
p_pic
);
static
picture_t
*
Process
(
filter_t
*
p_filter
,
picture_t
*
p_pic
);
...
@@ -691,3 +692,4 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
...
@@ -691,3 +692,4 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
p_pic
->
pf_release
(
p_pic
);
p_pic
->
pf_release
(
p_pic
);
return
p_pic_dst
;
return
p_pic_dst
;
}
}
#endif
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment