Commit Graph

911 Commits

Author SHA1 Message Date
Michael Niedermayer 041dbd3c14 swscale: dont loose precission on RGB/BGR48 input, that is dont drop half the bits.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-27 13:21:17 +02:00
Michael Niedermayer 2b6bfff2b2 swscale: Do not loose precission on yuv values after rgb->yuv.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-26 22:00:40 +02:00
Michael Niedermayer 39e4206dc6 Merge remote-tracking branch 'qatar/master'
* qatar/master: (32 commits)
  doc: create separate section for audio encoders
  swscale: Remove orphaned, commented-out function declaration.
  swscale: Eliminate rgb24toyv12_c() duplication.
  Remove h263_msmpeg4 from MpegEncContext.
  APIchanges: Fill in git hash for fps_probe_size (30315a8)
  avformat: Add fpsprobesize as an AVOption.
  avoptions: Return explicitly NAN or {0,0} if the option isn't found
  rtmp: Reindent
  rtmp: Don't try to do av_malloc(0)
  tty: replace AVFormatParameters.sample_rate abuse with a private option.
  Fix end time of last chapter in compute_chapters_end
  ffmpeg: get rid of useless AVInputStream.nb_streams.
  ffmpeg: simplify managing input files and streams
  ffmpeg: purge redundant AVInputStream.index.
  lavf: deprecate AVFormatParameters.channel.
  libdc1394: add a private option for channel.
  dv1394: add a private option for channel.
  v4l2: reindent.
  v4l2: add a private option for channel.
  lavf: deprecate AVFormatParameters.standard.
  ...

Conflicts:
	doc/APIchanges
	doc/encoders.texi
	ffmpeg.c
	libavdevice/alsa-audio.h
	libavformat/version.h
	libavutil/opt.c
	libswscale/rgb2rgb.h
	libswscale/rgb2rgb_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-26 03:28:22 +02:00
Diego Biurrun 6f7a280ead swscale: Remove orphaned, commented-out function declaration. 2011-05-26 00:56:07 +02:00
Michael Niedermayer 7dc303a60e swscale: Eliminate rgb24toyv12_c() duplication.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-05-26 00:56:06 +02:00
Michael Niedermayer b49728df73 swscale: document SWS_CPU_CAPS*
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-25 21:04:44 +02:00
Michael Niedermayer e92bdadb2d Revert removial of SWS flags from e66149e714
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-25 21:03:26 +02:00
Michael Niedermayer 4a056160be swscale: remove duplicatiopn of rgb24toyv12_c()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-25 20:58:59 +02:00
Jean-Tiare Le Bigot 364889cf9c Return -1 on invalid input instead of crashing. 2011-05-25 20:12:17 +02:00
Michael Niedermayer 034fc7bf12 Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
  configure: enable memalign_hack automatically when needed
  swscale: unbreak the build on non-x86 systems.
  swscale: remove if(bitexact) branch from functions.
  swscale: remove if(canMMX2BeUsed) conditional.
  swscale: remove swScale_{c,MMX,MMX2} duplication.
  swscale: use emms_c().
  Move emms_c() from libavcodec to libavutil.
  tiff: set palette in the context when specified in TIFF_PAL tag
  rtsp: use strtoul to parse rtptime and seq values.
  pgssubdec: fix incorrect colors.
  dvdsubdec: fix incorrect colors.
  ape: Allow demuxing of files with metadata tags.
  swscale: remove dead macro WRITEBGR24OLD.
  swscale: remove AMD3DNOW "optimizations".
  swscale: remove duplicate code in ppc/ subdirectory.
  swscale: remove duplicated x86/ functions.
  swscale: force --enable-runtime-cpudetect and remove SWS_CPU_CAPS_*.
  vsrc_buffer.h: add file doxy
  vsrc_buffer: tweak error message in init()
  msmpeg4: reindent.
  ...

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-25 06:32:45 +02:00
Michael Niedermayer d1adad3cca Merge swscale bloatup
This will be cleaned up in the next merge

Authorship / merged commits:
commit f668afd489
Author: Janne Grunau <janne-libav@jannau.net>
Date:   Fri Apr 15 09:12:34 2011 +0200

    swscale: fix "ISO C90 forbids mixed declarations and code" warning

    only hit with --enable-runtime-cpudetect

commit 7f2ae5c7af
Author: Janne Grunau <janne-libav@jannau.net>
Date:   Fri Apr 15 02:09:44 2011 +0200

    swscale: fix compilation with --enable-runtime-cpudetect

commit b6cad3df82
Author: Janne Grunau <janne-libav@jannau.net>
Date:   Fri Apr 15 00:31:04 2011 +0200

    swscale: correct include path to fix ppc altivec build

commit 6216fc70b7
Author: Luca Barbato <lu_zero@gentoo.org>
Date:   Thu Apr 14 22:03:45 2011 +0200

    swscale: simplify rgb2rgb templating

    MMX is always built. Drop the ifdefs

commit 33a0421bba
Author: Josh Allmann <joshua.allmann@gmail.com>
Date:   Wed Apr 13 20:57:32 2011 +0200

    swscale: simplify initialization code

    Simplify the fallthrough case when no accelerated functions
    can be initialized.

commit 735bf19511
Author: Josh Allmann <joshua.allmann@gmail.com>
Date:   Wed Apr 13 20:57:31 2011 +0200

    swscale: further cleanup swscale.c

    Move x86-specific constants out of swscale.c

commit 86330b4c92
Author: Luca Barbato <lu_zero@gentoo.org>
Date:   Wed Apr 13 20:57:30 2011 +0200

    swscale: partially move the arch specific code left

    PPC and x86 code is split off from swscale_template.c. Lots of code is
    still duplicated and should be removed later.

    Again uniformize the init system to be more similar to the dsputil one.

    Unset h*scale_fast in the x86 init in order to make the output
    consistent with the previous status. Thanks to Josh for spotting it.

commit c003832883
Author: Luca Barbato <lu_zero@gentoo.org>
Date:   Wed Apr 13 20:57:29 2011 +0200

    swscale: move away x86 specific code from rgb2rgb

    Keep only the plain C code in the main rgb2rgb.c and move the x86
    specific optimizations to x86/rgb2rgb.c
    Change the initialization pattern a little so some of it can be
    factorized to behave more like dsputils.

Conflicts:
	libswscale/rgb2rgb.c
	libswscale/swscale_template.c
2011-05-25 06:24:55 +02:00
Michael Niedermayer d9d56036f3 swscale: MMX optim of hscale16()
code is based on existing 8bit MMX code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-25 04:08:34 +02:00
Michael Niedermayer 895b616146 swscale: dont loose bits on planar >8bit yuv ind gray nput.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-25 04:08:34 +02:00
Michael Niedermayer 8050dfdfb2 swscale: Switch to ronalds yuv2yuvX16inC_template() its very similar to baptsites
and supports alpha

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-25 04:08:08 +02:00
Ronald S. Bultje a724ee6265 swscale: unbreak the build on non-x86 systems. 2011-05-24 15:32:03 -04:00
Ronald S. Bultje 1bb0f0c925 swscale: remove if(bitexact) branch from functions.
Instead, only set the function pointers if bitexact flag is
not set during initialization. Since a change in flags triggers
a re-init anyway, this doesn't situations where flag values
change during runtime.
2011-05-24 14:50:20 -04:00
Ronald S. Bultje 566b5fbbb3 swscale: remove if(canMMX2BeUsed) conditional.
Instead, set function pointers conditionally during init. This
patch also reveals a whole branch of dead assembly code that is
therefore also removed.
2011-05-24 14:50:19 -04:00
Ronald S. Bultje aaca69c130 swscale: remove swScale_{c,MMX,MMX2} duplication. 2011-05-24 14:50:15 -04:00
Ronald S. Bultje c4fd283a46 swscale: use emms_c(). 2011-05-24 14:48:49 -04:00
Ronald S. Bultje b9eb2136af swscale: remove dead macro WRITEBGR24OLD. 2011-05-24 10:46:40 -04:00
Ronald S. Bultje 1dd4f4be5a swscale: remove AMD3DNOW "optimizations".
The functions are identical to their MMX counterparts. Thus,
pretending that swscale is highly optimized for AMD3DNOW
extensions is a poorly executed practical joke at best.
2011-05-24 10:19:41 -04:00
Ronald S. Bultje fe43d5d71e swscale: remove duplicate code in ppc/ subdirectory. 2011-05-24 10:16:32 -04:00
Ronald S. Bultje 11ffefefdb swscale: remove duplicated x86/ functions. 2011-05-24 10:11:26 -04:00
Ronald S. Bultje e66149e714 swscale: force --enable-runtime-cpudetect and remove SWS_CPU_CAPS_*. 2011-05-24 10:03:26 -04:00
Michael Niedermayer 26ed595bd0 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  configure: Add -U__STRICT_ANSI__ to CPPFLAGS on Cygwin and DOS.
  aacdec: fix typo in scalefactor clipping check
  fate: fix fate-h264-conformance-frext-pph10i4-panasonic-a crcs.
  fate: update 9/10bit refs.
  h264: Properly set coded_{width, height} when parsing H.264.
  x86 asm: Add SECTION_TEXT to dct32_sse.asm.
  Fix 9/10 bit in swscale.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-24 04:35:08 +02:00
Kieran Kunhya 6465c820da Fix 9/10 bit in swscale.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-05-23 06:46:14 -04:00
Michael Niedermayer bf8bb94322 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  ffmpeg: get rid of the -vglobal option.
  dct32: Add AVX implementation of 32-point DCT
  dct32: Change pass 6 permutation to allow for AVX implementation
  dct32: port SSE 32-point DCT to YASM
  multiple inclusion guard cleanup
  avio: document buffer must created with av_malloc() and friends
  avio: check AVIOContext malloc failure
  swscale: point out an alternative to sws_getContext
  svq3: Do initialization after parsing the extradata
  add changelog entries for 0.7_beta2
  mp3lame: add #include required for AV_RB32 macro.

Conflicts:
	Changelog
	libavcodec/svq3.c
	libavcodec/x86/dct32_sse.c
	libavfilter/vsrc_buffer.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-22 04:53:19 +02:00
Clément Bœsch 7d4c4394b5 swscale: point out an alternative to sws_getContext
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-05-21 13:42:50 +02:00
Peter Belkner 502e858fd2 swscale: fix compile on mingw32
Compiling "swscale.c" breaks on MINGW32 because of multiple including
"libswscale_template.c"
2011-05-14 13:22:46 +02:00
Ronald S. Bultje 76f8a96e00 [PATCH] Update pixdesc_be fate refs after adding 9/10bit YUV420P formats.
Also remove code that overwrites the C versions of functions in
sws_init_swScale_altivec(), so that it uses the C functions of files
if no altivec-optimized version exists.
2011-05-14 06:37:39 -04:00
Ronald S. Bultje b025431bfe swscale: 10l forgot git add this change from ronald.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-14 02:50:10 +02:00
Michael Niedermayer 58c03f6d7d Merge remote branch 'qatar/master'
* qatar/master:
  swscale: properly inline bits/endianness in yuv2yuvX16inC().
(We didnt pull the bug)  swscale: fix clipping of 9/10bit YUV420P.
  Add av_clip_uintp2() function
(our patch / duplicate)  dfa: fix buffer overflow checks to avoid integer overflows.
(our patch / duplicate)  movenc: always write esds descriptor length using 4 bytes.
(our patch / duplicate)  ffmpeg: use parse_number_and_die() when it makes sense
(No thanks)  ffmpeg: get rid of the 'q' key schizofrenia

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-14 02:19:58 +02:00
Ronald S. Bultje 9f54e461fe swscale: properly inline bits/endianness in yuv2yuvX16inC(). 2011-05-13 16:46:24 -04:00
Ronald S. Bultje c3d68ec9c5 swscale: fix clipping of 9/10bit YUV420P. 2011-05-13 16:45:28 -04:00
Michael Niedermayer 72153419b5 Merge remote branch 'qatar/master'
* qatar/master: (33 commits)
  rtpdec_qdm2: Don't try to parse data packet if no configuration is received
  ac3enc: put the counting of stereo rematrixing bits in the same place to make the code easier to understand.
  ac3enc: clean up count_frame_bits() and count_frame_bits_fixed()
  mpegvideo: make FF_DEBUG_DCT_COEFF output coeffs via av_log() instead of just via AVFrame.
  srtdec: make sure we don't write past the end of buffer
  wmaenc: improve channel count and bitrate error handling in encode_init()
  matroskaenc: make sure we don't produce invalid file with no codec ID
  matroskadec: check that pointers were initialized before accessing them
  lavf: fix function name in compute_pkt_fields2 av_dlog message
  lavf: fix av_find_best_stream when providing a wanted stream.
  lavf: fix av_find_best_stream when decoder_ret is given and using a related stream.
  ffmpeg: factorize quality calculation
  tiff: add support for SamplesPerPixel tag in tiff_decode_tag()
  tiff: Prefer enum TiffCompr over int for TiffContext.compr.
  mov: Support edit list atom version 1.
  configure: Enable libpostproc automatically if GPL code is enabled.
  Cosmetics: fix prototypes in oggdec
  oggdec: fix memleak with continuous streams.
  matroskaenc: add missing new line in av_log() call
  dnxhdenc: add AVClass in private context.
  ...

swscale changes largely rewritten by me or replaced by baptsites due to lots of bugs in ronalds code.
Above code is also just in case its not obvios to a large extended duplicates that where cherry picked
from ffmpeg.

Conflicts:
	configure
	ffmpeg.c
	libavformat/matroskaenc.c
	libavutil/pixfmt.h
	libswscale/ppc/swscale_template.c
	libswscale/swscale.c
	libswscale/swscale_template.c
	libswscale/utils.c
	libswscale/x86/swscale_template.c
	tests/fate/h264.mak
	tests/ref/lavfi/pixdesc_le
	tests/ref/lavfi/pixfmts_copy_le
	tests/ref/lavfi/pixfmts_null_le
	tests/ref/lavfi/pixfmts_scale_le
	tests/ref/lavfi/pixfmts_vflip_le

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-13 04:40:40 +02:00
Diego Biurrun 046f081b46 configure: Do not unconditionally add -D_POSIX_C_SOURCE to CPPFLAGS.
Adding _POSIX_C_SOURCE to CPPFLAGS globally produces all sorts of problems
since it causes certain system functions to be hidden on some (BSD) systems.
The solution is to only add the flag on systems that really require it, i.e.
glibc-based ones.

This change makes BSD systems compile out-of-the-box without the need for
adding specific flags manually.  It also allows dropping a number of flags
set manually on a file-per-file basis, but were only present to work around
breakage introduced by the presence of _POSIX_C_SOURCE.

Also add _XOPEN_SOURCE to CPPFLAGS for glibc systems.  We use XSI extensions
in several places already, so it is preferable to define it globally instead
of littering source files with individual #defines only needed for glibc.
2011-05-12 11:41:59 +02:00
Michael Niedermayer 1cafc23288 sws-PPC: fix after VOFW change.
It seems sws-PPC did hardcode 2048 at various places instead of using VOFW.
This also means that all past VOFW benchmarks on PPC are meaningless
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-12 02:49:18 +02:00
Ronald S. Bultje c8f487deae swscale: fix YUV420P 9/10bit support.
Fix handling of input if not in native endianness, and add support for
9/10-bit output. This allows us to force endianness of YUV420P 9/10bit
in the H264/10bit fate tests, which should fix them on big-endian
systems.
2011-05-11 19:15:14 -04:00
ami_stuff 1d14edb724 Use VOFW 21503 as a default value for all types of the CPUs 2011-05-12 00:18:35 +02:00
Michael Niedermayer e3497907ef swscale: remove fork bug that i missed in the merge.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-11 06:26:47 +02:00
Michael Niedermayer 59eb12faff Merge remote branch 'qatar/master'
* qatar/master: (30 commits)
  AVOptions: make default_val a union, as proposed in AVOption2.
  arm/h264pred: add missing argument type.
  h264dsp_mmx: place bracket outside #if/#endif block.
  lavf/utils: fix ff_interleave_compare_dts corner case.
  fate: add 10-bit H264 tests.
  h264: do not print "too many references" warning for intra-only.
  Enable decoding of high bit depth h264.
  Adds 8-, 9- and 10-bit versions of some of the functions used by the h264 decoder.
  Add support for higher QP values in h264.
  Add the notion of pixel size in h264 related functions.
  Make the h264 loop filter bit depth aware.
  Template dsputil_template.c with respect to pixel size, etc.
  Template h264idct_template.c with respect to pixel size, etc.
  Preparatory patch for high bit depth h264 decoding support.
  Move some functions in dsputil.c into a new file dsputil_template.c.
  Move the functions in h264idct into a new file h264idct_template.c.
  Move the functions in h264pred.c into a new file h264pred_template.c.
  Preparatory patch for high bit depth h264 decoding support.
  Add pixel formats for 9- and 10-bit yuv420p.
  Choose h264 chroma dc dequant function dynamically.
  ...

