diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-07-09 02:06:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-07-09 02:06:40 +0200 |
commit | 58257ea29e0716a50dc742959de876606ed22416 (patch) | |
tree | a4949244816d4eb7a4231b1798b54bea4a79d4e5 /libavcodec/flashsv.c | |
parent | 971c04066c601bdd38ed5e8eb585d2f5ba211fe2 (diff) | |
parent | bda168d2b0210dda84f1a9d32c8aa4653d1674d5 (diff) | |
download | ffmpeg-58257ea29e0716a50dc742959de876606ed22416.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (28 commits)
mp3enc: write a xing frame containing number of frames in the file
lavf: update AVStream.nb_frames when muxing.
ffmpeg: remove unused variables from InputStream.
doc: update ffmpeg -ar and -ac documentation to reflect reality.
ffmpeg: remove pointless if (nb_input_files)
ffmpeg: merge input_files_ts_offset into input_files.
ffmpeg: merge input_codecs into input_streams.
ffmpeg: drop AV prefixes from struct names.
ffmpeg: deprecate loop_input and loop_output options
gif: add loop private option.
img2: add loop private option.
AVOptions: in av_opt_find() don't return named constants unless unit is specified.
x11grab: replace undocumented nomouse hackery with a private option.
dict: extend documentation.
lls: whitespace cosmetics
docs: Use proper markup for a literal command line option
docs: Remove a remark that isn't relevant any longer
docs: Explain how to regenerate import libraries with MSVC tools
docs: Mention that libraries for MSVC can be built with a cross compiler
docs: Remove old docs that mention setting up a build environment with lib.exe
...
Conflicts:
doc/ffmpeg.texi
doc/general.texi
ffmpeg.c
libavcodec/Makefile
libavcodec/dnxhddata.c
libavformat/mp3enc.c
libavformat/utils.c
libavutil/Makefile
tests/copycooker.sh
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/flashsv.c')
-rw-r--r-- | libavcodec/flashsv.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index c80fa33594..47a94a40b6 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -49,18 +49,6 @@ typedef struct FlashSVContext { } FlashSVContext; -static void copy_region(uint8_t *sptr, uint8_t *dptr, - int dx, int dy, int h, int w, int stride) -{ - int i; - - for (i = dx + h; i > dx; i--) { - memcpy(dptr + i * stride + dy * 3, sptr, w * 3); - sptr += w * 3; - } -} - - static av_cold int flashsv_decode_init(AVCodecContext *avctx) { FlashSVContext *s = avctx->priv_data; @@ -153,14 +141,13 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, /* loop over all block columns */ for (j = 0; j < v_blocks + (v_part ? 1 : 0); j++) { - int hp = j * s->block_height; // vertical position in frame - int hs = (j < v_blocks) ? s->block_height : v_part; // block size - + int y_pos = j * s->block_height; // vertical position in frame + int cur_blk_height = (j < v_blocks) ? s->block_height : v_part; /* loop over all block rows */ for (i = 0; i < h_blocks + (h_part ? 1 : 0); i++) { - int wp = i * s->block_width; // horizontal position in frame - int ws = (i < h_blocks) ? s->block_width : h_part; // block size + int x_pos = i * s->block_width; // horizontal position in frame + int cur_blk_width = (i < h_blocks) ? s->block_width : h_part; /* get the size of the compressed zlib chunk */ int size = get_bits(&gb, 16); @@ -173,6 +160,8 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, /* skip unchanged blocks, which have size 0 */ if (size) { /* decompress block */ + uint8_t *line = s->tmpblock; + int k; int ret = inflateReset(&s->zstream); if (ret != Z_OK) { av_log(avctx, AV_LOG_ERROR, @@ -195,9 +184,15 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, "error in decompression of block %dx%d: %d\n", i, j, ret); /* return -1; */ } - copy_region(s->tmpblock, s->frame.data[0], - s->image_height - (hp + hs + 1), - wp, hs, ws, s->frame.linesize[0]); + /* Flash Screen Video stores the image upside down, so copy + * lines to destination in reverse order. */ + for (k = 1; k <= cur_blk_height; k++) { + memcpy(s->frame.data[0] + x_pos * 3 + + (s->image_height - y_pos - k) * s->frame.linesize[0], + line, cur_blk_width * 3); + /* advance source pointer to next line */ + line += cur_blk_width * 3; + } skip_bits_long(&gb, 8 * size); /* skip the consumed bits */ } } |