Commit Graph

84 Commits

Author SHA1 Message Date
Michael Niedermayer 718044dc19 avutil/pixdesc: Add av_write_image_line2(), av_read_image_line2()
This is needed because of 32bit float formats (which are difficult to
store in 16bits)

This also fixes undefined behavior found by fate

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-10-27 22:39:27 +02:00
Marton Balint 56b081da57 avutil/pixdesc: add AV_PIX_FMT_FLAG_ALPHA to AV_PIX_FMT_PAL8
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-04-30 21:51:31 +02:00
wm4 d6fc031caf avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPAL
PSEUDOPAL pixel formats are not paletted, but carried a palette with the
intention of allowing code to treat unpaletted formats as paletted. The
palette simply mapped the byte values to the resulting RGB values,
making it some sort of LUT for RGB conversion.

It was used for 1 byte formats only: RGB4_BYTE, BGR4_BYTE, RGB8, BGR8,
GRAY8. The first 4 are awfully obscure, used only by some ancient bitmap
formats. The last one, GRAY8, is more common, but its treatment is
grossly incorrect. It considers full range GRAY8 only, so GRAY8 coming
from typical Y video planes was not mapped to the correct RGB values.
This cannot be fixed, because AVFrame.color_range can be freely changed
at runtime, and there is nothing to ensure the pseudo palette is
updated.

Also, nothing actually used the PSEUDOPAL palette data, except xwdenc
(trivially changed in the previous commit). All other code had to treat
it as a special case, just to ignore or to propagate palette data.

In conclusion, this was just a very strange old mechnaism that has no
real justification to exist anymore (although it may have been nice and
useful in the past). Now it's an artifact that makes the API harder to
use: API users who allocate their own pixel data have to be aware that
they need to allocate the palette, or FFmpeg will crash on them in
_some_ situations. On top of this, there was no API to allocate the
pseuo palette outside of av_frame_get_buffer().

This patch not only deprecates AV_PIX_FMT_FLAG_PSEUDOPAL, but also makes
the pseudo palette optional. Nothing accesses it anymore, though if it's
set, it's propagated. It's still allocated and initialized for
compatibility with API users that rely on this feature. But new API
users do not need to allocate it. This was an explicit goal of this
patch.

Most changes replace AV_PIX_FMT_FLAG_PSEUDOPAL with FF_PSEUDOPAL. I
first tried #ifdefing all code, but it was a mess. The FF_PSEUDOPAL
macro reduces the mess, and still allows defining FF_API_PSEUDOPAL to 0.

