Commit e3096771 authored by Stephan Hilb's avatar Stephan Hilb

Merge branch 'master' of git://source.ffmpeg.org/ffmpeg

parents 296140eb d55252c3
...@@ -1114,6 +1114,7 @@ CONFIG_LIST=" ...@@ -1114,6 +1114,7 @@ CONFIG_LIST="
gpl gpl
gray gray
hardcoded_tables hardcoded_tables
incompatible_fork_abi
libaacplus libaacplus
libass libass
libbluray libbluray
...@@ -1248,6 +1249,7 @@ ARCH_EXT_LIST=" ...@@ -1248,6 +1249,7 @@ ARCH_EXT_LIST="
HAVE_LIST_PUB=' HAVE_LIST_PUB='
bigendian bigendian
fast_unaligned fast_unaligned
incompatible_fork_abi
' '
HAVE_LIST=" HAVE_LIST="
......
...@@ -84,7 +84,7 @@ static int init_filters(const char *filters_descr) ...@@ -84,7 +84,7 @@ static int init_filters(const char *filters_descr)
char args[512]; char args[512];
int ret; int ret;
AVFilter *abuffersrc = avfilter_get_by_name("abuffer"); AVFilter *abuffersrc = avfilter_get_by_name("abuffer");
AVFilter *abuffersink = avfilter_get_by_name("abuffersink"); AVFilter *abuffersink = avfilter_get_by_name("ffabuffersink");
AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc();
const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 }; const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 };
......
...@@ -84,7 +84,7 @@ static int init_filters(const char *filters_descr) ...@@ -84,7 +84,7 @@ static int init_filters(const char *filters_descr)
char args[512]; char args[512];
int ret; int ret;
AVFilter *buffersrc = avfilter_get_by_name("buffer"); AVFilter *buffersrc = avfilter_get_by_name("buffer");
AVFilter *buffersink = avfilter_get_by_name("buffersink"); AVFilter *buffersink = avfilter_get_by_name("ffbuffersink");
AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc();
enum PixelFormat pix_fmts[] = { PIX_FMT_GRAY8, PIX_FMT_NONE }; enum PixelFormat pix_fmts[] = { PIX_FMT_GRAY8, PIX_FMT_NONE };
......
...@@ -2508,7 +2508,6 @@ the named filter. ...@@ -2508,7 +2508,6 @@ the named filter.
The list of the currently supported filters follows: The list of the currently supported filters follows:
@table @var @table @var
@item decimate
@item denoise3d @item denoise3d
@item detc @item detc
@item dint @item dint
......
...@@ -48,7 +48,7 @@ enum PixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum PixelFormat ...@@ -48,7 +48,7 @@ enum PixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum PixelFormat
} }
} }
for (; *p != PIX_FMT_NONE; p++) { for (; *p != PIX_FMT_NONE; p++) {
best= avcodec_find_best_pix_fmt2(best, *p, target, has_alpha, NULL); best= avcodec_find_best_pix_fmt_of_2(best, *p, target, has_alpha, NULL);
if (*p == target) if (*p == target)
break; break;
} }
...@@ -294,7 +294,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, ...@@ -294,7 +294,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&ofilter->filter, ret = avfilter_graph_create_filter(&ofilter->filter,
avfilter_get_by_name("buffersink"), avfilter_get_by_name("ffbuffersink"),
name, NULL, NULL/*buffersink_params*/, fg->graph); name, NULL, NULL/*buffersink_params*/, fg->graph);
av_freep(&buffersink_params); av_freep(&buffersink_params);
...@@ -377,7 +377,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, ...@@ -377,7 +377,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&ofilter->filter, ret = avfilter_graph_create_filter(&ofilter->filter,
avfilter_get_by_name("abuffersink"), avfilter_get_by_name("ffabuffersink"),
name, NULL, NULL, fg->graph); name, NULL, NULL, fg->graph);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -1606,7 +1606,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c ...@@ -1606,7 +1606,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
buffersink_params->pixel_fmts = pix_fmts; buffersink_params->pixel_fmts = pix_fmts;
ret = avfilter_graph_create_filter(&filt_out, ret = avfilter_graph_create_filter(&filt_out,
avfilter_get_by_name("buffersink"), avfilter_get_by_name("ffbuffersink"),
"ffplay_buffersink", NULL, buffersink_params, graph); "ffplay_buffersink", NULL, buffersink_params, graph);
av_freep(&buffersink_params); av_freep(&buffersink_params);
if (ret < 0) if (ret < 0)
......
...@@ -4512,7 +4512,7 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_ ...@@ -4512,7 +4512,7 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_
#if FF_API_FIND_BEST_PIX_FMT #if FF_API_FIND_BEST_PIX_FMT
/** /**
* @deprecated use avcodec_find_best_pix_fmt2() instead. * @deprecated use avcodec_find_best_pix_fmt_of_2() instead.
* *
* Find the best pixel format to convert to given a certain source pixel * Find the best pixel format to convert to given a certain source pixel
* format. When converting from one pixel format to another, information loss * format. When converting from one pixel format to another, information loss
...@@ -4547,7 +4547,7 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma ...@@ -4547,7 +4547,7 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma
* format. When converting from one pixel format to another, information loss * format. When converting from one pixel format to another, information loss
* may occur. For example, when converting from RGB24 to GRAY, the color * may occur. For example, when converting from RGB24 to GRAY, the color
* information will be lost. Similarly, other losses occur when converting from * information will be lost. Similarly, other losses occur when converting from
* some formats to other formats. avcodec_find_best_pix_fmt2() searches which of * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of
* the given pixel formats should be used to suffer the least amount of loss. * the given pixel formats should be used to suffer the least amount of loss.
* The pixel formats from which it chooses one, are determined by the * The pixel formats from which it chooses one, are determined by the
* pix_fmt_list parameter. * pix_fmt_list parameter.
...@@ -4568,7 +4568,7 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis ...@@ -4568,7 +4568,7 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis
* format and a selection of two destination pixel formats. When converting from * format and a selection of two destination pixel formats. When converting from
* one pixel format to another, information loss may occur. For example, when converting * one pixel format to another, information loss may occur. For example, when converting
* from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when * from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when
* converting from some formats to other formats. avcodec_find_best_pix_fmt2() selects which of * converting from some formats to other formats. avcodec_find_best_pix_fmt_of_2() selects which of
* the given pixel formats should be used to suffer the least amount of loss. * the given pixel formats should be used to suffer the least amount of loss.
* *
* If one of the destination formats is PIX_FMT_NONE the other pixel format (if valid) will be * If one of the destination formats is PIX_FMT_NONE the other pixel format (if valid) will be
...@@ -4580,8 +4580,8 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis ...@@ -4580,8 +4580,8 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis
* dst_pix_fmt2= PIX_FMT_GRAY8; * dst_pix_fmt2= PIX_FMT_GRAY8;
* dst_pix_fmt3= PIX_FMT_RGB8; * dst_pix_fmt3= PIX_FMT_RGB8;
* loss= FF_LOSS_CHROMA; // don't care about chroma loss, so chroma loss will be ignored. * loss= FF_LOSS_CHROMA; // don't care about chroma loss, so chroma loss will be ignored.
* dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, alpha, &loss); * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, alpha, &loss);
* dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt, dst_pix_fmt3, src_pix_fmt, alpha, &loss); * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt, dst_pix_fmt3, src_pix_fmt, alpha, &loss);
* @endcode * @endcode
* *
* @param[in] dst_pix_fmt1 One of the two destination pixel formats to choose from * @param[in] dst_pix_fmt1 One of the two destination pixel formats to choose from
...@@ -4593,8 +4593,19 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis ...@@ -4593,8 +4593,19 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis
* that occurs when converting from src to selected dst pixel format. * that occurs when converting from src to selected dst pixel format.
* @return The best pixel format to convert to or -1 if none was found. * @return The best pixel format to convert to or -1 if none was found.
*/ */
enum PixelFormat avcodec_find_best_pix_fmt_of_2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2,
enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
attribute_deprecated
#if AV_HAVE_INCOMPATIBLE_FORK_ABI
enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat *pix_fmt_list,
enum PixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr);
#else
enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2,
enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
#endif
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
......
...@@ -1343,6 +1343,10 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx, ...@@ -1343,6 +1343,10 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
display_def->y = 0; display_def->y = 0;
display_def->width = bytestream_get_be16(&buf) + 1; display_def->width = bytestream_get_be16(&buf) + 1;
display_def->height = bytestream_get_be16(&buf) + 1; display_def->height = bytestream_get_be16(&buf) + 1;
if (!avctx->width || !avctx->height) {
avctx->width = display_def->width;
avctx->height = display_def->height;
}
if (buf_size < 13) if (buf_size < 13)
return; return;
......
...@@ -529,13 +529,13 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma ...@@ -529,13 +529,13 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma
dst_pix_fmt = PIX_FMT_NONE; /* so first iteration doesn't have to be treated special */ dst_pix_fmt = PIX_FMT_NONE; /* so first iteration doesn't have to be treated special */
for(i = 0; i< FFMIN(PIX_FMT_NB, 64); i++){ for(i = 0; i< FFMIN(PIX_FMT_NB, 64); i++){
if (pix_fmt_mask & (1ULL << i)) if (pix_fmt_mask & (1ULL << i))
dst_pix_fmt = avcodec_find_best_pix_fmt2(dst_pix_fmt, i, src_pix_fmt, has_alpha, loss_ptr); dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt, i, src_pix_fmt, has_alpha, loss_ptr);
} }
return dst_pix_fmt; return dst_pix_fmt;
} }
#endif /* FF_API_FIND_BEST_PIX_FMT */ #endif /* FF_API_FIND_BEST_PIX_FMT */
enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2, enum PixelFormat avcodec_find_best_pix_fmt_of_2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2,
enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
{ {
enum PixelFormat dst_pix_fmt; enum PixelFormat dst_pix_fmt;
...@@ -577,6 +577,20 @@ enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum ...@@ -577,6 +577,20 @@ enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum
return dst_pix_fmt; return dst_pix_fmt;
} }
#if AV_HAVE_INCOMPATIBLE_FORK_ABI
enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat *pix_fmt_list,
enum PixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr){
return avcodec_find_best_pix_fmt_of_list(pix_fmt_list, src_pix_fmt, has_alpha, loss_ptr);
}
#else
enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum PixelFormat dst_pix_fmt2,
enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
{
return avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, has_alpha, loss_ptr);
}
#endif
enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_list, enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_list,
enum PixelFormat src_pix_fmt, enum PixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr){ int has_alpha, int *loss_ptr){
...@@ -585,7 +599,7 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis ...@@ -585,7 +599,7 @@ enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_lis
enum PixelFormat best = PIX_FMT_NONE; enum PixelFormat best = PIX_FMT_NONE;
for(i=0; pix_fmt_list[i] != PIX_FMT_NONE; i++) for(i=0; pix_fmt_list[i] != PIX_FMT_NONE; i++)
best = avcodec_find_best_pix_fmt2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr); best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr);
return best; return best;
} }
......
...@@ -95,8 +95,8 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) ...@@ -95,8 +95,8 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
avfilter_register_all(); avfilter_register_all();
buffersink = avfilter_get_by_name("buffersink"); buffersink = avfilter_get_by_name("ffbuffersink");
abuffersink = avfilter_get_by_name("abuffersink"); abuffersink = avfilter_get_by_name("ffabuffersink");
if (!lavfi->graph_str) if (!lavfi->graph_str)
lavfi->graph_str = av_strdup(avctx->filename); lavfi->graph_str = av_strdup(avctx->filename);
......
...@@ -156,7 +156,6 @@ OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o ...@@ -156,7 +156,6 @@ OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/mp_image.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/mp_image.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/img_format.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/img_format.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_decimate.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_denoise3d.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_denoise3d.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_detc.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_detc.o
OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_dint.o OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/vf_dint.o
......
...@@ -64,8 +64,11 @@ void avfilter_register_all(void) ...@@ -64,8 +64,11 @@ void avfilter_register_all(void)
REGISTER_FILTER (ANULLSRC, anullsrc, asrc); REGISTER_FILTER (ANULLSRC, anullsrc, asrc);
REGISTER_FILTER (FLITE, flite, asrc); REGISTER_FILTER (FLITE, flite, asrc);
#if !AV_HAVE_INCOMPATIBLE_FORK_ABI
REGISTER_FILTER (ABUFFERSINK, abuffersink, asink); REGISTER_FILTER (ABUFFERSINK, abuffersink, asink);
#endif
REGISTER_FILTER (ANULLSINK, anullsink, asink); REGISTER_FILTER (ANULLSINK, anullsink, asink);
REGISTER_FILTER (FFABUFFERSINK, ffabuffersink, asink);
REGISTER_FILTER (ALPHAEXTRACT, alphaextract, vf); REGISTER_FILTER (ALPHAEXTRACT, alphaextract, vf);
REGISTER_FILTER (ALPHAMERGE, alphamerge, vf); REGISTER_FILTER (ALPHAMERGE, alphamerge, vf);
...@@ -140,7 +143,10 @@ void avfilter_register_all(void) ...@@ -140,7 +143,10 @@ void avfilter_register_all(void)
REGISTER_FILTER (SMPTEBARS, smptebars, vsrc); REGISTER_FILTER (SMPTEBARS, smptebars, vsrc);
REGISTER_FILTER (TESTSRC, testsrc, vsrc); REGISTER_FILTER (TESTSRC, testsrc, vsrc);
#if !AV_HAVE_INCOMPATIBLE_FORK_ABI
REGISTER_FILTER (BUFFERSINK, buffersink, vsink); REGISTER_FILTER (BUFFERSINK, buffersink, vsink);
#endif
REGISTER_FILTER (FFBUFFERSINK,ffbuffersink,vsink);
REGISTER_FILTER (NULLSINK, nullsink, vsink); REGISTER_FILTER (NULLSINK, nullsink, vsink);
/* multimedia filters */ /* multimedia filters */
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "libavutil/audioconvert.h" #include "libavutil/audioconvert.h"
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#include "libavcodec/avcodec.h" // avcodec_find_best_pix_fmt2() #include "libavcodec/avcodec.h" // avcodec_find_best_pix_fmt_of_2()
#include "avfilter.h" #include "avfilter.h"
#include "avfiltergraph.h" #include "avfiltergraph.h"
#include "formats.h" #include "formats.h"
...@@ -429,7 +429,7 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref) ...@@ -429,7 +429,7 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref)
int i; int i;
for (i=0; i<link->in_formats->format_count; i++) { for (i=0; i<link->in_formats->format_count; i++) {
enum PixelFormat p = link->in_formats->formats[i]; enum PixelFormat p = link->in_formats->formats[i];
best= avcodec_find_best_pix_fmt2(best, p, ref->format, has_alpha, NULL); best= avcodec_find_best_pix_fmt_of_2(best, p, ref->format, has_alpha, NULL);
} }
av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s alpha:%d\n", av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s alpha:%d\n",
av_get_pix_fmt_name(best), link->in_formats->format_count, av_get_pix_fmt_name(best), link->in_formats->format_count,
......
...@@ -141,7 +141,11 @@ int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **pbuf, ...@@ -141,7 +141,11 @@ int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **pbuf,
} }
AVFilter avfilter_vsink_buffer = { AVFilter avfilter_vsink_buffer = {
#if AV_HAVE_INCOMPATIBLE_FORK_ABI
.name = "buffersink",
#else
.name = "buffersink_old", .name = "buffersink_old",
#endif
.description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
.priv_size = sizeof(BufferSinkContext), .priv_size = sizeof(BufferSinkContext),
.uninit = uninit, .uninit = uninit,
...@@ -156,7 +160,11 @@ AVFilter avfilter_vsink_buffer = { ...@@ -156,7 +160,11 @@ AVFilter avfilter_vsink_buffer = {
}; };
AVFilter avfilter_asink_abuffer = { AVFilter avfilter_asink_abuffer = {
#if AV_HAVE_INCOMPATIBLE_FORK_ABI
.name = "abuffersink",
#else
.name = "abuffersink_old", .name = "abuffersink_old",
#endif
.description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."), .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
.priv_size = sizeof(BufferSinkContext), .priv_size = sizeof(BufferSinkContext),
.uninit = uninit, .uninit = uninit,
......
/*
* This file is part of MPlayer.
*
* MPlayer 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.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "mp_msg.h"
#include "cpudetect.h"
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
#include "libvo/fastmemcpy.h"
struct vf_priv_s {
int hi, lo;
float frac;
int max, last, cnt;
};
#if HAVE_MMX && HAVE_EBX_AVAILABLE
static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns)
{
volatile short out[4];
__asm__ (
"movl $8, %%ecx \n\t"
"pxor %%mm4, %%mm4 \n\t"
"pxor %%mm7, %%mm7 \n\t"
ASMALIGN(4)
"1: \n\t"
"movq (%%"REG_S"), %%mm0 \n\t"
"movq (%%"REG_S"), %%mm2 \n\t"
"add %%"REG_a", %%"REG_S" \n\t"
"movq (%%"REG_D"), %%mm1 \n\t"
"add %%"REG_b", %%"REG_D" \n\t"
"psubusb %%mm1, %%mm2 \n\t"
"psubusb %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm0 \n\t"
"movq %%mm1, %%mm3 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpckhbw %%mm7, %%mm2 \n\t"
"punpckhbw %%mm7, %%mm3 \n\t"
"paddw %%mm0, %%mm4 \n\t"
"paddw %%mm1, %%mm4 \n\t"
"paddw %%mm2, %%mm4 \n\t"
"paddw %%mm3, %%mm4 \n\t"
"decl %%ecx \n\t"
"jnz 1b \n\t"
"movq %%mm4, (%%"REG_d") \n\t"
"emms \n\t"
:
: "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out)
: "%ecx", "memory"
);
return out[0]+out[1]+out[2]+out[3];
}
#endif
static int diff_C(unsigned char *old, unsigned char *new, int os, int ns)
{
int x, y, d=0;
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++) {
d += abs(new[x] - old[x]);
}
new += ns;
old += os;
}
return d;
}
static int (*diff)(unsigned char *, unsigned char *, int, int);
static int diff_to_drop_plane(int hi, int lo, float frac, unsigned char *old, unsigned char *new, int w, int h, int os, int ns)
{
int x, y;
int d, c=0;
int t = (w/16)*(h/16)*frac;
for (y = 0; y < h-7; y += 4) {
for (x = 8; x < w-7; x += 4) {
d = diff(old+x+y*os, new+x+y*ns, os, ns);
if (d > hi) return 0;
if (d > lo) {
c++;
if (c > t) return 0;
}
}
}
return 1;
}
static int diff_to_drop(int hi, int lo, float frac, mp_image_t *old, mp_image_t *new)
{
if (new->flags & MP_IMGFLAG_PLANAR) {
return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0],
new->w, new->h, old->stride[0], new->stride[0])
&& diff_to_drop_plane(hi,lo,frac, old->planes[1], new->planes[1],
new->chroma_width, new->chroma_height,
old->stride[1], new->stride[1])
&& diff_to_drop_plane(hi,lo,frac, old->planes[2], new->planes[2],
new->chroma_width, new->chroma_height,
old->stride[2], new->stride[2]);
}
return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0],
new->w*(new->bpp/8), new->h, old->stride[0], new->stride[0]);
}
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
dmpi = vf_get_image(vf->next, mpi->imgfmt,
MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE,
mpi->width, mpi->height);
dmpi->qscale = mpi->qscale;
dmpi->qstride = mpi->qstride;
dmpi->qscale_type = mpi->qscale_type;
if (diff_to_drop(vf->priv->hi, vf->priv->lo, vf->priv->frac, dmpi, mpi)) {
if (vf->priv->max == 0)
return 0;
else if ((vf->priv->max > 0) && (vf->priv->cnt++ < vf->priv->max))
return 0;
else if ((vf->priv->max < 0) && (vf->priv->last+1 >= -vf->priv->max))
return vf->priv->last=0;
}
vf->priv->last++;
vf->priv->cnt=0;
memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,
dmpi->stride[0], mpi->stride[0]);
if (mpi->flags & MP_IMGFLAG_PLANAR) {
memcpy_pic(dmpi->planes[1], mpi->planes[1],
mpi->chroma_width, mpi->chroma_height,
dmpi->stride[1], mpi->stride[1]);
memcpy_pic(dmpi->planes[2], mpi->planes[2],
mpi->chroma_width, mpi->chroma_height,
dmpi->stride[2], mpi->stride[2]);
}
return vf_next_put_image(vf, dmpi, pts);
}
static void uninit(struct vf_instance *vf)
{
free(vf->priv);
}
static int vf_open(vf_instance_t *vf, char *args)
{
struct vf_priv_s *p;
vf->put_image = put_image;
vf->uninit = uninit;
vf->default_reqs = VFCAP_ACCEPT_STRIDE;
vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
p->max = 0;
p->hi = 64*12;
p->lo = 64*5;
p->frac = 0.33;
if (args) sscanf(args, "%d:%d:%d:%f", &p->max, &p->hi, &p->lo, &p->frac);
diff = diff_C;
#if HAVE_MMX && HAVE_EBX_AVAILABLE
if(gCpuCaps.hasMMX) diff = diff_MMX;
#endif
return 1;
}
const vf_info_t vf_info_decimate = {
"near-duplicate frame remover",
"decimate",
"Rich Felker",
"",
vf_open,
NULL
};
...@@ -143,7 +143,10 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx, ...@@ -143,7 +143,10 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx,
int ret; int ret;
*bufref = NULL; *bufref = NULL;
av_assert0(!strcmp(ctx->filter->name, "buffersink") || !strcmp(ctx->filter->name, "abuffersink")); av_assert0( !strcmp(ctx->filter->name, "buffersink")
|| !strcmp(ctx->filter->name, "abuffersink")
|| !strcmp(ctx->filter->name, "ffbuffersink")
|| !strcmp(ctx->filter->name, "ffabuffersink"));
/* no picref available, fetch it from the filterchain */ /* no picref available, fetch it from the filterchain */
if (!av_fifo_size(buf->fifo)) { if (!av_fifo_size(buf->fifo)) {
...@@ -166,7 +169,8 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx, ...@@ -166,7 +169,8 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx,
AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx) AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx)
{ {
av_assert0(!strcmp(ctx->filter->name, "buffersink")); av_assert0( !strcmp(ctx->filter->name, "buffersink")
|| !strcmp(ctx->filter->name, "ffbuffersink"));
return ctx->inputs[0]->frame_rate; return ctx->inputs[0]->frame_rate;
} }
...@@ -176,7 +180,10 @@ int av_buffersink_poll_frame(AVFilterContext *ctx) ...@@ -176,7 +180,10 @@ int av_buffersink_poll_frame(AVFilterContext *ctx)
BufferSinkContext *buf = ctx->priv; BufferSinkContext *buf = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *inlink = ctx->inputs[0];
av_assert0(!strcmp(ctx->filter->name, "buffersink") || !strcmp(ctx->filter->name, "abuffersink")); av_assert0( !strcmp(ctx->filter->name, "buffersink")
|| !strcmp(ctx->filter->name, "abuffersink")
|| !strcmp(ctx->filter->name, "ffbuffersink")
|| !strcmp(ctx->filter->name, "ffabuffersink"));
return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + ff_poll_frame(inlink); return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + ff_poll_frame(inlink);
} }
...@@ -218,6 +225,23 @@ static int vsink_query_formats(AVFilterContext *ctx) ...@@ -218,6 +225,23 @@ static int vsink_query_formats(AVFilterContext *ctx)
return 0; return 0;
} }
AVFilter avfilter_vsink_ffbuffersink = {
.name = "ffbuffersink",
.description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
.priv_size = sizeof(BufferSinkContext),
.init_opaque = vsink_init,
.uninit = vsink_uninit,
.query_formats = vsink_query_formats,
.inputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.end_frame = end_frame,
.min_perms = AV_PERM_READ | AV_PERM_PRESERVE, },
{ .name = NULL }},
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
};
AVFilter avfilter_vsink_buffersink = { AVFilter avfilter_vsink_buffersink = {
.name = "buffersink", .name = "buffersink",
.description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
...@@ -299,6 +323,22 @@ static int asink_query_formats(AVFilterContext *ctx) ...@@ -299,6 +323,22 @@ static int asink_query_formats(AVFilterContext *ctx)
return 0; return 0;
} }
AVFilter avfilter_asink_ffabuffersink = {
.name = "ffabuffersink",
.description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
.init_opaque = asink_init,
.uninit = asink_uninit,
.priv_size = sizeof(BufferSinkContext),
.query_formats = asink_query_formats,
.inputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_AUDIO,
.filter_samples = filter_samples,
.min_perms = AV_PERM_READ | AV_PERM_PRESERVE, },
{ .name = NULL }},
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
};
AVFilter avfilter_asink_abuffersink = { AVFilter avfilter_asink_abuffersink = {
.name = "abuffersink", .name = "abuffersink",
.description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."), .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3 #define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 15 #define LIBAVFILTER_VERSION_MINOR 15
#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_MICRO 102
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \
......
...@@ -127,7 +127,6 @@ extern const vf_info_t vf_info_1bpp; ...@@ -127,7 +127,6 @@ extern const vf_info_t vf_info_1bpp;
extern const vf_info_t vf_info_ass; extern const vf_info_t vf_info_ass;
extern const vf_info_t vf_info_bmovl; extern const vf_info_t vf_info_bmovl;
extern const vf_info_t vf_info_crop; extern const vf_info_t vf_info_crop;
extern const vf_info_t vf_info_decimate;
extern const vf_info_t vf_info_denoise3d; extern const vf_info_t vf_info_denoise3d;
extern const vf_info_t vf_info_detc; extern const vf_info_t vf_info_detc;
extern const vf_info_t vf_info_dint; extern const vf_info_t vf_info_dint;
...@@ -189,7 +188,6 @@ extern const vf_info_t vf_info_zrmjpeg; ...@@ -189,7 +188,6 @@ extern const vf_info_t vf_info_zrmjpeg;
static const vf_info_t* const filters[]={ static const vf_info_t* const filters[]={
&vf_info_decimate,
&vf_info_denoise3d, &vf_info_denoise3d,
&vf_info_detc, &vf_info_detc,
&vf_info_dint, &vf_info_dint,
......
...@@ -45,7 +45,7 @@ static int read_header(AVFormatContext *s) ...@@ -45,7 +45,7 @@ static int read_header(AVFormatContext *s)
avio_seek(pb, avio_size(pb) - 36, SEEK_SET); avio_seek(pb, avio_size(pb) - 36, SEEK_SET);
if (avio_rb32(pb) != RAND_TAG) { if (avio_rb32(pb) != RAND_TAG) {
av_log(s, AV_LOG_ERROR, "magic number not found"); av_log(s, AV_LOG_ERROR, "magic number not found\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
......
...@@ -187,7 +187,7 @@ static int flic_read_header(AVFormatContext *s) ...@@ -187,7 +187,7 @@ static int flic_read_header(AVFormatContext *s)
(magic_number == FLIC_FILE_MAGIC_3)) { (magic_number == FLIC_FILE_MAGIC_3)) {
avpriv_set_pts_info(st, 64, speed, 1000); avpriv_set_pts_info(st, 64, speed, 1000);
} else { } else {
av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n"); av_log(s, AV_LOG_ERROR, "Invalid or unsupported magic chunk in file\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
......
...@@ -2105,10 +2105,29 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, ...@@ -2105,10 +2105,29 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
else else
pkt->pts = timecode; pkt->pts = timecode;
pkt->pos = pos; pkt->pos = pos;
if (st->codec->codec_id == AV_CODEC_ID_SUBRIP) if (st->codec->codec_id == AV_CODEC_ID_SUBRIP) {
/*
* For backward compatibility.
* Historically, we have put subtitle duration
* in convergence_duration, on the off chance
* that the time_scale is less than 1us, which
* could result in a 32bit overflow on the
* normal duration field.
*/
pkt->convergence_duration = lace_duration; pkt->convergence_duration = lace_duration;
else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE) }
if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE ||
lace_duration <= INT_MAX) {
/*
* For non subtitle tracks, just store the duration
* as normal.
*
* If it's a subtitle track and duration value does
* not overflow a uint32, then also store it normally.
*/
pkt->duration = lace_duration; pkt->duration = lace_duration;
}
if (st->codec->codec_id == AV_CODEC_ID_SSA) if (st->codec->codec_id == AV_CODEC_ID_SSA)
matroska_fix_ass_packet(matroska, pkt, lace_duration); matroska_fix_ass_packet(matroska, pkt, lace_duration);
......
...@@ -1168,7 +1168,10 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) ...@@ -1168,7 +1168,10 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
duration = mkv_write_srt_blocks(s, pb, pkt); duration = mkv_write_srt_blocks(s, pb, pkt);
} else { } else {
ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(pkt->size)); ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(pkt->size));
/* For backward compatibility, prefer convergence_duration. */
if (pkt->convergence_duration > 0) {
duration = pkt->convergence_duration; duration = pkt->convergence_duration;
}
mkv_write_block(s, pb, MATROSKA_ID_BLOCK, pkt, 0); mkv_write_block(s, pb, MATROSKA_ID_BLOCK, pkt, 0);
put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration); put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration);
end_ebml_master(pb, blockgroup); end_ebml_master(pb, blockgroup);
......
...@@ -65,6 +65,7 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt) ...@@ -65,6 +65,7 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
int len; int len;
if (d <= 0) if (d <= 0)
/* For backward compatibility, fallback to convergence_duration. */
d = pkt->convergence_duration; d = pkt->convergence_duration;
if (s == AV_NOPTS_VALUE || d <= 0) { if (s == AV_NOPTS_VALUE || d <= 0) {
av_log(avf, AV_LOG_ERROR, "Insufficient timestamps.\n"); av_log(avf, AV_LOG_ERROR, "Insufficient timestamps.\n");
......
...@@ -695,7 +695,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, ...@@ -695,7 +695,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
if (ff_guidcmp(formattype, ff_format_none)) if (ff_guidcmp(formattype, ff_format_none))
av_log(s, AV_LOG_WARNING, "unknown formattype:"FF_PRI_GUID"\n", FF_ARG_GUID(formattype)); av_log(s, AV_LOG_WARNING, "unknown formattype:"FF_PRI_GUID"\n", FF_ARG_GUID(formattype));
avio_skip(pb, size); avio_skip(pb, size);
st->codec->codec_id = AV_CODEC_ID_DVB_TELETEXT; st->codec->codec_id = !ff_guidcmp(subtype, mediasubtype_teletext) ? AV_CODEC_ID_DVB_TELETEXT : AV_CODEC_ID_EIA_608;
return st; return st;
} else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) && } else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) &&
!ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) { !ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) {
......
...@@ -401,7 +401,7 @@ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensatio ...@@ -401,7 +401,7 @@ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensatio
#undef FELEM_MAX #undef FELEM_MAX
#undef FILTER_SHIFT #undef FILTER_SHIFT
#if HAVE_SSSE3 #if HAVE_SSSE3_INLINE
#define COMMON_CORE COMMON_CORE_INT16_SSSE3 #define COMMON_CORE COMMON_CORE_INT16_SSSE3
#define RENAME(N) N ## _int16_ssse3 #define RENAME(N) N ## _int16_ssse3
#define FILTER_SHIFT 15 #define FILTER_SHIFT 15
...@@ -424,7 +424,7 @@ int swri_multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, Aud ...@@ -424,7 +424,7 @@ int swri_multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, Aud
for(i=0; i<dst->ch_count; i++){ for(i=0; i<dst->ch_count; i++){
#if ARCH_X86 #if ARCH_X86
#if HAVE_SSSE3 #if HAVE_SSSE3_INLINE
if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_SSSE3)) ret= swri_resample_int16_ssse3(c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_SSSE3)) ret= swri_resample_int16_ssse3(c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count);
else else
#endif #endif
......
...@@ -28,7 +28,7 @@ fate-utvideo_yuv422_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv422_ ...@@ -28,7 +28,7 @@ fate-utvideo_yuv422_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv422_
FATE_SAMPLES_AVCONV += $(FATE_UTVIDEO) FATE_SAMPLES_AVCONV += $(FATE_UTVIDEO)
fate-utvideo: $(FATE_UTVIDEO) fate-utvideo: $(FATE_UTVIDEO)
fate-utvideoenc%: CMD = framemd5 -f image2 -vcodec pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -vcodec utvideo -f avi -sws_flags +accurate_rnd+bitexact ${OPTS} fate-utvideoenc%: CMD = framemd5 -f image2 -vcodec pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -vcodec utvideo -sws_flags +accurate_rnd+bitexact ${OPTS}
FATE_UTVIDEOENC += fate-utvideoenc_rgba_none FATE_UTVIDEOENC += fate-utvideoenc_rgba_none
fate-utvideoenc_rgba_none: OPTS = -pix_fmt rgba -pred 3 fate-utvideoenc_rgba_none: OPTS = -pix_fmt rgba -pred 3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment