Signed-off-by: Paul B Mahol <one...@gmail.com> --- Changelog | 1 + LICENSE.md | 2 - configure | 1 - doc/filters.texi | 30 -- libavfilter/Makefile | 1 - libavfilter/allfilters.c | 1 - libavfilter/libmpcodecs/cpudetect.h | 60 --- libavfilter/libmpcodecs/img_format.c | 244 --------- libavfilter/libmpcodecs/img_format.h | 309 ------------ libavfilter/libmpcodecs/libvo/fastmemcpy.h | 99 ---- libavfilter/libmpcodecs/mp_image.c | 257 ---------- libavfilter/libmpcodecs/mp_image.h | 159 ------ libavfilter/libmpcodecs/mp_msg.h | 166 ------- libavfilter/libmpcodecs/vf.h | 167 ------- libavfilter/libmpcodecs/vf_softpulldown.c | 163 ------ libavfilter/libmpcodecs/vfcap.h | 56 --- libavfilter/version.h | 4 +- libavfilter/vf_mp.c | 772 ----------------------------- 18 files changed, 3 insertions(+), 2489 deletions(-) delete mode 100644 libavfilter/libmpcodecs/cpudetect.h delete mode 100644 libavfilter/libmpcodecs/img_format.c delete mode 100644 libavfilter/libmpcodecs/img_format.h delete mode 100644 libavfilter/libmpcodecs/libvo/fastmemcpy.h delete mode 100644 libavfilter/libmpcodecs/mp_image.c delete mode 100644 libavfilter/libmpcodecs/mp_image.h delete mode 100644 libavfilter/libmpcodecs/mp_msg.h delete mode 100644 libavfilter/libmpcodecs/vf.h delete mode 100644 libavfilter/libmpcodecs/vf_softpulldown.c delete mode 100644 libavfilter/libmpcodecs/vfcap.h delete mode 100644 libavfilter/vf_mp.c
diff --git a/Changelog b/Changelog index 04f1728..ab4ef56 100644 --- a/Changelog +++ b/Changelog @@ -16,6 +16,7 @@ version <next>: - Closed caption Decoder - fspp, uspp, pp7 MPlayer postprocessing filters ported to native filters - showpalette filter +- removed libmpcodecs version 2.5: diff --git a/LICENSE.md b/LICENSE.md index fb52cad..915575e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -13,7 +13,6 @@ configure to activate them. In this case, FFmpeg's license changes to GPL v2+. Specifically, the GPL parts of FFmpeg are: - libpostproc -- libmpcodecs - optional x86 optimizations in the files libavcodec/x86/flac_dsp_gpl.asm libavcodec/x86/idct_mmx.c @@ -38,7 +37,6 @@ Specifically, the GPL parts of FFmpeg are: - vf_interlace.c - vf_kerndeint.c - vf_mcdeint.c - - vf_mp.c - vf_mpdecimate.c - vf_owdenoise.c - vf_perspective.c diff --git a/configure b/configure index 9fcdaee..1f391d5 100755 --- a/configure +++ b/configure @@ -2594,7 +2594,6 @@ kerndeint_filter_deps="gpl" ladspa_filter_deps="ladspa dlopen" mcdeint_filter_deps="avcodec gpl" movie_filter_deps="avcodec avformat" -mp_filter_deps="gpl avcodec swscale" mpdecimate_filter_deps="gpl" mpdecimate_filter_select="pixelutils" mptestsrc_filter_deps="gpl" diff --git a/doc/filters.texi b/doc/filters.texi index 009cab3..c7f0b60 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -6258,36 +6258,6 @@ Higher values should result in a smoother motion vector field but less optimal individual vectors. Default value is 1. @end table -@section mp - -Apply an MPlayer filter to the input video. - -This filter provides a wrapper around some of the filters of -MPlayer/MEncoder. - -This wrapper is considered experimental. Some of the wrapped filters -may not work properly and we may drop support for them, as they will -be implemented natively into FFmpeg. Thus you should avoid -depending on them when writing portable scripts. - -The filter accepts the parameters: -@var{filter_name}[:=]@var{filter_params} - -@var{filter_name} is the name of a supported MPlayer filter, -@var{filter_params} is a string containing the parameters accepted by -the named filter. - -The list of the currently supported filters follows: -@table @var -@item softpulldown -@end table - -The parameter syntax and behavior for the listed filters are the same -of the corresponding MPlayer filters. For detailed instructions check -the "VIDEO FILTERS" section in the MPlayer manual. - -See also mplayer(1), @url{http://www.mplayerhq.hu/}. - @section mpdecimate Drop frames that do not differ greatly from the previous frame in diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 7e0d456..8f9f125 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -149,7 +149,6 @@ OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o OBJS-$(CONFIG_MCDEINT_FILTER) += vf_mcdeint.o OBJS-$(CONFIG_MERGEPLANES_FILTER) += vf_mergeplanes.o framesync.o -OBJS-$(CONFIG_MP_FILTER) += vf_mp.o OBJS-$(CONFIG_MPDECIMATE_FILTER) += vf_mpdecimate.o OBJS-$(CONFIG_NEGATE_FILTER) += vf_lut.o OBJS-$(CONFIG_NOFORMAT_FILTER) += vf_format.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index f4af8ec..3b13ed7 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -165,7 +165,6 @@ void avfilter_register_all(void) REGISTER_FILTER(LUTYUV, lutyuv, vf); REGISTER_FILTER(MCDEINT, mcdeint, vf); REGISTER_FILTER(MERGEPLANES, mergeplanes, vf); - REGISTER_FILTER(MP, mp, vf); REGISTER_FILTER(MPDECIMATE, mpdecimate, vf); REGISTER_FILTER(NEGATE, negate, vf); REGISTER_FILTER(NOFORMAT, noformat, vf); diff --git a/libavfilter/libmpcodecs/cpudetect.h b/libavfilter/libmpcodecs/cpudetect.h deleted file mode 100644 index 710f6e6..0000000 --- a/libavfilter/libmpcodecs/cpudetect.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ - -#ifndef MPLAYER_CPUDETECT_H -#define MPLAYER_CPUDETECT_H - -#define CPUTYPE_I386 3 -#define CPUTYPE_I486 4 -#define CPUTYPE_I586 5 -#define CPUTYPE_I686 6 - -#include "libavutil/x86_cpu.h" - -typedef struct cpucaps_s { - int cpuType; - int cpuModel; - int cpuStepping; - int hasMMX; - int hasMMX2; - int has3DNow; - int has3DNowExt; - int hasSSE; - int hasSSE2; - int hasSSE3; - int hasSSSE3; - int hasSSE4; - int hasSSE42; - int hasSSE4a; - int hasAVX; - int isX86; - unsigned cl_size; /* size of cache line */ - int hasAltiVec; - int hasTSC; -} CpuCaps; - -extern CpuCaps ff_gCpuCaps; - -void ff_do_cpuid(unsigned int ax, unsigned int *p); - -void ff_GetCpuCaps(CpuCaps *caps); - -/* returned value is malloc()'ed so free() it after use */ -char *ff_GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]); - -#endif /* MPLAYER_CPUDETECT_H */ diff --git a/libavfilter/libmpcodecs/img_format.c b/libavfilter/libmpcodecs/img_format.c deleted file mode 100644 index dd07f00..0000000 --- a/libavfilter/libmpcodecs/img_format.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * 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 "config.h" -#include "img_format.h" -#include "stdio.h" -#include "libavutil/bswap.h" - -const char *ff_vo_format_name(int format) -{ - static char unknown_format[20]; - switch(format) - { - case IMGFMT_RGB1: return "RGB 1-bit"; - case IMGFMT_RGB4: return "RGB 4-bit"; - case IMGFMT_RG4B: return "RGB 4-bit per byte"; - case IMGFMT_RGB8: return "RGB 8-bit"; - case IMGFMT_RGB12: return "RGB 12-bit"; - case IMGFMT_RGB15: return "RGB 15-bit"; - case IMGFMT_RGB16: return "RGB 16-bit"; - case IMGFMT_RGB24: return "RGB 24-bit"; -// case IMGFMT_RGB32: return "RGB 32-bit"; - case IMGFMT_RGB48LE: return "RGB 48-bit LE"; - case IMGFMT_RGB48BE: return "RGB 48-bit BE"; - case IMGFMT_RGB64LE: return "RGB 64-bit LE"; - case IMGFMT_RGB64BE: return "RGB 64-bit BE"; - case IMGFMT_BGR1: return "BGR 1-bit"; - case IMGFMT_BGR4: return "BGR 4-bit"; - case IMGFMT_BG4B: return "BGR 4-bit per byte"; - case IMGFMT_BGR8: return "BGR 8-bit"; - case IMGFMT_BGR12: return "BGR 12-bit"; - case IMGFMT_BGR15: return "BGR 15-bit"; - case IMGFMT_BGR16: return "BGR 16-bit"; - case IMGFMT_BGR24: return "BGR 24-bit"; -// case IMGFMT_BGR32: return "BGR 32-bit"; - case IMGFMT_ABGR: return "ABGR"; - case IMGFMT_BGRA: return "BGRA"; - case IMGFMT_ARGB: return "ARGB"; - case IMGFMT_RGBA: return "RGBA"; - case IMGFMT_XYZ12LE: return "XYZ 36-bit LE"; - case IMGFMT_XYZ12BE: return "XYZ 36-bit BE"; - case IMGFMT_GBR24P: return "Planar GBR 24-bit"; - case IMGFMT_GBR12P: return "Planar GBR 36-bit"; - case IMGFMT_GBR14P: return "Planar GBR 42-bit"; - case IMGFMT_YVU9: return "Planar YVU9"; - case IMGFMT_IF09: return "Planar IF09"; - case IMGFMT_YV12: return "Planar YV12"; - case IMGFMT_I420: return "Planar I420"; - case IMGFMT_IYUV: return "Planar IYUV"; - case IMGFMT_CLPL: return "Planar CLPL"; - case IMGFMT_Y800: return "Planar Y800"; - case IMGFMT_Y8: return "Planar Y8"; - case IMGFMT_Y8A: return "Planar Y8 with alpha"; - case IMGFMT_Y16_LE: return "Planar Y16 little-endian"; - case IMGFMT_Y16_BE: return "Planar Y16 big-endian"; - case IMGFMT_420P16_LE: return "Planar 420P 16-bit little-endian"; - case IMGFMT_420P16_BE: return "Planar 420P 16-bit big-endian"; - case IMGFMT_420P14_LE: return "Planar 420P 14-bit little-endian"; - case IMGFMT_420P14_BE: return "Planar 420P 14-bit big-endian"; - case IMGFMT_420P12_LE: return "Planar 420P 12-bit little-endian"; - case IMGFMT_420P12_BE: return "Planar 420P 12-bit big-endian"; - case IMGFMT_420P10_LE: return "Planar 420P 10-bit little-endian"; - case IMGFMT_420P10_BE: return "Planar 420P 10-bit big-endian"; - case IMGFMT_420P9_LE: return "Planar 420P 9-bit little-endian"; - case IMGFMT_420P9_BE: return "Planar 420P 9-bit big-endian"; - case IMGFMT_422P16_LE: return "Planar 422P 16-bit little-endian"; - case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian"; - case IMGFMT_422P14_LE: return "Planar 422P 14-bit little-endian"; - case IMGFMT_422P14_BE: return "Planar 422P 14-bit big-endian"; - case IMGFMT_422P12_LE: return "Planar 422P 12-bit little-endian"; - case IMGFMT_422P12_BE: return "Planar 422P 12-bit big-endian"; - case IMGFMT_422P10_LE: return "Planar 422P 10-bit little-endian"; - case IMGFMT_422P10_BE: return "Planar 422P 10-bit big-endian"; - case IMGFMT_422P9_LE: return "Planar 422P 9-bit little-endian"; - case IMGFMT_422P9_BE: return "Planar 422P 9-bit big-endian"; - case IMGFMT_444P16_LE: return "Planar 444P 16-bit little-endian"; - case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-endian"; - case IMGFMT_444P14_LE: return "Planar 444P 14-bit little-endian"; - case IMGFMT_444P14_BE: return "Planar 444P 14-bit big-endian"; - case IMGFMT_444P12_LE: return "Planar 444P 12-bit little-endian"; - case IMGFMT_444P12_BE: return "Planar 444P 12-bit big-endian"; - case IMGFMT_444P10_LE: return "Planar 444P 10-bit little-endian"; - case IMGFMT_444P10_BE: return "Planar 444P 10-bit big-endian"; - case IMGFMT_444P9_LE: return "Planar 444P 9-bit little-endian"; - case IMGFMT_444P9_BE: return "Planar 444P 9-bit big-endian"; - case IMGFMT_420A: return "Planar 420P with alpha"; - case IMGFMT_444P: return "Planar 444P"; - case IMGFMT_444A: return "Planar 444P with alpha"; - case IMGFMT_422P: return "Planar 422P"; - case IMGFMT_422A: return "Planar 422P with alpha"; - case IMGFMT_411P: return "Planar 411P"; - case IMGFMT_440P: return "Planar 440P"; - case IMGFMT_NV12: return "Planar NV12"; - case IMGFMT_NV21: return "Planar NV21"; - case IMGFMT_HM12: return "Planar NV12 Macroblock"; - case IMGFMT_IUYV: return "Packed IUYV"; - case IMGFMT_IY41: return "Packed IY41"; - case IMGFMT_IYU1: return "Packed IYU1"; - case IMGFMT_IYU2: return "Packed IYU2"; - case IMGFMT_UYVY: return "Packed UYVY"; - case IMGFMT_UYNV: return "Packed UYNV"; - case IMGFMT_cyuv: return "Packed CYUV"; - case IMGFMT_Y422: return "Packed Y422"; - case IMGFMT_YUY2: return "Packed YUY2"; - case IMGFMT_YUNV: return "Packed YUNV"; - case IMGFMT_YVYU: return "Packed YVYU"; - case IMGFMT_Y41P: return "Packed Y41P"; - case IMGFMT_Y211: return "Packed Y211"; - case IMGFMT_Y41T: return "Packed Y41T"; - case IMGFMT_Y42T: return "Packed Y42T"; - case IMGFMT_V422: return "Packed V422"; - case IMGFMT_V655: return "Packed V655"; - case IMGFMT_CLJR: return "Packed CLJR"; - case IMGFMT_YUVP: return "Packed YUVP"; - case IMGFMT_UYVP: return "Packed UYVP"; - case IMGFMT_MPEGPES: return "Mpeg PES"; - case IMGFMT_ZRMJPEGNI: return "Zoran MJPEG non-interlaced"; - case IMGFMT_ZRMJPEGIT: return "Zoran MJPEG top field first"; - case IMGFMT_ZRMJPEGIB: return "Zoran MJPEG bottom field first"; - case IMGFMT_XVMC_MOCO_MPEG2: return "MPEG1/2 Motion Compensation"; - case IMGFMT_XVMC_IDCT_MPEG2: return "MPEG1/2 Motion Compensation and IDCT"; - case IMGFMT_VDPAU_MPEG1: return "MPEG1 VDPAU acceleration"; - case IMGFMT_VDPAU_MPEG2: return "MPEG2 VDPAU acceleration"; - case IMGFMT_VDPAU_H264: return "H.264 VDPAU acceleration"; - case IMGFMT_VDPAU_MPEG4: return "MPEG-4 Part 2 VDPAU acceleration"; - case IMGFMT_VDPAU_WMV3: return "WMV3 VDPAU acceleration"; - case IMGFMT_VDPAU_VC1: return "VC1 VDPAU acceleration"; - } - snprintf(unknown_format,20,"Unknown 0x%04x",format); - return unknown_format; -} - -int ff_mp_get_chroma_shift(int format, int *x_shift, int *y_shift, int *component_bits) -{ - int xs = 0, ys = 0; - int bpp; - int err = 0; - int bits = 8; - if ((format & 0xff0000f0) == 0x34000050) - format = av_bswap32(format); - if ((format & 0xf00000ff) == 0x50000034) { - switch (format >> 24) { - case 0x50: - break; - case 0x51: - bits = 16; - break; - case 0x52: - bits = 10; - break; - case 0x53: - bits = 9; - break; - default: - err = 1; - break; - } - switch (format & 0x00ffffff) { - case 0x00343434: // 444 - xs = 0; - ys = 0; - break; - case 0x00323234: // 422 - xs = 1; - ys = 0; - break; - case 0x00303234: // 420 - xs = 1; - ys = 1; - break; - case 0x00313134: // 411 - xs = 2; - ys = 0; - break; - case 0x00303434: // 440 - xs = 0; - ys = 1; - break; - default: - err = 1; - break; - } - } else switch (format) { - case IMGFMT_444A: - xs = 0; - ys = 0; - break; - case IMGFMT_422A: - xs = 1; - ys = 0; - break; - case IMGFMT_420A: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YV12: - xs = 1; - ys = 1; - break; - case IMGFMT_IF09: - case IMGFMT_YVU9: - xs = 2; - ys = 2; - break; - case IMGFMT_Y8: - case IMGFMT_Y800: - xs = 31; - ys = 31; - break; - case IMGFMT_NV12: - case IMGFMT_NV21: - xs = 1; - ys = 1; - // TODO: allowing this though currently breaks - // things all over the place. - err = 1; - break; - default: - err = 1; - break; - } - if (x_shift) *x_shift = xs; - if (y_shift) *y_shift = ys; - if (component_bits) *component_bits = bits; - bpp = 8 + ((16 >> xs) >> ys); - if (format == IMGFMT_420A || format == IMGFMT_422A || format == IMGFMT_444A) - bpp += 8; - bpp *= (bits + 7) >> 3; - return err ? 0 : bpp; -} diff --git a/libavfilter/libmpcodecs/img_format.h b/libavfilter/libmpcodecs/img_format.h deleted file mode 100644 index b5c0b90..0000000 --- a/libavfilter/libmpcodecs/img_format.h +++ /dev/null @@ -1,309 +0,0 @@ -/* - * 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. - */ - -#ifndef MPLAYER_IMG_FORMAT_H -#define MPLAYER_IMG_FORMAT_H - -#include "config.h" - -/* RGB/BGR Formats */ - -#define IMGFMT_RGB_MASK 0xFFFFFF00 -#define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8)) -#define IMGFMT_RGB1 (IMGFMT_RGB|1) -#define IMGFMT_RGB4 (IMGFMT_RGB|4) -#define IMGFMT_RGB4_CHAR (IMGFMT_RGB|4|128) // RGB4 with 1 pixel per byte -#define IMGFMT_RGB8 (IMGFMT_RGB|8) -#define IMGFMT_RGB12 (IMGFMT_RGB|12) -#define IMGFMT_RGB15 (IMGFMT_RGB|15) -#define IMGFMT_RGB16 (IMGFMT_RGB|16) -#define IMGFMT_RGB24 (IMGFMT_RGB|24) -#define IMGFMT_RGB32 (IMGFMT_RGB|32) -#define IMGFMT_RGB48LE (IMGFMT_RGB|48) -#define IMGFMT_RGB48BE (IMGFMT_RGB|48|128) -#define IMGFMT_RGB64LE (IMGFMT_RGB|64) -#define IMGFMT_RGB64BE (IMGFMT_RGB|64|128) - -#define IMGFMT_BGR_MASK 0xFFFFFF00 -#define IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8)) -#define IMGFMT_BGR1 (IMGFMT_BGR|1) -#define IMGFMT_BGR4 (IMGFMT_BGR|4) -#define IMGFMT_BGR4_CHAR (IMGFMT_BGR|4|128) // BGR4 with 1 pixel per byte -#define IMGFMT_BGR8 (IMGFMT_BGR|8) -#define IMGFMT_BGR12 (IMGFMT_BGR|12) -#define IMGFMT_BGR15 (IMGFMT_BGR|15) -#define IMGFMT_BGR16 (IMGFMT_BGR|16) -#define IMGFMT_BGR24 (IMGFMT_BGR|24) -#define IMGFMT_BGR32 (IMGFMT_BGR|32) - -#define IMGFMT_XYZ_MASK 0xFFFFFF00 -#define IMGFMT_XYZ (('X'<<24)|('Y'<<16)|('Z'<<8)) -#define IMGFMT_XYZ12LE (IMGFMT_XYZ|12) -#define IMGFMT_XYZ12BE (IMGFMT_XYZ|12|128) - -#define IMGFMT_GBR24P (('G'<<24)|('B'<<16)|('R'<<8)|24) -#define IMGFMT_GBR12PLE (('G'<<24)|('B'<<16)|('R'<<8)|36) -#define IMGFMT_GBR12PBE (('G'<<24)|('B'<<16)|('R'<<8)|36|128) -#define IMGFMT_GBR14PLE (('G'<<24)|('B'<<16)|('R'<<8)|42) -#define IMGFMT_GBR14PBE (('G'<<24)|('B'<<16)|('R'<<8)|42|128) - -#if HAVE_BIGENDIAN -#define IMGFMT_ABGR IMGFMT_RGB32 -#define IMGFMT_BGRA (IMGFMT_RGB32|128) -#define IMGFMT_ARGB IMGFMT_BGR32 -#define IMGFMT_RGBA (IMGFMT_BGR32|128) -#define IMGFMT_RGB64NE IMGFMT_RGB64BE -#define IMGFMT_RGB48NE IMGFMT_RGB48BE -#define IMGFMT_RGB12BE IMGFMT_RGB12 -#define IMGFMT_RGB12LE (IMGFMT_RGB12|128) -#define IMGFMT_RGB15BE IMGFMT_RGB15 -#define IMGFMT_RGB15LE (IMGFMT_RGB15|128) -#define IMGFMT_RGB16BE IMGFMT_RGB16 -#define IMGFMT_RGB16LE (IMGFMT_RGB16|128) -#define IMGFMT_BGR12BE IMGFMT_BGR12 -#define IMGFMT_BGR12LE (IMGFMT_BGR12|128) -#define IMGFMT_BGR15BE IMGFMT_BGR15 -#define IMGFMT_BGR15LE (IMGFMT_BGR15|128) -#define IMGFMT_BGR16BE IMGFMT_BGR16 -#define IMGFMT_BGR16LE (IMGFMT_BGR16|128) -#define IMGFMT_XYZ12 IMGFMT_XYZ12BE -#define IMGFMT_GBR12P IMGFMT_GBR12PBE -#define IMGFMT_GBR14P IMGFMT_GBR14PBE -#else -#define IMGFMT_ABGR (IMGFMT_BGR32|128) -#define IMGFMT_BGRA IMGFMT_BGR32 -#define IMGFMT_ARGB (IMGFMT_RGB32|128) -#define IMGFMT_RGBA IMGFMT_RGB32 -#define IMGFMT_RGB64NE IMGFMT_RGB64LE -#define IMGFMT_RGB48NE IMGFMT_RGB48LE -#define IMGFMT_RGB12BE (IMGFMT_RGB12|128) -#define IMGFMT_RGB12LE IMGFMT_RGB12 -#define IMGFMT_RGB15BE (IMGFMT_RGB15|128) -#define IMGFMT_RGB15LE IMGFMT_RGB15 -#define IMGFMT_RGB16BE (IMGFMT_RGB16|128) -#define IMGFMT_RGB16LE IMGFMT_RGB16 -#define IMGFMT_BGR12BE (IMGFMT_BGR12|128) -#define IMGFMT_BGR12LE IMGFMT_BGR12 -#define IMGFMT_BGR15BE (IMGFMT_BGR15|128) -#define IMGFMT_BGR15LE IMGFMT_BGR15 -#define IMGFMT_BGR16BE (IMGFMT_BGR16|128) -#define IMGFMT_BGR16LE IMGFMT_BGR16 -#define IMGFMT_XYZ12 IMGFMT_XYZ12LE -#define IMGFMT_GBR12P IMGFMT_GBR12PLE -#define IMGFMT_GBR14P IMGFMT_GBR14PLE -#endif - -/* old names for compatibility */ -#define IMGFMT_RG4B IMGFMT_RGB4_CHAR -#define IMGFMT_BG4B IMGFMT_BGR4_CHAR - -#define IMGFMT_IS_RGB(fmt) (((fmt)&IMGFMT_RGB_MASK)==IMGFMT_RGB) -#define IMGFMT_IS_BGR(fmt) (((fmt)&IMGFMT_BGR_MASK)==IMGFMT_BGR) -#define IMGFMT_IS_XYZ(fmt) (((fmt)&IMGFMT_XYZ_MASK)==IMGFMT_XYZ) - -#define IMGFMT_RGB_DEPTH(fmt) ((fmt)&0x7F) -#define IMGFMT_BGR_DEPTH(fmt) ((fmt)&0x7F) -#define IMGFMT_XYZ_DEPTH(fmt) ((fmt)&0x7F) - - -/* Planar YUV Formats */ - -#define IMGFMT_YVU9 0x39555659 -#define IMGFMT_IF09 0x39304649 -#define IMGFMT_YV12 0x32315659 -#define IMGFMT_I420 0x30323449 -#define IMGFMT_IYUV 0x56555949 -#define IMGFMT_CLPL 0x4C504C43 -#define IMGFMT_Y800 0x30303859 -#define IMGFMT_Y8 0x20203859 -#define IMGFMT_NV12 0x3231564E -#define IMGFMT_NV21 0x3132564E -#define IMGFMT_Y16_LE 0x20363159 - -/* unofficial Planar Formats, FIXME if official 4CC exists */ -#define IMGFMT_444P 0x50343434 -#define IMGFMT_422P 0x50323234 -#define IMGFMT_411P 0x50313134 -#define IMGFMT_440P 0x50303434 -#define IMGFMT_HM12 0x32314D48 -#define IMGFMT_Y16_BE 0x59313620 - -// Gray with alpha -#define IMGFMT_Y8A 0x59320008 -// 4:2:0 planar with alpha -#define IMGFMT_420A 0x41303234 -// 4:2:2 planar with alpha -#define IMGFMT_422A 0x41323234 -// 4:4:4 planar with alpha -#define IMGFMT_444A 0x41343434 - -#define IMGFMT_444P16_LE 0x51343434 -#define IMGFMT_444P16_BE 0x34343451 -#define IMGFMT_444P14_LE 0x54343434 -#define IMGFMT_444P14_BE 0x34343454 -#define IMGFMT_444P12_LE 0x55343434 -#define IMGFMT_444P12_BE 0x34343455 -#define IMGFMT_444P10_LE 0x52343434 -#define IMGFMT_444P10_BE 0x34343452 -#define IMGFMT_444P9_LE 0x53343434 -#define IMGFMT_444P9_BE 0x34343453 -#define IMGFMT_422P16_LE 0x51323234 -#define IMGFMT_422P16_BE 0x34323251 -#define IMGFMT_422P14_LE 0x54323234 -#define IMGFMT_422P14_BE 0x34323254 -#define IMGFMT_422P12_LE 0x55323234 -#define IMGFMT_422P12_BE 0x34323255 -#define IMGFMT_422P10_LE 0x52323234 -#define IMGFMT_422P10_BE 0x34323252 -#define IMGFMT_422P9_LE 0x53323234 -#define IMGFMT_422P9_BE 0x34323253 -#define IMGFMT_420P16_LE 0x51303234 -#define IMGFMT_420P16_BE 0x34323051 -#define IMGFMT_420P14_LE 0x54303234 -#define IMGFMT_420P14_BE 0x34323054 -#define IMGFMT_420P12_LE 0x55303234 -#define IMGFMT_420P12_BE 0x34323055 -#define IMGFMT_420P10_LE 0x52303234 -#define IMGFMT_420P10_BE 0x34323052 -#define IMGFMT_420P9_LE 0x53303234 -#define IMGFMT_420P9_BE 0x34323053 -#if HAVE_BIGENDIAN -#define IMGFMT_444P16 IMGFMT_444P16_BE -#define IMGFMT_444P14 IMGFMT_444P14_BE -#define IMGFMT_444P12 IMGFMT_444P12_BE -#define IMGFMT_444P10 IMGFMT_444P10_BE -#define IMGFMT_444P9 IMGFMT_444P9_BE -#define IMGFMT_422P16 IMGFMT_422P16_BE -#define IMGFMT_422P14 IMGFMT_422P14_BE -#define IMGFMT_422P12 IMGFMT_422P12_BE -#define IMGFMT_422P10 IMGFMT_422P10_BE -#define IMGFMT_422P9 IMGFMT_422P9_BE -#define IMGFMT_420P16 IMGFMT_420P16_BE -#define IMGFMT_420P14 IMGFMT_420P14_BE -#define IMGFMT_420P12 IMGFMT_420P12_BE -#define IMGFMT_420P10 IMGFMT_420P10_BE -#define IMGFMT_420P9 IMGFMT_420P9_BE -#define IMGFMT_Y16 IMGFMT_Y16_BE -#define IMGFMT_IS_YUVP16_NE(fmt) IMGFMT_IS_YUVP16_BE(fmt) -#else -#define IMGFMT_444P16 IMGFMT_444P16_LE -#define IMGFMT_444P14 IMGFMT_444P14_LE -#define IMGFMT_444P12 IMGFMT_444P12_LE -#define IMGFMT_444P10 IMGFMT_444P10_LE -#define IMGFMT_444P9 IMGFMT_444P9_LE -#define IMGFMT_422P16 IMGFMT_422P16_LE -#define IMGFMT_422P14 IMGFMT_422P14_LE -#define IMGFMT_422P12 IMGFMT_422P12_LE -#define IMGFMT_422P10 IMGFMT_422P10_LE -#define IMGFMT_422P9 IMGFMT_422P9_LE -#define IMGFMT_420P16 IMGFMT_420P16_LE -#define IMGFMT_420P14 IMGFMT_420P14_LE -#define IMGFMT_420P12 IMGFMT_420P12_LE -#define IMGFMT_420P10 IMGFMT_420P10_LE -#define IMGFMT_420P9 IMGFMT_420P9_LE -#define IMGFMT_Y16 IMGFMT_Y16_LE -#define IMGFMT_IS_YUVP16_NE(fmt) IMGFMT_IS_YUVP16_LE(fmt) -#endif - -#define IMGFMT_IS_YUVP16_LE(fmt) (((fmt - 0x51000034) & 0xfc0000ff) == 0) -#define IMGFMT_IS_YUVP16_BE(fmt) (((fmt - 0x34000051) & 0xff0000fc) == 0) -#define IMGFMT_IS_YUVP16(fmt) (IMGFMT_IS_YUVP16_LE(fmt) || IMGFMT_IS_YUVP16_BE(fmt)) - -/** - * \brief Find the corresponding full 16 bit format, i.e. IMGFMT_420P10_LE -> IMGFMT_420P16_LE - * \return normalized format ID or 0 if none exists. - */ -static inline int normalize_yuvp16(int fmt) { - if (IMGFMT_IS_YUVP16_LE(fmt)) - return (fmt & 0x00ffffff) | 0x51000000; - if (IMGFMT_IS_YUVP16_BE(fmt)) - return (fmt & 0xffffff00) | 0x00000051; - return 0; -} - -/* Packed YUV Formats */ - -#define IMGFMT_IUYV 0x56595549 // Interlaced UYVY -#define IMGFMT_IY41 0x31435949 // Interlaced Y41P -#define IMGFMT_IYU1 0x31555949 -#define IMGFMT_IYU2 0x32555949 -#define IMGFMT_UYVY 0x59565955 -#define IMGFMT_UYNV 0x564E5955 // Exactly same as UYVY -#define IMGFMT_cyuv 0x76757963 // upside-down UYVY -#define IMGFMT_Y422 0x32323459 // Exactly same as UYVY -#define IMGFMT_YUY2 0x32595559 -#define IMGFMT_YUNV 0x564E5559 // Exactly same as YUY2 -#define IMGFMT_YVYU 0x55595659 -#define IMGFMT_Y41P 0x50313459 -#define IMGFMT_Y211 0x31313259 -#define IMGFMT_Y41T 0x54313459 // Y41P, Y lsb = transparency -#define IMGFMT_Y42T 0x54323459 // UYVY, Y lsb = transparency -#define IMGFMT_V422 0x32323456 // upside-down UYVY? -#define IMGFMT_V655 0x35353656 -#define IMGFMT_CLJR 0x524A4C43 -#define IMGFMT_YUVP 0x50565559 // 10-bit YUYV -#define IMGFMT_UYVP 0x50565955 // 10-bit UYVY - -/* Compressed Formats */ -#define IMGFMT_MPEGPES (('M'<<24)|('P'<<16)|('E'<<8)|('S')) -#define IMGFMT_MJPEG (('M')|('J'<<8)|('P'<<16)|('G'<<24)) -/* Formats that are understood by zoran chips, we include - * non-interlaced, interlaced top-first, interlaced bottom-first */ -#define IMGFMT_ZRMJPEGNI (('Z'<<24)|('R'<<16)|('N'<<8)|('I')) -#define IMGFMT_ZRMJPEGIT (('Z'<<24)|('R'<<16)|('I'<<8)|('T')) -#define IMGFMT_ZRMJPEGIB (('Z'<<24)|('R'<<16)|('I'<<8)|('B')) - -// I think that this code could not be used by any other codec/format -#define IMGFMT_XVMC 0x1DC70000 -#define IMGFMT_XVMC_MASK 0xFFFF0000 -#define IMGFMT_IS_XVMC(fmt) (((fmt)&IMGFMT_XVMC_MASK)==IMGFMT_XVMC) -//these are chroma420 -#define IMGFMT_XVMC_MOCO_MPEG2 (IMGFMT_XVMC|0x02) -#define IMGFMT_XVMC_IDCT_MPEG2 (IMGFMT_XVMC|0x82) - -// VDPAU specific format. -#define IMGFMT_VDPAU 0x1DC80000 -#define IMGFMT_VDPAU_MASK 0xFFFF0000 -#define IMGFMT_IS_VDPAU(fmt) (((fmt)&IMGFMT_VDPAU_MASK)==IMGFMT_VDPAU) -#define IMGFMT_VDPAU_MPEG1 (IMGFMT_VDPAU|0x01) -#define IMGFMT_VDPAU_MPEG2 (IMGFMT_VDPAU|0x02) -#define IMGFMT_VDPAU_H264 (IMGFMT_VDPAU|0x03) -#define IMGFMT_VDPAU_WMV3 (IMGFMT_VDPAU|0x04) -#define IMGFMT_VDPAU_VC1 (IMGFMT_VDPAU|0x05) -#define IMGFMT_VDPAU_MPEG4 (IMGFMT_VDPAU|0x06) - -#define IMGFMT_IS_HWACCEL(fmt) (IMGFMT_IS_VDPAU(fmt) || IMGFMT_IS_XVMC(fmt)) - -typedef struct { - void* data; - int size; - int id; // stream id. usually 0x1E0 - int timestamp; // pts, 90000 Hz counter based -} vo_mpegpes_t; - -const char *ff_vo_format_name(int format); - -/** - * Calculates the scale shifts for the chroma planes for planar YUV - * - * \param component_bits bits per component - * \return bits-per-pixel for format if successful (i.e. format is 3 or 4-planes planar YUV), 0 otherwise - */ -int ff_mp_get_chroma_shift(int format, int *x_shift, int *y_shift, int *component_bits); - -#endif /* MPLAYER_IMG_FORMAT_H */ diff --git a/libavfilter/libmpcodecs/libvo/fastmemcpy.h b/libavfilter/libmpcodecs/libvo/fastmemcpy.h deleted file mode 100644 index 5a17d01..0000000 --- a/libavfilter/libmpcodecs/libvo/fastmemcpy.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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 - */ - -#ifndef MPLAYER_FASTMEMCPY_H -#define MPLAYER_FASTMEMCPY_H - -#include <inttypes.h> -#include <string.h> -#include <stddef.h> - -void * fast_memcpy(void * to, const void * from, size_t len); -void * mem2agpcpy(void * to, const void * from, size_t len); - -#if ! defined(CONFIG_FASTMEMCPY) || ! (HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW /* || HAVE_SSE || HAVE_SSE2 */) -#define mem2agpcpy(a,b,c) memcpy(a,b,c) -#define fast_memcpy(a,b,c) memcpy(a,b,c) -#endif - -static inline void * mem2agpcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride) -{ - int i; - void *retval=dst; - - if(dstStride == srcStride) - { - if (srcStride < 0) { - src = (const uint8_t*)src + (height-1)*srcStride; - dst = (uint8_t*)dst + (height-1)*dstStride; - srcStride = -srcStride; - } - - mem2agpcpy(dst, src, srcStride*height); - } - else - { - for(i=0; i<height; i++) - { - mem2agpcpy(dst, src, bytesPerLine); - src = (const uint8_t*)src + srcStride; - dst = (uint8_t*)dst + dstStride; - } - } - - return retval; -} - -#define memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 0) -#define my_memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 1) - -/** - * \param limit2width always skip data between end of line and start of next - * instead of copying the full block when strides are the same - */ -static inline void * memcpy_pic2(void * dst, const void * src, - int bytesPerLine, int height, - int dstStride, int srcStride, int limit2width) -{ - int i; - void *retval=dst; - - if(!limit2width && dstStride == srcStride) - { - if (srcStride < 0) { - src = (const uint8_t*)src + (height-1)*srcStride; - dst = (uint8_t*)dst + (height-1)*dstStride; - srcStride = -srcStride; - } - - fast_memcpy(dst, src, srcStride*height); - } - else - { - for(i=0; i<height; i++) - { - fast_memcpy(dst, src, bytesPerLine); - src = (const uint8_t*)src + srcStride; - dst = (uint8_t*)dst + dstStride; - } - } - - return retval; -} - -#endif /* MPLAYER_FASTMEMCPY_H */ diff --git a/libavfilter/libmpcodecs/mp_image.c b/libavfilter/libmpcodecs/mp_image.c deleted file mode 100644 index 0e4d6d7..0000000 --- a/libavfilter/libmpcodecs/mp_image.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * 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 "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#if HAVE_MALLOC_H -#include <malloc.h> -#endif - -#include "img_format.h" -#include "mp_image.h" - -#include "libvo/fastmemcpy.h" -//#include "libavutil/mem.h" -#include "libavutil/imgutils.h" - -void ff_mp_image_alloc_planes(mp_image_t *mpi) { - uint32_t temp[256]; - if (avpriv_set_systematic_pal2(temp, ff_mp2ff_pix_fmt(mpi->imgfmt)) >= 0) - mpi->flags |= MP_IMGFLAG_RGB_PALETTE; - - // IF09 - allocate space for 4. plane delta info - unused - if (mpi->imgfmt == IMGFMT_IF09) { - mpi->planes[0]=av_malloc(mpi->bpp*mpi->width*(mpi->height+2)/8+ - mpi->chroma_width*mpi->chroma_height); - } else - mpi->planes[0]=av_malloc(mpi->bpp*mpi->width*(mpi->height+2)/8); - if (mpi->flags&MP_IMGFLAG_PLANAR) { - int bpp = IMGFMT_IS_YUVP16(mpi->imgfmt)? 2 : 1; - // YV12/I420/YVU9/IF09. feel free to add other planar formats here... - mpi->stride[0]=mpi->stride[3]=bpp*mpi->width; - if(mpi->num_planes > 2){ - mpi->stride[1]=mpi->stride[2]=bpp*mpi->chroma_width; - if(mpi->flags&MP_IMGFLAG_SWAPPED){ - // I420/IYUV (Y,U,V) - mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height; - mpi->planes[2]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_height; - if (mpi->num_planes > 3) - mpi->planes[3]=mpi->planes[2]+mpi->stride[2]*mpi->chroma_height; - } else { - // YV12,YVU9,IF09 (Y,V,U) - mpi->planes[2]=mpi->planes[0]+mpi->stride[0]*mpi->height; - mpi->planes[1]=mpi->planes[2]+mpi->stride[1]*mpi->chroma_height; - if (mpi->num_planes > 3) - mpi->planes[3]=mpi->planes[1]+mpi->stride[1]*mpi->chroma_height; - } - } else { - // NV12/NV21 - mpi->stride[1]=mpi->chroma_width; - mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height; - } - } else { - mpi->stride[0]=mpi->width*mpi->bpp/8; - if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) { - mpi->planes[1] = av_malloc(1024); - memcpy(mpi->planes[1], temp, 1024); - } - } - mpi->flags|=MP_IMGFLAG_ALLOCATED; -} - -mp_image_t* ff_alloc_mpi(int w, int h, unsigned long int fmt) { - mp_image_t* mpi = ff_new_mp_image(w,h); - - ff_mp_image_setfmt(mpi,fmt); - ff_mp_image_alloc_planes(mpi); - - return mpi; -} - -void ff_copy_mpi(mp_image_t *dmpi, mp_image_t *mpi) { - if(mpi->flags&MP_IMGFLAG_PLANAR){ - memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0],mpi->stride[0]); - 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]); - } else { - memcpy_pic(dmpi->planes[0],mpi->planes[0], - mpi->w*(dmpi->bpp/8), mpi->h, - dmpi->stride[0],mpi->stride[0]); - } -} - -void ff_mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ - mpi->flags&=~(MP_IMGFLAG_PLANAR|MP_IMGFLAG_YUV|MP_IMGFLAG_SWAPPED); - mpi->imgfmt=out_fmt; - // compressed formats - if(out_fmt == IMGFMT_MPEGPES || - out_fmt == IMGFMT_ZRMJPEGNI || out_fmt == IMGFMT_ZRMJPEGIT || out_fmt == IMGFMT_ZRMJPEGIB || - IMGFMT_IS_HWACCEL(out_fmt)){ - mpi->bpp=0; - return; - } - mpi->num_planes=1; - if (IMGFMT_IS_RGB(out_fmt)) { - if (IMGFMT_RGB_DEPTH(out_fmt) < 8 && !(out_fmt&128)) - mpi->bpp = IMGFMT_RGB_DEPTH(out_fmt); - else - mpi->bpp=(IMGFMT_RGB_DEPTH(out_fmt)+7)&(~7); - return; - } - if (IMGFMT_IS_BGR(out_fmt)) { - if (IMGFMT_BGR_DEPTH(out_fmt) < 8 && !(out_fmt&128)) - mpi->bpp = IMGFMT_BGR_DEPTH(out_fmt); - else - mpi->bpp=(IMGFMT_BGR_DEPTH(out_fmt)+7)&(~7); - mpi->flags|=MP_IMGFLAG_SWAPPED; - return; - } - if (IMGFMT_IS_XYZ(out_fmt)) { - mpi->bpp=3*((IMGFMT_XYZ_DEPTH(out_fmt) + 7) & ~7); - return; - } - mpi->num_planes=3; - if (out_fmt == IMGFMT_GBR24P) { - mpi->bpp=24; - mpi->flags|=MP_IMGFLAG_PLANAR; - return; - } else if (out_fmt == IMGFMT_GBR12P) { - mpi->bpp=36; - mpi->flags|=MP_IMGFLAG_PLANAR; - return; - } else if (out_fmt == IMGFMT_GBR14P) { - mpi->bpp=42; - mpi->flags|=MP_IMGFLAG_PLANAR; - return; - } - mpi->flags|=MP_IMGFLAG_YUV; - if (ff_mp_get_chroma_shift(out_fmt, NULL, NULL, NULL)) { - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp = ff_mp_get_chroma_shift(out_fmt, &mpi->chroma_x_shift, &mpi->chroma_y_shift, NULL); - mpi->chroma_width = mpi->width >> mpi->chroma_x_shift; - mpi->chroma_height = mpi->height >> mpi->chroma_y_shift; - } - switch(out_fmt){ - case IMGFMT_I420: - case IMGFMT_IYUV: - mpi->flags|=MP_IMGFLAG_SWAPPED; - case IMGFMT_YV12: - return; - case IMGFMT_420A: - case IMGFMT_422A: - case IMGFMT_444A: - case IMGFMT_IF09: - mpi->num_planes=4; - case IMGFMT_YVU9: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - case IMGFMT_440P: - case IMGFMT_444P16_LE: - case IMGFMT_444P16_BE: - case IMGFMT_444P14_LE: - case IMGFMT_444P14_BE: - case IMGFMT_444P12_LE: - case IMGFMT_444P12_BE: - case IMGFMT_444P10_LE: - case IMGFMT_444P10_BE: - case IMGFMT_444P9_LE: - case IMGFMT_444P9_BE: - case IMGFMT_422P16_LE: - case IMGFMT_422P16_BE: - case IMGFMT_422P14_LE: - case IMGFMT_422P14_BE: - case IMGFMT_422P12_LE: - case IMGFMT_422P12_BE: - case IMGFMT_422P10_LE: - case IMGFMT_422P10_BE: - case IMGFMT_422P9_LE: - case IMGFMT_422P9_BE: - case IMGFMT_420P16_LE: - case IMGFMT_420P16_BE: - case IMGFMT_420P14_LE: - case IMGFMT_420P14_BE: - case IMGFMT_420P12_LE: - case IMGFMT_420P12_BE: - case IMGFMT_420P10_LE: - case IMGFMT_420P10_BE: - case IMGFMT_420P9_LE: - case IMGFMT_420P9_BE: - return; - case IMGFMT_Y16_LE: - case IMGFMT_Y16_BE: - mpi->bpp=16; - case IMGFMT_Y800: - case IMGFMT_Y8: - /* they're planar ones, but for easier handling use them as packed */ - mpi->flags&=~MP_IMGFLAG_PLANAR; - mpi->num_planes=1; - return; - case IMGFMT_Y8A: - mpi->num_planes=2; - return; - case IMGFMT_UYVY: - mpi->flags|=MP_IMGFLAG_SWAPPED; - case IMGFMT_YUY2: - mpi->chroma_x_shift = 1; - mpi->bpp=16; - mpi->num_planes=1; - return; - case IMGFMT_NV12: - mpi->flags|=MP_IMGFLAG_SWAPPED; - case IMGFMT_NV21: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=12; - mpi->num_planes=2; - mpi->chroma_width=(mpi->width>>0); - mpi->chroma_height=(mpi->height>>1); - mpi->chroma_x_shift=0; - mpi->chroma_y_shift=1; - return; - } - ff_mp_msg(MSGT_DECVIDEO,MSGL_WARN,"mp_image: unknown out_fmt: 0x%X\n",out_fmt); - mpi->bpp=0; -} - -mp_image_t* ff_new_mp_image(int w,int h){ - mp_image_t* mpi = malloc(sizeof(mp_image_t)); - if(!mpi) return NULL; // error! - memset(mpi,0,sizeof(mp_image_t)); - mpi->width=mpi->w=w; - mpi->height=mpi->h=h; - return mpi; -} - -void ff_free_mp_image(mp_image_t* mpi){ - if(!mpi) return; - if(mpi->flags&MP_IMGFLAG_ALLOCATED){ - /* because we allocate the whole image at once */ - av_free(mpi->planes[0]); - if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) - av_free(mpi->planes[1]); - } - free(mpi); -} - diff --git a/libavfilter/libmpcodecs/mp_image.h b/libavfilter/libmpcodecs/mp_image.h deleted file mode 100644 index aedf451..0000000 --- a/libavfilter/libmpcodecs/mp_image.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ - -#ifndef MPLAYER_MP_IMAGE_H -#define MPLAYER_MP_IMAGE_H - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#undef printf //FIXME -#undef fprintf //FIXME -#include "mp_msg.h" -#include "libavutil/avutil.h" -#include "libavutil/avassert.h" -#undef realloc -#undef malloc -#undef free -#undef rand -#undef srand -#undef printf -#undef strncpy -#define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t" -#define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC). - -enum AVPixelFormat ff_mp2ff_pix_fmt(int mp); - -//--------- codec's requirements (filled by the codec/vf) --------- - -//--- buffer content restrictions: -// set if buffer content shouldn't be modified: -#define MP_IMGFLAG_PRESERVE 0x01 -// set if buffer content will be READ. -// This can be e.g. for next frame's MC: (I/P mpeg frames) - -// then in combination with MP_IMGFLAG_PRESERVE - or it -// can be because a video filter or codec will read a significant -// amount of data while processing that frame (e.g. blending something -// onto the frame, MV based intra prediction). -// A frame marked like this should not be placed in to uncachable -// video RAM for example. -#define MP_IMGFLAG_READABLE 0x02 - -//--- buffer width/stride/plane restrictions: (used for direct rendering) -// stride _have_to_ be aligned to MB boundary: [for DR restrictions] -#define MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE 0x4 -// stride should be aligned to MB boundary: [for buffer allocation] -#define MP_IMGFLAG_PREFER_ALIGNED_STRIDE 0x8 -// codec accept any stride (>=width): -#define MP_IMGFLAG_ACCEPT_STRIDE 0x10 -// codec accept any width (width*bpp=stride -> stride%bpp==0) (>=width): -#define MP_IMGFLAG_ACCEPT_WIDTH 0x20 -//--- for planar formats only: -// uses only stride[0], and stride[1]=stride[2]=stride[0]>>mpi->chroma_x_shift -#define MP_IMGFLAG_COMMON_STRIDE 0x40 -// uses only planes[0], and calculates planes[1,2] from width,height,imgfmt -#define MP_IMGFLAG_COMMON_PLANE 0x80 - -#define MP_IMGFLAGMASK_RESTRICTIONS 0xFF - -//--------- color info (filled by ff_mp_image_setfmt() ) ----------- -// set if number of planes > 1 -#define MP_IMGFLAG_PLANAR 0x100 -// set if it's YUV colorspace -#define MP_IMGFLAG_YUV 0x200 -// set if it's swapped (BGR or YVU) plane/byteorder -#define MP_IMGFLAG_SWAPPED 0x400 -// set if you want memory for palette allocated and managed by ff_vf_get_image etc. -#define MP_IMGFLAG_RGB_PALETTE 0x800 - -#define MP_IMGFLAGMASK_COLORS 0xF00 - -// codec uses drawing/rendering callbacks (draw_slice()-like thing, DR method 2) -// [the codec will set this flag if it supports callbacks, and the vo _may_ -// clear it in get_image() if draw_slice() not implemented] -#define MP_IMGFLAG_DRAW_CALLBACK 0x1000 -// set if it's in video buffer/memory: [set by vo/vf's get_image() !!!] -#define MP_IMGFLAG_DIRECT 0x2000 -// set if buffer is allocated (used in destination images): -#define MP_IMGFLAG_ALLOCATED 0x4000 - -// buffer type was printed (do NOT set this flag - it's for INTERNAL USE!!!) -#define MP_IMGFLAG_TYPE_DISPLAYED 0x8000 - -// codec doesn't support any form of direct rendering - it has own buffer -// allocation. so we just export its buffer pointers: -#define MP_IMGTYPE_EXPORT 0 -// codec requires a static WO buffer, but it does only partial updates later: -#define MP_IMGTYPE_STATIC 1 -// codec just needs some WO memory, where it writes/copies the whole frame to: -#define MP_IMGTYPE_TEMP 2 -// I+P type, requires 2+ independent static R/W buffers -#define MP_IMGTYPE_IP 3 -// I+P+B type, requires 2+ independent static R/W and 1+ temp WO buffers -#define MP_IMGTYPE_IPB 4 -// Upper 16 bits give desired buffer number, -1 means get next available -#define MP_IMGTYPE_NUMBERED 5 -// Doesn't need any buffer, incomplete image (probably a first field only) -// we need this type to be able to differentiate between half frames and -// all other cases -#define MP_IMGTYPE_INCOMPLETE 6 - -#define MP_MAX_PLANES 4 - -#define MP_IMGFIELD_ORDERED 0x01 -#define MP_IMGFIELD_TOP_FIRST 0x02 -#define MP_IMGFIELD_REPEAT_FIRST 0x04 -#define MP_IMGFIELD_TOP 0x08 -#define MP_IMGFIELD_BOTTOM 0x10 -#define MP_IMGFIELD_INTERLACED 0x20 - -typedef struct mp_image { - unsigned int flags; - unsigned char type; - int number; - unsigned char bpp; // bits/pixel. NOT depth! for RGB it will be n*8 - unsigned int imgfmt; - int width,height; // stored dimensions - int x,y,w,h; // visible dimensions - unsigned char* planes[MP_MAX_PLANES]; - int stride[MP_MAX_PLANES]; - char * qscale; - int qstride; - int pict_type; // 0->unknown, 1->I, 2->P, 3->B - int fields; - int qscale_type; // 0->mpeg1/4/h263, 1->mpeg2 - int num_planes; - /* these are only used by planar formats Y,U(Cb),V(Cr) */ - int chroma_width; - int chroma_height; - int chroma_x_shift; // horizontal - int chroma_y_shift; // vertical - int usage_count; - /* for private use by filter or vo driver (to store buffer id or dmpi) */ - void* priv; -} mp_image_t; - -void ff_mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt); -mp_image_t* ff_new_mp_image(int w,int h); -void ff_free_mp_image(mp_image_t* mpi); - -mp_image_t* ff_alloc_mpi(int w, int h, unsigned long int fmt); -void ff_mp_image_alloc_planes(mp_image_t *mpi); -void ff_copy_mpi(mp_image_t *dmpi, mp_image_t *mpi); - -#endif /* MPLAYER_MP_IMAGE_H */ diff --git a/libavfilter/libmpcodecs/mp_msg.h b/libavfilter/libmpcodecs/mp_msg.h deleted file mode 100644 index 51cdff3..0000000 --- a/libavfilter/libmpcodecs/mp_msg.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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. - */ - -#ifndef MPLAYER_MP_MSG_H -#define MPLAYER_MP_MSG_H - -#include <stdarg.h> - -// defined in mplayer.c and mencoder.c -extern int verbose; - -// verbosity elevel: - -/* Only messages level MSGL_FATAL-MSGL_STATUS should be translated, - * messages level MSGL_V and above should not be translated. */ - -#define MSGL_FATAL 0 // will exit/abort -#define MSGL_ERR 1 // continues -#define MSGL_WARN 2 // only warning -#define MSGL_HINT 3 // short help message -#define MSGL_INFO 4 // -quiet -#define MSGL_STATUS 5 // v=0 -#define MSGL_V 6 // v=1 -#define MSGL_DBG2 7 // v=2 -#define MSGL_DBG3 8 // v=3 -#define MSGL_DBG4 9 // v=4 -#define MSGL_DBG5 10 // v=5 - -#define MSGL_FIXME 1 // for conversions from printf where the appropriate MSGL is not known; set equal to ERR for obtrusiveness -#define MSGT_FIXME 0 // for conversions from printf where the appropriate MSGT is not known; set equal to GLOBAL for obtrusiveness - -// code/module: - -#define MSGT_GLOBAL 0 // common player stuff errors -#define MSGT_CPLAYER 1 // console player (mplayer.c) -#define MSGT_GPLAYER 2 // gui player - -#define MSGT_VO 3 // libvo -#define MSGT_AO 4 // libao - -#define MSGT_DEMUXER 5 // demuxer.c (general stuff) -#define MSGT_DS 6 // demux stream (add/read packet etc) -#define MSGT_DEMUX 7 // fileformat-specific stuff (demux_*.c) -#define MSGT_HEADER 8 // fileformat-specific header (*header.c) - -#define MSGT_AVSYNC 9 // mplayer.c timer stuff -#define MSGT_AUTOQ 10 // mplayer.c auto-quality stuff - -#define MSGT_CFGPARSER 11 // cfgparser.c - -#define MSGT_DECAUDIO 12 // av decoder -#define MSGT_DECVIDEO 13 - -#define MSGT_SEEK 14 // seeking code -#define MSGT_WIN32 15 // win32 dll stuff -#define MSGT_OPEN 16 // open.c (stream opening) -#define MSGT_DVD 17 // open.c (DVD init/read/seek) - -#define MSGT_PARSEES 18 // parse_es.c (mpeg stream parser) -#define MSGT_LIRC 19 // lirc_mp.c and input lirc driver - -#define MSGT_STREAM 20 // stream.c -#define MSGT_CACHE 21 // cache2.c - -#define MSGT_MENCODER 22 - -#define MSGT_XACODEC 23 // XAnim codecs - -#define MSGT_TV 24 // TV input subsystem - -#define MSGT_OSDEP 25 // OS-dependent parts - -#define MSGT_SPUDEC 26 // spudec.c - -#define MSGT_PLAYTREE 27 // Playtree handeling (playtree.c, playtreeparser.c) - -#define MSGT_INPUT 28 - -#define MSGT_VFILTER 29 - -#define MSGT_OSD 30 - -#define MSGT_NETWORK 31 - -#define MSGT_CPUDETECT 32 - -#define MSGT_CODECCFG 33 - -#define MSGT_SWS 34 - -#define MSGT_VOBSUB 35 -#define MSGT_SUBREADER 36 - -#define MSGT_AFILTER 37 // Audio filter messages - -#define MSGT_NETST 38 // Netstream - -#define MSGT_MUXER 39 // muxer layer - -#define MSGT_OSD_MENU 40 - -#define MSGT_IDENTIFY 41 // -identify output - -#define MSGT_RADIO 42 - -#define MSGT_ASS 43 // libass messages - -#define MSGT_LOADER 44 // dll loader messages - -#define MSGT_STATUSLINE 45 // playback/encoding status line - -#define MSGT_TELETEXT 46 // Teletext decoder - -#define MSGT_MAX 64 - - -extern char *ff_mp_msg_charset; -extern int ff_mp_msg_color; -extern int ff_mp_msg_module; - -extern int ff_mp_msg_levels[MSGT_MAX]; -extern int ff_mp_msg_level_all; - - -void ff_mp_msg_init(void); -int ff_mp_msg_test(int mod, int lev); - -#include "config.h" - -void ff_mp_msg_va(int mod, int lev, const char *format, va_list va); -#ifdef __GNUC__ -void ff_mp_msg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4))); -# ifdef MP_DEBUG -# define mp_dbg(mod,lev, args... ) ff_mp_msg(mod, lev, ## args ) -# else - // only useful for developers, disable but check syntax -# define mp_dbg(mod,lev, args... ) do { if (0) ff_mp_msg(mod, lev, ## args ); } while (0) -# endif -#else // not GNU C -void ff_mp_msg(int mod, int lev, const char *format, ... ); -# ifdef MP_DEBUG -# define mp_dbg(mod,lev, ... ) ff_mp_msg(mod, lev, __VA_ARGS__) -# else - // only useful for developers, disable but check syntax -# define mp_dbg(mod,lev, ... ) do { if (0) ff_mp_msg(mod, lev, __VA_ARGS__); } while (0) -# endif -#endif /* __GNUC__ */ - -const char* ff_filename_recode(const char* filename); - -#endif /* MPLAYER_MP_MSG_H */ diff --git a/libavfilter/libmpcodecs/vf.h b/libavfilter/libmpcodecs/vf.h deleted file mode 100644 index 7cda60b..0000000 --- a/libavfilter/libmpcodecs/vf.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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. - */ - -#ifndef MPLAYER_VF_H -#define MPLAYER_VF_H - -//#include "m_option.h" -#include "mp_image.h" - -//extern m_obj_settings_t* vf_settings; -//extern const m_obj_list_t vf_obj_list; - -struct vf_instance; -struct vf_priv_s; - -typedef struct vf_info_s { - const char *info; - const char *name; - const char *author; - const char *comment; - int (*vf_open)(struct vf_instance *vf,char* args); - // Ptr to a struct dscribing the options - const void* opts; -} vf_info_t; - -#define NUM_NUMBERED_MPI 50 - -typedef struct vf_image_context_s { - mp_image_t* static_images[2]; - mp_image_t* temp_images[1]; - mp_image_t* export_images[1]; - mp_image_t* numbered_images[NUM_NUMBERED_MPI]; - int static_idx; -} vf_image_context_t; - -typedef struct vf_format_context_t { - int have_configured; - int orig_width, orig_height, orig_fmt; -} vf_format_context_t; - -typedef struct vf_instance { - const vf_info_t* info; - // funcs: - int (*config)(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt); - int (*control)(struct vf_instance *vf, - int request, void* data); - int (*query_format)(struct vf_instance *vf, - unsigned int fmt); - void (*get_image)(struct vf_instance *vf, - mp_image_t *mpi); - int (*put_image)(struct vf_instance *vf, - mp_image_t *mpi, double pts); - void (*start_slice)(struct vf_instance *vf, - mp_image_t *mpi); - void (*draw_slice)(struct vf_instance *vf, - unsigned char** src, int* stride, int w,int h, int x, int y); - void (*uninit)(struct vf_instance *vf); - - int (*continue_buffered_image)(struct vf_instance *vf); - // caps: - unsigned int default_caps; // used by default query_format() - unsigned int default_reqs; // used by default config() - // data: - int w, h; - vf_image_context_t imgctx; - vf_format_context_t fmt; - struct vf_instance *next; - mp_image_t *dmpi; - struct vf_priv_s* priv; -} vf_instance_t; - -// control codes: -typedef struct vf_seteq_s -{ - const char *item; - int value; -} vf_equalizer_t; - -#define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */ -#define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */ -#define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ -#define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */ -#define VFCTRL_DRAW_OSD 7 -#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */ -#define VFCTRL_FLIP_PAGE 10 /* Tell the vo to flip pages */ -#define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */ -#define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes through */ -#define VFCTRL_FLUSH_FRAMES 13 /* For encoding - flush delayed frames */ -#define VFCTRL_SCREENSHOT 14 /* Make a screenshot */ -#define VFCTRL_INIT_EOSD 15 /* Select EOSD renderer */ -#define VFCTRL_DRAW_EOSD 16 /* Render EOSD */ -#define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/ -#define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */ -#define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */ - -#include "vfcap.h" - -//FIXME this should be in a common header, but i dunno which -#define MP_NOPTS_VALUE (-1LL<<63) //both int64_t and double should be able to represent this exactly - - -// functions: -void ff_vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h); -mp_image_t* ff_vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h); - -vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args); -vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args); -vf_instance_t* ff_vf_add_before_vo(vf_instance_t **vf, char *name, char **args); -vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args); - -unsigned int ff_vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred); -void ff_vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src); -void ff_vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *)); -int ff_vf_output_queued_frame(vf_instance_t *vf); - -// default wrappers: -int ff_vf_next_config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt); -int ff_vf_next_control(struct vf_instance *vf, int request, void* data); -void ff_vf_extra_flip(struct vf_instance *vf); -int ff_vf_next_query_format(struct vf_instance *vf, unsigned int fmt); -int ff_vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts); -void ff_vf_next_draw_slice (struct vf_instance *vf, unsigned char** src, int* stride, int w,int h, int x, int y); - -vf_instance_t* ff_append_filters(vf_instance_t* last); - -void ff_vf_uninit_filter(vf_instance_t* vf); -void ff_vf_uninit_filter_chain(vf_instance_t* vf); - -int ff_vf_config_wrapper(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt); - -static inline int norm_qscale(int qscale, int type) -{ - switch (type) { - case 0: // MPEG-1 - return qscale; - case 1: // MPEG-2 - return qscale >> 1; - case 2: // H264 - return qscale >> 2; - case 3: // VP56 - return (63 - qscale + 2) >> 2; - } - return qscale; -} - -#endif /* MPLAYER_VF_H */ diff --git a/libavfilter/libmpcodecs/vf_softpulldown.c b/libavfilter/libmpcodecs/vf_softpulldown.c deleted file mode 100644 index 556374e..0000000 --- a/libavfilter/libmpcodecs/vf_softpulldown.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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 "img_format.h" -#include "mp_image.h" -#include "vf.h" - -#include "libvo/fastmemcpy.h" - -struct vf_priv_s { - int state; - long long in; - long long out; -}; - -static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) -{ - mp_image_t *dmpi; - int ret = 0; - int flags = mpi->fields; - int state = vf->priv->state; - - dmpi = ff_vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); - - vf->priv->in++; - - if ((state == 0 && - !(flags & MP_IMGFIELD_TOP_FIRST)) || - (state == 1 && - flags & MP_IMGFIELD_TOP_FIRST)) { - ff_mp_msg(MSGT_VFILTER, MSGL_WARN, - "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n", - state, - (flags & MP_IMGFIELD_TOP_FIRST) != 0, - (flags & MP_IMGFIELD_REPEAT_FIRST) != 0); - state ^= 1; - } - - if (state == 0) { - ret = ff_vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); - vf->priv->out++; - if (flags & MP_IMGFIELD_REPEAT_FIRST) { - my_memcpy_pic(dmpi->planes[0], - mpi->planes[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1], - mpi->planes[1], - mpi->chroma_width, - mpi->chroma_height/2, - dmpi->stride[1]*2, - mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2], - mpi->planes[2], - mpi->chroma_width, - mpi->chroma_height/2, - dmpi->stride[2]*2, - mpi->stride[2]*2); - } - state=1; - } - } else { - my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], - mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], - mpi->planes[1]+mpi->stride[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], - mpi->planes[2]+mpi->stride[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - ret = ff_vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); - vf->priv->out++; - if (flags & MP_IMGFIELD_REPEAT_FIRST) { - ret |= ff_vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); - vf->priv->out++; - state=0; - } else { - my_memcpy_pic(dmpi->planes[0], - mpi->planes[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1], - mpi->planes[1], - mpi->chroma_width, - mpi->chroma_height/2, - dmpi->stride[1]*2, - mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2], - mpi->planes[2], - mpi->chroma_width, - mpi->chroma_height/2, - dmpi->stride[2]*2, - mpi->stride[2]*2); - } - } - } - - vf->priv->state = state; - - return ret; -} - -static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) -{ - return ff_vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); -} - -static void uninit(struct vf_instance *vf) -{ - ff_mp_msg(MSGT_VFILTER, MSGL_INFO, "softpulldown: %lld frames in, %lld frames out\n", vf->priv->in, vf->priv->out); - free(vf->priv); -} - -static int vf_open(vf_instance_t *vf, char *args) -{ - vf->config = config; - vf->put_image = put_image; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = calloc(1, sizeof(struct vf_priv_s)); - vf->priv->state = 0; - return 1; -} - -const vf_info_t ff_vf_info_softpulldown = { - "mpeg2 soft 3:2 pulldown", - "softpulldown", - "Tobias Diedrich <ranma+mpla...@tdiedrich.de>", - "", - vf_open, - NULL -}; diff --git a/libavfilter/libmpcodecs/vfcap.h b/libavfilter/libmpcodecs/vfcap.h deleted file mode 100644 index 611d642..0000000 --- a/libavfilter/libmpcodecs/vfcap.h +++ /dev/null @@ -1,56 +0,0 @@ -/* VFCAP_* values: they are flags, returned by query_format(): - * - * 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. - */ - -#ifndef MPLAYER_VFCAP_H -#define MPLAYER_VFCAP_H - -// set, if the given colorspace is supported (with or without conversion) -#define VFCAP_CSP_SUPPORTED 0x1 -// set, if the given colorspace is supported _without_ conversion -#define VFCAP_CSP_SUPPORTED_BY_HW 0x2 -// set if the driver/filter can draw OSD -#define VFCAP_OSD 0x4 -// set if the driver/filter can handle compressed SPU stream -#define VFCAP_SPU 0x8 -// scaling up/down by hardware, or software: -#define VFCAP_HWSCALE_UP 0x10 -#define VFCAP_HWSCALE_DOWN 0x20 -#define VFCAP_SWSCALE 0x40 -// driver/filter can do vertical flip (upside-down) -#define VFCAP_FLIP 0x80 - -// driver/hardware handles timing (blocking) -#define VFCAP_TIMER 0x100 -// driver _always_ flip image upside-down (for ve_vfw) -#define VFCAP_FLIPPED 0x200 -// vf filter: accepts stride (put_image) -// vo driver: has draw_slice() support for the given csp -#define VFCAP_ACCEPT_STRIDE 0x400 -// filter does postprocessing (so you shouldn't scale/filter image before it) -#define VFCAP_POSTPROC 0x800 -// filter cannot be reconfigured to different size & format -#define VFCAP_CONSTANT 0x1000 -// filter can draw EOSD -#define VFCAP_EOSD 0x2000 -// filter will draw EOSD at screen resolution (without scaling) -#define VFCAP_EOSD_UNSCALED 0x4000 -// used by libvo and vf_vo, indicates the VO does not support draw_slice for this format -#define VOCAP_NOSLICES 0x8000 - -#endif /* MPLAYER_VFCAP_H */ diff --git a/libavfilter/version.h b/libavfilter/version.h index ce22f7b..4e50688 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,8 +30,8 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 5 -#define LIBAVFILTER_VERSION_MINOR 9 -#define LIBAVFILTER_VERSION_MICRO 101 +#define LIBAVFILTER_VERSION_MINOR 10 +#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ LIBAVFILTER_VERSION_MINOR, \ diff --git a/libavfilter/vf_mp.c b/libavfilter/vf_mp.c deleted file mode 100644 index 63fdedd..0000000 --- a/libavfilter/vf_mp.c +++ /dev/null @@ -1,772 +0,0 @@ -/* - * Copyright (c) 2011 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg 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. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Parts of this file have been stolen from mplayer - */ - -/** - * @file - */ - -#include "avfilter.h" -#include "video.h" -#include "formats.h" -#include "internal.h" -#include "libavutil/avassert.h" -#include "libavutil/pixdesc.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/imgutils.h" -#include "libavutil/opt.h" - -#include "libmpcodecs/vf.h" -#include "libmpcodecs/img_format.h" -#include "libmpcodecs/cpudetect.h" -#include "libmpcodecs/libvo/fastmemcpy.h" - -#include "libswscale/swscale.h" - - -//FIXME maybe link the orig in -//XXX: identical pix_fmt must be following with each others -static const struct { - int fmt; - enum AVPixelFormat pix_fmt; -} conversion_map[] = { - {IMGFMT_ARGB, AV_PIX_FMT_ARGB}, - {IMGFMT_BGRA, AV_PIX_FMT_BGRA}, - {IMGFMT_BGR24, AV_PIX_FMT_BGR24}, - {IMGFMT_BGR16BE, AV_PIX_FMT_RGB565BE}, - {IMGFMT_BGR16LE, AV_PIX_FMT_RGB565LE}, - {IMGFMT_BGR15BE, AV_PIX_FMT_RGB555BE}, - {IMGFMT_BGR15LE, AV_PIX_FMT_RGB555LE}, - {IMGFMT_BGR12BE, AV_PIX_FMT_RGB444BE}, - {IMGFMT_BGR12LE, AV_PIX_FMT_RGB444LE}, - {IMGFMT_BGR8, AV_PIX_FMT_RGB8}, - {IMGFMT_BGR4, AV_PIX_FMT_RGB4}, - {IMGFMT_BGR1, AV_PIX_FMT_MONOBLACK}, - {IMGFMT_RGB1, AV_PIX_FMT_MONOBLACK}, - {IMGFMT_RG4B, AV_PIX_FMT_BGR4_BYTE}, - {IMGFMT_BG4B, AV_PIX_FMT_RGB4_BYTE}, - {IMGFMT_RGB48LE, AV_PIX_FMT_RGB48LE}, - {IMGFMT_RGB48BE, AV_PIX_FMT_RGB48BE}, - {IMGFMT_ABGR, AV_PIX_FMT_ABGR}, - {IMGFMT_RGBA, AV_PIX_FMT_RGBA}, - {IMGFMT_RGB24, AV_PIX_FMT_RGB24}, - {IMGFMT_RGB16BE, AV_PIX_FMT_BGR565BE}, - {IMGFMT_RGB16LE, AV_PIX_FMT_BGR565LE}, - {IMGFMT_RGB15BE, AV_PIX_FMT_BGR555BE}, - {IMGFMT_RGB15LE, AV_PIX_FMT_BGR555LE}, - {IMGFMT_RGB12BE, AV_PIX_FMT_BGR444BE}, - {IMGFMT_RGB12LE, AV_PIX_FMT_BGR444LE}, - {IMGFMT_RGB8, AV_PIX_FMT_BGR8}, - {IMGFMT_RGB4, AV_PIX_FMT_BGR4}, - {IMGFMT_BGR8, AV_PIX_FMT_PAL8}, - {IMGFMT_YUY2, AV_PIX_FMT_YUYV422}, - {IMGFMT_UYVY, AV_PIX_FMT_UYVY422}, - {IMGFMT_NV12, AV_PIX_FMT_NV12}, - {IMGFMT_NV21, AV_PIX_FMT_NV21}, - {IMGFMT_Y800, AV_PIX_FMT_GRAY8}, - {IMGFMT_Y8, AV_PIX_FMT_GRAY8}, - {IMGFMT_YVU9, AV_PIX_FMT_YUV410P}, - {IMGFMT_IF09, AV_PIX_FMT_YUV410P}, - {IMGFMT_YV12, AV_PIX_FMT_YUV420P}, - {IMGFMT_I420, AV_PIX_FMT_YUV420P}, - {IMGFMT_IYUV, AV_PIX_FMT_YUV420P}, - {IMGFMT_411P, AV_PIX_FMT_YUV411P}, - {IMGFMT_422P, AV_PIX_FMT_YUV422P}, - {IMGFMT_444P, AV_PIX_FMT_YUV444P}, - {IMGFMT_440P, AV_PIX_FMT_YUV440P}, - - {IMGFMT_420A, AV_PIX_FMT_YUVA420P}, - - {IMGFMT_420P16_LE, AV_PIX_FMT_YUV420P16LE}, - {IMGFMT_420P16_BE, AV_PIX_FMT_YUV420P16BE}, - {IMGFMT_422P16_LE, AV_PIX_FMT_YUV422P16LE}, - {IMGFMT_422P16_BE, AV_PIX_FMT_YUV422P16BE}, - {IMGFMT_444P16_LE, AV_PIX_FMT_YUV444P16LE}, - {IMGFMT_444P16_BE, AV_PIX_FMT_YUV444P16BE}, - - // YUVJ are YUV formats that use the full Y range and not just - // 16 - 235 (see colorspaces.txt). - // Currently they are all treated the same way. - {IMGFMT_YV12, AV_PIX_FMT_YUVJ420P}, - {IMGFMT_422P, AV_PIX_FMT_YUVJ422P}, - {IMGFMT_444P, AV_PIX_FMT_YUVJ444P}, - {IMGFMT_440P, AV_PIX_FMT_YUVJ440P}, - -#if FF_API_XVMC - {IMGFMT_XVMC_MOCO_MPEG2, AV_PIX_FMT_XVMC_MPEG2_MC}, - {IMGFMT_XVMC_IDCT_MPEG2, AV_PIX_FMT_XVMC_MPEG2_IDCT}, -#endif /* FF_API_XVMC */ - - {IMGFMT_VDPAU_MPEG1, AV_PIX_FMT_VDPAU_MPEG1}, - {IMGFMT_VDPAU_MPEG2, AV_PIX_FMT_VDPAU_MPEG2}, - {IMGFMT_VDPAU_H264, AV_PIX_FMT_VDPAU_H264}, - {IMGFMT_VDPAU_WMV3, AV_PIX_FMT_VDPAU_WMV3}, - {IMGFMT_VDPAU_VC1, AV_PIX_FMT_VDPAU_VC1}, - {IMGFMT_VDPAU_MPEG4, AV_PIX_FMT_VDPAU_MPEG4}, - {0, AV_PIX_FMT_NONE} -}; - -extern const vf_info_t ff_vf_info_softpulldown; - -static const vf_info_t* const filters[]={ - &ff_vf_info_softpulldown, - NULL -}; - -/* -Unsupported filters -1bpp -ass -bmovl -crop -dvbscale -flip -expand -format -halfpack -lavc -lavcdeint -noformat -pp -scale -tfields -vo -yadif -zrmjpeg -*/ - -CpuCaps ff_gCpuCaps; //FIXME initialize this so optims work - -enum AVPixelFormat ff_mp2ff_pix_fmt(int mp){ - int i; - for(i=0; conversion_map[i].fmt && mp != conversion_map[i].fmt; i++) - ; - return mp == conversion_map[i].fmt ? conversion_map[i].pix_fmt : AV_PIX_FMT_NONE; -} - -typedef struct { - const AVClass *class; - vf_instance_t vf; - vf_instance_t next_vf; - AVFilterContext *avfctx; - int frame_returned; - char *filter; - enum AVPixelFormat in_pix_fmt; -} MPContext; - -#define OFFSET(x) offsetof(MPContext, x) -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM -static const AVOption mp_options[] = { - { "filter", "set MPlayer filter name and parameters", OFFSET(filter), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS }, - { NULL } -}; - -AVFILTER_DEFINE_CLASS(mp); - -void ff_mp_msg(int mod, int lev, const char *format, ... ){ - va_list va; - va_start(va, format); - //FIXME convert lev/mod - av_vlog(NULL, AV_LOG_DEBUG, format, va); - va_end(va); -} - -int ff_mp_msg_test(int mod, int lev){ - return 123; -} - -//Exact copy of vf.c -void ff_vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src){ - dst->pict_type= src->pict_type; - dst->fields = src->fields; - dst->qscale_type= src->qscale_type; - if(dst->width == src->width && dst->height == src->height){ - dst->qstride= src->qstride; - dst->qscale= src->qscale; - } -} - -//Exact copy of vf.c -void ff_vf_next_draw_slice(struct vf_instance *vf,unsigned char** src, int * stride,int w, int h, int x, int y){ - if (vf->next->draw_slice) { - vf->next->draw_slice(vf->next,src,stride,w,h,x,y); - return; - } - if (!vf->dmpi) { - ff_mp_msg(MSGT_VFILTER,MSGL_ERR,"draw_slice: dmpi not stored by vf_%s\n", vf->info->name); - return; - } - if (!(vf->dmpi->flags & MP_IMGFLAG_PLANAR)) { - memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+vf->dmpi->bpp/8*x, - src[0], vf->dmpi->bpp/8*w, h, vf->dmpi->stride[0], stride[0]); - return; - } - memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+x, src[0], - w, h, vf->dmpi->stride[0], stride[0]); - memcpy_pic(vf->dmpi->planes[1]+(y>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[1]+(x>>vf->dmpi->chroma_x_shift), - src[1], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[1], stride[1]); - memcpy_pic(vf->dmpi->planes[2]+(y>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[2]+(x>>vf->dmpi->chroma_x_shift), - src[2], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[2], stride[2]); -} - -//Exact copy of vf.c -void ff_vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h){ - int y; - if(mpi->flags&MP_IMGFLAG_PLANAR){ - y0&=~1;h+=h&1; - if(x0==0 && w==mpi->width){ - // full width clear: - memset(mpi->planes[0]+mpi->stride[0]*y0,0,mpi->stride[0]*h); - memset(mpi->planes[1]+mpi->stride[1]*(y0>>mpi->chroma_y_shift),128,mpi->stride[1]*(h>>mpi->chroma_y_shift)); - memset(mpi->planes[2]+mpi->stride[2]*(y0>>mpi->chroma_y_shift),128,mpi->stride[2]*(h>>mpi->chroma_y_shift)); - } else - for(y=y0;y<y0+h;y+=2){ - memset(mpi->planes[0]+x0+mpi->stride[0]*y,0,w); - memset(mpi->planes[0]+x0+mpi->stride[0]*(y+1),0,w); - memset(mpi->planes[1]+(x0>>mpi->chroma_x_shift)+mpi->stride[1]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift)); - memset(mpi->planes[2]+(x0>>mpi->chroma_x_shift)+mpi->stride[2]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift)); - } - return; - } - // packed: - for(y=y0;y<y0+h;y++){ - unsigned char* dst=mpi->planes[0]+mpi->stride[0]*y+(mpi->bpp>>3)*x0; - if(mpi->flags&MP_IMGFLAG_YUV){ - unsigned int* p=(unsigned int*) dst; - int size=(mpi->bpp>>3)*w/4; - int i; -#if HAVE_BIGENDIAN -#define CLEAR_PACKEDYUV_PATTERN 0x00800080 -#define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x80008000 -#else -#define CLEAR_PACKEDYUV_PATTERN 0x80008000 -#define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x00800080 -#endif - if(mpi->flags&MP_IMGFLAG_SWAPPED){ - for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN_SWAPPED; - for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN_SWAPPED; - } else { - for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN; - for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN; - } - } else - memset(dst,0,(mpi->bpp>>3)*w); - } -} - -int ff_vf_next_query_format(struct vf_instance *vf, unsigned int fmt){ - return 1; -} - -//used by delogo -unsigned int ff_vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred){ - return preferred; -} - -mp_image_t* ff_vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h){ - MPContext *m= (MPContext*)(((uint8_t*)vf) - offsetof(MPContext, next_vf)); - mp_image_t* mpi=NULL; - int w2; - int number = mp_imgtype >> 16; - - av_assert0(vf->next == NULL); // all existing filters call this just on next - - //vf_dint needs these as it calls ff_vf_get_image() before configuring the output - if(vf->w==0 && w>0) vf->w=w; - if(vf->h==0 && h>0) vf->h=h; - - av_assert0(w == -1 || w >= vf->w); - av_assert0(h == -1 || h >= vf->h); - av_assert0(vf->w > 0); - av_assert0(vf->h > 0); - - av_log(m->avfctx, AV_LOG_DEBUG, "get_image: %d:%d, vf: %d:%d\n", w,h,vf->w,vf->h); - - if (w == -1) w = vf->w; - if (h == -1) h = vf->h; - - w2=(mp_imgflag&MP_IMGFLAG_ACCEPT_ALIGNED_STRIDE)?((w+15)&(~15)):w; - - // Note: we should call libvo first to check if it supports direct rendering - // and if not, then fallback to software buffers: - switch(mp_imgtype & 0xff){ - case MP_IMGTYPE_EXPORT: - if(!vf->imgctx.export_images[0]) vf->imgctx.export_images[0]=ff_new_mp_image(w2,h); - mpi=vf->imgctx.export_images[0]; - break; - case MP_IMGTYPE_STATIC: - if(!vf->imgctx.static_images[0]) vf->imgctx.static_images[0]=ff_new_mp_image(w2,h); - mpi=vf->imgctx.static_images[0]; - break; - case MP_IMGTYPE_TEMP: - if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=ff_new_mp_image(w2,h); - mpi=vf->imgctx.temp_images[0]; - break; - case MP_IMGTYPE_IPB: - if(!(mp_imgflag&MP_IMGFLAG_READABLE)){ // B frame: - if(!vf->imgctx.temp_images[0]) vf->imgctx.temp_images[0]=ff_new_mp_image(w2,h); - mpi=vf->imgctx.temp_images[0]; - break; - } - case MP_IMGTYPE_IP: - if(!vf->imgctx.static_images[vf->imgctx.static_idx]) vf->imgctx.static_images[vf->imgctx.static_idx]=ff_new_mp_image(w2,h); - mpi=vf->imgctx.static_images[vf->imgctx.static_idx]; - vf->imgctx.static_idx^=1; - break; - case MP_IMGTYPE_NUMBERED: - if (number == -1) { - int i; - for (i = 0; i < NUM_NUMBERED_MPI; i++) - if (!vf->imgctx.numbered_images[i] || !vf->imgctx.numbered_images[i]->usage_count) - break; - number = i; - } - if (number < 0 || number >= NUM_NUMBERED_MPI) return NULL; - if (!vf->imgctx.numbered_images[number]) vf->imgctx.numbered_images[number] = ff_new_mp_image(w2,h); - mpi = vf->imgctx.numbered_images[number]; - mpi->number = number; - break; - } - if(mpi){ - mpi->type=mp_imgtype; - mpi->w=vf->w; mpi->h=vf->h; - // keep buffer allocation status & color flags only: -// mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT); - mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; - // accept restrictions, draw_slice and palette flags only: - mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_RGB_PALETTE); - if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; - if(mpi->width!=w2 || mpi->height!=h){ -// printf("vf.c: MPI parameters changed! %dx%d -> %dx%d \n", mpi->width,mpi->height,w2,h); - if(mpi->flags&MP_IMGFLAG_ALLOCATED){ - if(mpi->width<w2 || mpi->height<h){ - // need to re-allocate buffer memory: - av_free(mpi->planes[0]); - mpi->flags&=~MP_IMGFLAG_ALLOCATED; - ff_mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory :(\n"); - } -// } else { - } { - mpi->width=w2; mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; - mpi->height=h; mpi->chroma_height=(h + (1<<mpi->chroma_y_shift) - 1)>>mpi->chroma_y_shift; - } - } - if(!mpi->bpp) ff_mp_image_setfmt(mpi,outfmt); - if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT){ - - av_assert0(!vf->get_image); - // check libvo first! - if(vf->get_image) vf->get_image(vf,mpi); - - if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - // non-direct and not yet allocated image. allocate it! - if (!mpi->bpp) { // no way we can allocate this - ff_mp_msg(MSGT_DECVIDEO, MSGL_FATAL, - "ff_vf_get_image: Tried to allocate a format that can not be allocated!\n"); - return NULL; - } - - // check if codec prefer aligned stride: - if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){ - int align=(mpi->flags&MP_IMGFLAG_PLANAR && - mpi->flags&MP_IMGFLAG_YUV) ? - (8<<mpi->chroma_x_shift)-1 : 15; // -- maybe FIXME - w2=((w+align)&(~align)); - if(mpi->width!=w2){ -#if 0 - // we have to change width... check if we CAN co it: - int flags=vf->query_format(vf,outfmt); // should not fail - if(!(flags&3)) ff_mp_msg(MSGT_DECVIDEO,MSGL_WARN,"??? ff_vf_get_image{vf->query_format(outfmt)} failed!\n"); -// printf("query -> 0x%X \n",flags); - if(flags&VFCAP_ACCEPT_STRIDE){ -#endif - mpi->width=w2; - mpi->chroma_width=(w2 + (1<<mpi->chroma_x_shift) - 1)>>mpi->chroma_x_shift; -// } - } - } - - ff_mp_image_alloc_planes(mpi); -// printf("clearing img!\n"); - ff_vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); - } - } - av_assert0(!vf->start_slice); - if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) - if(vf->start_slice) vf->start_slice(vf,mpi); - if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){ - ff_mp_msg(MSGT_DECVIDEO,MSGL_V,"*** [%s] %s%s mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n", - "NULL"/*vf->info->name*/, - (mpi->type==MP_IMGTYPE_EXPORT)?"Exporting": - ((mpi->flags&MP_IMGFLAG_DIRECT)?"Direct Rendering":"Allocating"), - (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)?" (slices)":"", - mpi->width,mpi->height,mpi->bpp, - (mpi->flags&MP_IMGFLAG_YUV)?"YUV":((mpi->flags&MP_IMGFLAG_SWAPPED)?"BGR":"RGB"), - (mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed", - mpi->bpp*mpi->width*mpi->height/8); - ff_mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"(imgfmt: %x, planes: %p,%p,%p strides: %d,%d,%d, chroma: %dx%d, shift: h:%d,v:%d)\n", - mpi->imgfmt, mpi->planes[0], mpi->planes[1], mpi->planes[2], - mpi->stride[0], mpi->stride[1], mpi->stride[2], - mpi->chroma_width, mpi->chroma_height, mpi->chroma_x_shift, mpi->chroma_y_shift); - mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED; - } - - mpi->qscale = NULL; - mpi->usage_count++; - } -// printf("\rVF_MPI: %p %p %p %d %d %d \n", -// mpi->planes[0],mpi->planes[1],mpi->planes[2], -// mpi->stride[0],mpi->stride[1],mpi->stride[2]); - return mpi; -} - -int ff_vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts){ - MPContext *m= (MPContext*)(((uint8_t*)vf) - offsetof(MPContext, vf)); - AVFilterLink *outlink = m->avfctx->outputs[0]; - AVFrame *picref = av_frame_alloc(); - int i; - - av_assert0(vf->next); - - av_log(m->avfctx, AV_LOG_DEBUG, "ff_vf_next_put_image\n"); - - if (!picref) - goto fail; - - picref->width = mpi->w; - picref->height = mpi->h; - - for(i=0; conversion_map[i].fmt && mpi->imgfmt != conversion_map[i].fmt; i++); - picref->format = conversion_map[i].pix_fmt; - - for(i=0; conversion_map[i].fmt && m->in_pix_fmt != conversion_map[i].pix_fmt; i++); - if (mpi->imgfmt == conversion_map[i].fmt) - picref->format = conversion_map[i].pix_fmt; - - memcpy(picref->linesize, mpi->stride, FFMIN(sizeof(picref->linesize), sizeof(mpi->stride))); - - for(i=0; i<4 && mpi->stride[i]; i++){ - picref->data[i] = mpi->planes[i]; - } - - if(pts != MP_NOPTS_VALUE) - picref->pts= pts * av_q2d(outlink->time_base); - - if(1) { // mp buffers are currently unsupported in libavfilter, we thus must copy - AVFrame *tofree = picref; - picref = av_frame_clone(picref); - av_frame_free(&tofree); - } - - ff_filter_frame(outlink, picref); - m->frame_returned++; - - return 1; -fail: - av_frame_free(&picref); - return 0; -} - -int ff_vf_next_config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int voflags, unsigned int outfmt){ - - av_assert0(width>0 && height>0); - vf->next->w = width; vf->next->h = height; - - return 1; -#if 0 - int flags=vf->next->query_format(vf->next,outfmt); - if(!flags){ - // hmm. colorspace mismatch!!! - //this is fatal for us ATM - return 0; - } - ff_mp_msg(MSGT_VFILTER,MSGL_V,"REQ: flags=0x%X req=0x%X \n",flags,vf->default_reqs); - miss=vf->default_reqs - (flags&vf->default_reqs); - if(miss&VFCAP_ACCEPT_STRIDE){ - // vf requires stride support but vf->next doesn't support it! - // let's insert the 'expand' filter, it does the job for us: - vf_instance_t* vf2=vf_open_filter(vf->next,"expand",NULL); - if(!vf2) return 0; // shouldn't happen! - vf->next=vf2; - } - vf->next->w = width; vf->next->h = height; - return 1; -#endif -} - -int ff_vf_next_control(struct vf_instance *vf, int request, void* data){ - MPContext *m= (MPContext*)(((uint8_t*)vf) - offsetof(MPContext, vf)); - av_log(m->avfctx, AV_LOG_DEBUG, "Received control %d\n", request); - return 0; -} - -static int vf_default_query_format(struct vf_instance *vf, unsigned int fmt){ - MPContext *m= (MPContext*)(((uint8_t*)vf) - offsetof(MPContext, vf)); - int i; - av_log(m->avfctx, AV_LOG_DEBUG, "query %X\n", fmt); - - for(i=0; conversion_map[i].fmt; i++){ - if(fmt==conversion_map[i].fmt) - return 1; //we suport all - } - return 0; -} - - -static av_cold int init(AVFilterContext *ctx) -{ - MPContext *m = ctx->priv; - int cpu_flags = av_get_cpu_flags(); - char name[256]; - const char *args; - int i; - - ff_gCpuCaps.hasMMX = cpu_flags & AV_CPU_FLAG_MMX; - ff_gCpuCaps.hasMMX2 = cpu_flags & AV_CPU_FLAG_MMX2; - ff_gCpuCaps.hasSSE = cpu_flags & AV_CPU_FLAG_SSE; - ff_gCpuCaps.hasSSE2 = cpu_flags & AV_CPU_FLAG_SSE2; - ff_gCpuCaps.hasSSE3 = cpu_flags & AV_CPU_FLAG_SSE3; - ff_gCpuCaps.hasSSSE3 = cpu_flags & AV_CPU_FLAG_SSSE3; - ff_gCpuCaps.hasSSE4 = cpu_flags & AV_CPU_FLAG_SSE4; - ff_gCpuCaps.hasSSE42 = cpu_flags & AV_CPU_FLAG_SSE42; - ff_gCpuCaps.hasAVX = cpu_flags & AV_CPU_FLAG_AVX; - ff_gCpuCaps.has3DNow = cpu_flags & AV_CPU_FLAG_3DNOW; - ff_gCpuCaps.has3DNowExt = cpu_flags & AV_CPU_FLAG_3DNOWEXT; - - m->avfctx= ctx; - - args = m->filter; - if(!args || 1!=sscanf(args, "%255[^:=]", name)){ - av_log(ctx, AV_LOG_ERROR, "Invalid parameter.\n"); - return AVERROR(EINVAL); - } - args += strlen(name); - if (args[0] == '=') - args++; - - for(i=0; ;i++){ - if(!filters[i] || !strcmp(name, filters[i]->name)) - break; - } - - if(!filters[i]){ - av_log(ctx, AV_LOG_ERROR, "Unknown filter %s\n", name); - return AVERROR(EINVAL); - } - - av_log(ctx, AV_LOG_WARNING, - "'%s' is a wrapped MPlayer filter (libmpcodecs). This filter may be removed\n" - "once it has been ported to a native libavfilter.\n", name); - - memset(&m->vf,0,sizeof(m->vf)); - m->vf.info= filters[i]; - - m->vf.next = &m->next_vf; - m->vf.put_image = ff_vf_next_put_image; - m->vf.config = ff_vf_next_config; - m->vf.query_format= vf_default_query_format; - m->vf.control = ff_vf_next_control; - m->vf.default_caps=VFCAP_ACCEPT_STRIDE; - m->vf.default_reqs=0; - if(m->vf.info->opts) - av_log(ctx, AV_LOG_ERROR, "opts / m_struct_set is unsupported\n"); -#if 0 - if(vf->info->opts) { // vf_vo get some special argument - const m_struct_t* st = vf->info->opts; - void* vf_priv = m_struct_alloc(st); - int n; - for(n = 0 ; args && args[2*n] ; n++) - m_struct_set(st,vf_priv,args[2*n],args[2*n+1]); - vf->priv = vf_priv; - args = NULL; - } else // Otherwise we should have the '_oldargs_' - if(args && !strcmp(args[0],"_oldargs_")) - args = (char**)args[1]; - else - args = NULL; -#endif - if(m->vf.info->vf_open(&m->vf, (char*)args)<=0){ - av_log(ctx, AV_LOG_ERROR, "vf_open() of %s with arg=%s failed\n", name, args); - return -1; - } - - return 0; -} - -static av_cold void uninit(AVFilterContext *ctx) -{ - MPContext *m = ctx->priv; - vf_instance_t *vf = &m->vf; - - while(vf){ - vf_instance_t *next = vf->next; - if(vf->uninit) - vf->uninit(vf); - ff_free_mp_image(vf->imgctx.static_images[0]); - ff_free_mp_image(vf->imgctx.static_images[1]); - ff_free_mp_image(vf->imgctx.temp_images[0]); - ff_free_mp_image(vf->imgctx.export_images[0]); - vf = next; - } -} - -static int query_formats(AVFilterContext *ctx) -{ - AVFilterFormats *avfmts=NULL; - MPContext *m = ctx->priv; - enum AVPixelFormat lastpixfmt = AV_PIX_FMT_NONE; - int i; - - for(i=0; conversion_map[i].fmt; i++){ - av_log(ctx, AV_LOG_DEBUG, "query: %X\n", conversion_map[i].fmt); - if(m->vf.query_format(&m->vf, conversion_map[i].fmt)){ - av_log(ctx, AV_LOG_DEBUG, "supported,adding\n"); - if (conversion_map[i].pix_fmt != lastpixfmt) { - ff_add_format(&avfmts, conversion_map[i].pix_fmt); - lastpixfmt = conversion_map[i].pix_fmt; - } - } - } - - if (!avfmts) - return -1; - - //We assume all allowed input formats are also allowed output formats - ff_set_common_formats(ctx, avfmts); - return 0; -} - -static int config_inprops(AVFilterLink *inlink) -{ - MPContext *m = inlink->dst->priv; - int i; - for(i=0; conversion_map[i].fmt && conversion_map[i].pix_fmt != inlink->format; i++); - - av_assert0(conversion_map[i].fmt && inlink->w && inlink->h); - - m->vf.fmt.have_configured = 1; - m->vf.fmt.orig_height = inlink->h; - m->vf.fmt.orig_width = inlink->w; - m->vf.fmt.orig_fmt = conversion_map[i].fmt; - - if(m->vf.config(&m->vf, inlink->w, inlink->h, inlink->w, inlink->h, 0, conversion_map[i].fmt)<=0) - return -1; - - return 0; -} - -static int config_outprops(AVFilterLink *outlink) -{ - MPContext *m = outlink->src->priv; - - outlink->w = m->next_vf.w; - outlink->h = m->next_vf.h; - - return 0; -} - -static int request_frame(AVFilterLink *outlink) -{ - MPContext *m = outlink->src->priv; - int ret; - - av_log(m->avfctx, AV_LOG_DEBUG, "mp request_frame\n"); - - for(m->frame_returned=0; !m->frame_returned;){ - ret=ff_request_frame(outlink->src->inputs[0]); - if(ret<0) - break; - } - - av_log(m->avfctx, AV_LOG_DEBUG, "mp request_frame ret=%d\n", ret); - return ret; -} - -static int filter_frame(AVFilterLink *inlink, AVFrame *inpic) -{ - MPContext *m = inlink->dst->priv; - int i; - double pts= MP_NOPTS_VALUE; - mp_image_t* mpi = ff_new_mp_image(inpic->width, inpic->height); - - if(inpic->pts != AV_NOPTS_VALUE) - pts= inpic->pts / av_q2d(inlink->time_base); - - for(i=0; conversion_map[i].fmt && conversion_map[i].pix_fmt != inlink->format; i++); - ff_mp_image_setfmt(mpi,conversion_map[i].fmt); - m->in_pix_fmt = inlink->format; - - memcpy(mpi->planes, inpic->data, FFMIN(sizeof(inpic->data) , sizeof(mpi->planes))); - memcpy(mpi->stride, inpic->linesize, FFMIN(sizeof(inpic->linesize), sizeof(mpi->stride))); - - if (inpic->interlaced_frame) - mpi->fields |= MP_IMGFIELD_INTERLACED; - if (inpic->top_field_first) - mpi->fields |= MP_IMGFIELD_TOP_FIRST; - if (inpic->repeat_pict) - mpi->fields |= MP_IMGFIELD_REPEAT_FIRST; - - // mpi->flags|=MP_IMGFLAG_ALLOCATED; ? - mpi->flags |= MP_IMGFLAG_READABLE; - if(!av_frame_is_writable(inpic)) - mpi->flags |= MP_IMGFLAG_PRESERVE; - if(m->vf.put_image(&m->vf, mpi, pts) == 0){ - av_log(m->avfctx, AV_LOG_DEBUG, "put_image() says skip\n"); - }else{ - av_frame_free(&inpic); - } - ff_free_mp_image(mpi); - return 0; -} - -static const AVFilterPad mp_inputs[] = { - { - .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, - .config_props = config_inprops, - }, - { NULL } -}; - -static const AVFilterPad mp_outputs[] = { - { - .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .request_frame = request_frame, - .config_props = config_outprops, - }, - { NULL } -}; - -AVFilter ff_vf_mp = { - .name = "mp", - .description = NULL_IF_CONFIG_SMALL("Apply a libmpcodecs filter to the input video."), - .init = init, - .uninit = uninit, - .priv_size = sizeof(MPContext), - .query_formats = query_formats, - .inputs = mp_inputs, - .outputs = mp_outputs, - .priv_class = &mp_class, -}; -- 1.7.11.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel