Commit Graph

20 Commits

Author SHA1 Message Date
Andreas Cadhalpun
5de2dab12b avcodec/webp: validate the distance prefix code
According to the WebP Lossless Bitstream Specification the highest
allowed value for a prefix code is 39.

If prefix_code is too large, the calculated extra_bits has an invalid
value and triggers an assertion in get_bits.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-03 00:37:36 +01:00
Paul B Mahol
6e7ac5ee55 avcodec/webp: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-02-04 09:45:41 +00:00
Michael Niedermayer
436206c175 avcodec/webp: add assert to ensure palette is not larger than 256
it should not be possible to be larger as its stored as 8bit value
but we would be overwriting a stack buffer if it is ...

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-05 13:00:40 +02:00
Pascal Massimino
19fb476841 avcodec/webp: add optimization: use local palette with extra padding
for big enough pictures.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-05 12:47:44 +02:00
Pascal Massimino
e5b3112996 avcodec/webp: fix default palette color 0xff000000 -> 0x00000000
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-23 17:15:20 +02:00
Pascal Massimino
4fd21d58a7 libavcodec/webp: treat out-of-bound palette index as translucent black
See https://code.google.com/p/webp/issues/detail?id=206
for a description of the problem/fix.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

This patch makes the decoder follow the recommendation of the spec.
There is some disagreement (see "[FFmpeg-devel] [PATCH]: libavcodec/webp")
about what would be best to be written in the spec, so in case the spec
is changed again, this potentially would need to be amended or reverted
2014-09-19 16:33:05 +02:00
Michael Niedermayer
cf8c44fc47 Merge commit 'c6698dfe7cdbc7634f33245875488ed3fa4a8ced'
* commit 'c6698dfe7cdbc7634f33245875488ed3fa4a8ced':
  webpdec: Fix decoding of the huffman group indices.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-04 01:08:57 +02:00
Justin Ruggles
c6698dfe7c webpdec: Fix decoding of the huffman group indices.
Per the specification, "The red and green components of a pixel
define the meta Huffman code used in a particular block of the ARGB
image."
2014-07-03 15:29:01 -04:00
Michael Niedermayer
de9cd58848 avcdoec/webp: use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-20 17:35:19 +02:00
Thilo Borgmann
8c161d7884 lavc/exif: Make EXIF IFD decoding part of private API/ABI.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-05 03:31:56 +02:00
James Almer
8bfa5f7fab webp: fix capitalization of the word Exif
Also remove "webp:" from log messages. Using the AVCodecContext is enough.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-15 02:54:36 +01:00
James Almer
0b54bc24db webp: add support for EXIF metadata chunks
Based on mjpeg code by Thilo Borgmann

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-14 05:08:22 +01:00
Michael Niedermayer
82c7d704fd Merge remote-tracking branch 'qatar/master'
* qatar/master:
  webp: add a special case for a huffman table with only 1 symbol

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-06 14:13:33 +01:00
Michael Niedermayer
db44eff197 Merge commit 'f51e3a1971045c7ed0c3d9d29d3254a4d940198e'
* commit 'f51e3a1971045c7ed0c3d9d29d3254a4d940198e':
  webp: do not call av_frame_free() on the user-provided frame

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-06 14:07:08 +01:00
Justin Ruggles
d085f80fa1 webp: add a special case for a huffman table with only 1 symbol
The vlc reader cannot handle 0-bit huffman codes. For most
situations WebP uses the "simple" huffman coding for this case,
but that will only handle symbols up to 255. For the LZ77 distance
codes, larger symbol values are needed, so it can happen in rare
cases that a normal huffman table is used that only has a single
symbol.
2013-12-05 20:37:06 -05:00
Justin Ruggles
f51e3a1971 webp: do not call av_frame_free() on the user-provided frame
Fixes double-free on error.
2013-12-05 20:36:54 -05:00
Michael Niedermayer
8b2dd04afc Merge commit '0a9e94bba8f8a40156438a43e4fe0e9ae36236cb'
* commit '0a9e94bba8f8a40156438a43e4fe0e9ae36236cb':
  webp: stop using deprecated avcodec_set_dimensions

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-01 15:55:58 +01:00
Anton Khirnov
0a9e94bba8 webp: stop using deprecated avcodec_set_dimensions 2013-10-31 20:14:16 +01:00
Michael Niedermayer
b26ccf218d Merge commit 'c4bfa098072ba338d83555d6e2199f7e1e64ffff'
* commit 'c4bfa098072ba338d83555d6e2199f7e1e64ffff':
  Add a WebP decoder

Conflicts:
	Changelog
	doc/general.texi
	libavcodec/Makefile
	libavcodec/avcodec.h
	libavcodec/version.h
	libavformat/img2.c

The previously existing webp decoder is disabled as the new
one supports lossless mode and alpha while the previous does not.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-19 12:36:11 +02:00
Justin Ruggles
c4bfa09807 Add a WebP decoder
Container and lossy decoding by Aneesh Dogra <aneesh@sugarlabs.org>
Lossless decoding by Justin Ruggles <justin.ruggles@gmail.com>
2013-09-18 14:10:05 -04:00