Passes FATE with FF_API_PSEUDOPAL enabled and disabled. In addition,
FATE passes with FF_API_PSEUDOPAL set to 1, but with allocation
functions manually changed to not allocating a palette.
2018-04-03 17:53:00 +02:00
Martin Vignali bb3d62874e avutil/pixdesc: remove reference to avcodec_get_chroma_sub_sample
Don't recommend to use deprecated functions.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-06 19:16:46 -03:00
Vittorio Giovara 6f15f1cdc8 pixdesc: Add API to map color property names to enum values
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-09-21 13:33:29 +02:00
Vittorio Giovara 1460408703 Add single precision planar RGB pixel formats
Add a pixel format flag to identify this family.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-08-15 15:26:20 +02:00
Clément Bœsch 9c2436e1e7 lavu: add AV_PIX_FMT_FLAG_BAYER 2017-03-20 08:02:30 +01:00
Timothy Gu bdcd586c0d pixdesc: Order function prototypes semantically 2016-10-05 17:17:50 -07:00
Derek Buitenhuis 73bd20c4d2 Merge commit '6695f178a5929eab91d3da7e9023999f1774bd0e'
* commit '6695f178a5929eab91d3da7e9023999f1774bd0e':
  pixdesc: Use AV_CEIL_RSHIFT in documentation

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-16 16:55:28 +00:00
Derek Buitenhuis 74f5cb0189 Merge commit 'd336bfcf69fee159e9dba5e5e486ddb1aba61aab'
* commit 'd336bfcf69fee159e9dba5e5e486ddb1aba61aab':
  pixdesc: fix and extend doxy for av_pix_fmt_get_chroma_sub_sample()

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-03 16:59:06 +00:00
Vittorio Giovara 6695f178a5 pixdesc: Use AV_CEIL_RSHIFT in documentation 2016-01-25 12:02:20 -05:00
Anton Khirnov d336bfcf69 pixdesc: fix and extend doxy for av_pix_fmt_get_chroma_sub_sample()
The parameters in the docs are currently swapped.
2016-01-23 20:16:42 +01:00
Hendrik Leppkes eadf6cb2c4 Merge commit '7b02cb29d9d60cdd5ef321043d11d02023e7dc8f'
* commit '7b02cb29d9d60cdd5ef321043d11d02023e7dc8f':
  pixdesc: Document the component order

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-12 13:03:04 +02:00
Luca Barbato 7b02cb29d9 pixdesc: Document the component order 2015-09-10 12:08:57 +02:00
Hendrik Leppkes 151aa2ebff Merge commit '2268db2cd052674fde55c7d48b7a5098ce89b4ba'
* commit '2268db2cd052674fde55c7d48b7a5098ce89b4ba':
  lavu: Drop the {minus,plus}1 suffix from AVComponentDescriptor fields

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-08 16:35:28 +02:00
Hendrik Leppkes f53569a93f Merge commit '6b3ef7f080293956b2e5212b83135c6b051212e9'
* commit '6b3ef7f080293956b2e5212b83135c6b051212e9':
  lavu: Remove bit packing from AVComponentDescriptor

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-08 14:53:34 +02:00
Hendrik Leppkes c734b34b04 Merge commit 'b8b5d8274471129f122858bc74ad09284dae6ab7'
* commit 'b8b5d8274471129f122858bc74ad09284dae6ab7':
  lavu: extend size of the AVPixFmtDescriptor.flags field

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-08 14:53:13 +02:00
Vittorio Giovara 2268db2cd0 lavu: Drop the {minus,plus}1 suffix from AVComponentDescriptor fields
The new fields can be accessed directly and are more intelligible.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-09-07 12:37:47 +02:00
Vittorio Giovara 6b3ef7f080 lavu: Remove bit packing from AVComponentDescriptor
There is no practical benefit in having this structure elements
bit packed given the size of the structure and its usage.
Change types from uint16_t (packed) to plain int in order to simplify
modifying the structure and accessing its fields.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-09-07 12:36:56 +02:00
wm4 b8b5d82744 lavu: extend size of the AVPixFmtDescriptor.flags field
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-09-07 12:36:04 +02:00
Hendrik Leppkes 0eed703d64 Merge commit '2f8cbbc962dfc0dc1dd0a90b2cd6c21266380f51'
* commit '2f8cbbc962dfc0dc1dd0a90b2cd6c21266380f51':
  lavu: Drop deprecated external access to AVPixFmtDescriptor table

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-05 17:12:23 +02:00
Hendrik Leppkes c10caea214 Merge commit '183db02a51a422568084b113a7571c845ca68622'
* commit '183db02a51a422568084b113a7571c845ca68622':
  lavu: Drop deprecated old_pix_fmt.h and related code

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-05 17:10:28 +02:00
Vittorio Giovara 2f8cbbc962 lavu: Drop deprecated external access to AVPixFmtDescriptor table
Deprecated in 10/2012.
2015-08-28 16:04:27 +02:00
Vittorio Giovara 183db02a51 lavu: Drop deprecated old_pix_fmt.h and related code
Deprecated in 10/2012.
2015-08-28 16:04:27 +02:00
Peter Cordes 4da3a14f3c pixelutils: indent comments in pixdesc.h to be clearer
Signed-off-by: Peter Cordes <peter@cordes.ca>
2015-03-04 21:58:53 +01:00
wm4 c247fc63e4 pixdesc: clarify AV_PIX_FMT_FLAG_ALPHA doxygen
Also make clear that PAL8 can have alpha.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-10 16:03:04 +01:00
wm4 3e18dc235e avutil: move internal function out of public header
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-10 15:24:46 +01:00
Michael Niedermayer 1296dc6025 avutil/pixdesc: rewrite AV_PIX_FMT_FLAG_PSEUDOPAL documentation
It seems many people do not understand its current documentation

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-24 14:07:00 +01:00
Michael Niedermayer bb44f7d5d7 Merge commit '5a419b2dd1881889d436f55741fd3ff3f9f436c4'
* commit '5a419b2dd1881889d436f55741fd3ff3f9f436c4':
  pixdesc: return color properties names

Conflicts:
	libavutil/pixdesc.c
	libavutil/pixdesc.h
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-08 22:53:48 +02:00
Vittorio Giovara 5a419b2dd1 pixdesc: return color properties names 2014-10-08 18:17:49 +01:00
Michael Niedermayer 073c074447 Merge commit 'd2962e9f89cca6ff40f0c9d5ffc9c4397b8b1b26'
* commit 'd2962e9f89cca6ff40f0c9d5ffc9c4397b8b1b26':
  pixdesc: Support pixelformat aliases

Conflicts:
	doc/APIchanges
	libavutil/pixdesc.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-04 21:32:03 +02:00
Luca Barbato d2962e9f89 pixdesc: Support pixelformat aliases
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-08-04 12:55:07 +01:00
Michael Niedermayer 229a1e8694 Merge commit 'b2e059a1ffbdaaa985c6a7dcdd684fa034725238'
* commit 'b2e059a1ffbdaaa985c6a7dcdd684fa034725238':
  pixdesc: K&R formatting cosmetics

Conflicts:
	libavutil/pixdesc.c
	libavutil/pixdesc.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-01 16:56:42 +02:00
Luca Barbato b2e059a1ff pixdesc: K&R formatting cosmetics
Also change some comments to multiline.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-08-01 13:07:53 +01:00
Lou Logan 88f2586adb fix various typos
Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 10:58:19 -08:00
Michael Niedermayer 617e866e25 Move av_find_best_pix_fmt_of_2() from avcodec to avutil
This avoids a dependancy of libavfilter on libavcodec

See Ticket 3592
Fixes Ticket2784

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-30 23:14:05 +02:00
Diego Biurrun 5ce04c14dd Use correct Doxygen syntax 2013-10-03 17:53:51 +02:00
Michael Niedermayer 2ece7d94bc Merge commit '5ce04c14dd3dd3670cbdba82275a3a72c716ec6f'
* commit '5ce04c14dd3dd3670cbdba82275a3a72c716ec6f':
  Use correct Doxygen syntax

Conflicts:
	libavcodec/atrac3.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-03 21:29:38 +02:00
Thilo Borgmann f18ccb529f Fix wrong use of "an" in some comments. 2013-08-12 03:27:26 +02:00
Michael Niedermayer b0edd59994 Merge commit 'bf4b0ed1d5d323050a87c9f0ad1dd40860eb3da2'
* commit 'bf4b0ed1d5d323050a87c9f0ad1dd40860eb3da2':
  Add missing deprecation attributes

Conflicts:
	libavfilter/avfilter.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-28 13:44:34 +02:00
Diego Biurrun bf4b0ed1d5 Add missing deprecation attributes 2013-07-27 16:08:49 +02:00
Michael Niedermayer ff4680922f Merge remote-tracking branch 'qatar/master'
* qatar/master:
  pixdesc: rename PIX_FMT_* flags to AV_PIX_FMT_FLAG_*

Conflicts:
	doc/APIchanges
	libavcodec/avpicture.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/imgconvert.c
	libavcodec/tiffenc.c
	libavfilter/vf_pixdesctest.c
	libavfilter/vf_scale.c
	libavutil/imgutils.c
	libavutil/pixdesc.c
	libavutil/version.h
	libswscale/swscale_internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-15 11:10:09 +02:00
Michael Niedermayer aa6454e6ca Merge commit '096696ef0dd391d9430376d1444c1a3cde9171fd'
* commit '096696ef0dd391d9430376d1444c1a3cde9171fd':
  avfiltergraph: simplify inserting conversion filters.
  Clarify output of av_get_bits_per_pixel

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-15 10:21:16 +02:00
Anton Khirnov e6c4ac7b5f pixdesc: rename PIX_FMT_* flags to AV_PIX_FMT_FLAG_* 2013-05-15 07:46:51 +02:00
Kieran Kunhya ede75ebc9b Clarify output of av_get_bits_per_pixel
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-05-15 07:45:09 +02:00
Michael Niedermayer 60fd88059a Merge commit '74652af821d7e526a6541876a637fbf81261fa8e'
* commit '74652af821d7e526a6541876a637fbf81261fa8e':
  pixdesc: add function to return pixel format with swapped endiannes

Conflicts:
	libavutil/pixdesc.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-07 10:49:40 +02:00
Janne Grunau 74652af821 pixdesc: add function to return pixel format with swapped endiannes 2013-05-06 18:51:47 +02:00
Michael Niedermayer 20e99a9c10 avutil/pixdesc: support for self-checking the descriptors
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-16 14:27:14 +02:00
Michael Niedermayer 17ebef2fc8 Merge commit '2c328a907978b61949fd20f7c991803174337855'
* commit '2c328a907978b61949fd20f7c991803174337855':
  pixdesc: add a function for counting planes in a pixel format.
  avplay: remove the -debug option.
  Revert "asfenc: return error on negative timestamp"

Conflicts:
	doc/APIchanges
	doc/ffplay.texi
	ffplay.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-20 11:24:11 +01:00
Anton Khirnov 2c328a9079 pixdesc: add a function for counting planes in a pixel format. 2013-03-19 11:12:17 +01:00