Conflicts:
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	libavcodec/alpha/dsputil_alpha.c
	libavcodec/arm/dsputil_init_arm.c
	libavcodec/arm/dsputil_init_armv6.c
	libavcodec/arm/dsputil_init_neon.c
	libavcodec/arm/dsputil_iwmmxt.c
	libavcodec/arm/h264pred_init_arm.c
	libavcodec/bfin/dsputil_bfin.c
	libavcodec/dsputil.c
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_ps.c
	libavcodec/h264_refs.c
	libavcodec/h264dsp.c
	libavcodec/h264idct.c
	libavcodec/h264pred.c
	libavcodec/mlib/dsputil_mlib.c
	libavcodec/options.c
	libavcodec/ppc/dsputil_altivec.c
	libavcodec/ppc/dsputil_ppc.c
	libavcodec/ppc/h264_altivec.c
	libavcodec/ps2/dsputil_mmi.c
	libavcodec/sh4/dsputil_align.c
	libavcodec/sh4/dsputil_sh4.c
	libavcodec/sparc/dsputil_vis.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/x86/dsputil_mmx.c
	libavformat/options.c
	libavformat/utils.c
	libavutil/pixfmt.h
	libswscale/swscale.c
	libswscale/swscale_internal.h
	libswscale/swscale_template.c
	tests/ref/seek/lavf_avi

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-11 05:47:02 +02:00
Anton Khirnov b66752790a AVOptions: make default_val a union, as proposed in AVOption2.
This breaks API and ABI.
2011-05-10 20:22:06 +02:00
Michael Niedermayer 7bea13f111 swscale: Fix scaling for unscaled dithered planar convertions.
This fixes some overflow in bright areas and ensures that the maximum brightness level is
mapped to the maximum without cliping and without showing dither patterens in flat max
brightness areas.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-10 14:43:34 +02:00
Oskar Arvidsson 42239ced65 Add pixel formats for 9- and 10-bit yuv420p.
Also add support for these formats in libswscale.

Needed for high bit depth h264 decoding.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-05-10 07:24:19 -04:00
Michael Niedermayer 53789a27f8 swscale: use Nbit code to handle !is16BPS(c->srcFormat) && is16BPS(c->dstFormat)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-10 00:37:20 +02:00
Michael Niedermayer 42c9bd313f swscale: Support dither in is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)
This is done by just letting the Nbit code handle it, which now can do it.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-10 00:21:18 +02:00
Michael Niedermayer c4f7050bb1 swscale: support unscaled planar Nbit->8bit with non native endian source.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-10 00:18:27 +02:00
Michael Niedermayer 09ff3cc77b swscale: fix unscaled yuv422p16be -> yuv422p10le
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-10 00:15:03 +02:00
Michael Niedermayer eb8aa13b54 swscale: make DITHER_COPY() support non native endian source
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-10 00:09:10 +02:00
Michael Niedermayer 9c49ca0f19 swscale: factor shift out of DITHER_COPY().
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-09 22:02:44 +02:00