Commit 349c6241 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  indeo: Make ivi_calc_band_checksum() static, it is only used in one file.
  indeo: Drop unused debug function ivi_check_band().
  avcodec/utils: cast a function argument to shut up a compiler warning
  truemotion1: remove disabled code
  fix typo in comment
  fate: fix dependencies for non-SAMPLES avconv tests
  indeo: check for invalid motion vectors
  indeo: check that band output buffer exists
  indeo: clear allocated band buffers
  indeo: track tile macroblock size
  indeo: check custom Huffman tables for errors
  factor out common decoding code for Indeo 4 and Indeo 5
  mp3: fix start band index for block type 2 in 8kHz audio
  lavf: change some (de)muxer names to lowercase
  lavf: make output format matching case insensitive

Conflicts:
	libavcodec/indeo4.c
	libavcodec/indeo5.c
	libavcodec/ivi_common.c
	libavcodec/utils.c
	tests/fate/video.mak
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 432fe9a3 4f04f5cc
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* @file * @file
* IMC - Intel Music Coder * IMC - Intel Music Coder
* A mdct based codec using a 256 points large transform * A mdct based codec using a 256 points large transform
* divied into 32 bands with some mix of scale factors. * divided into 32 bands with some mix of scale factors.
* Only mono is supported. * Only mono is supported.
* *
*/ */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include <stdint.h> #include <stdint.h>
#define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes #define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes
#define IVI4_STREAM_ANALYSER 0
#define IVI5_IS_PROTECTED 0x20
/** /**
* huffman codebook descriptor * huffman codebook descriptor
...@@ -116,6 +118,7 @@ typedef struct { ...@@ -116,6 +118,7 @@ typedef struct {
int ypos; int ypos;
int width; int width;
int height; int height;
int mb_size;
int is_empty; ///< = 1 if this tile doesn't contain any data int is_empty; ///< = 1 if this tile doesn't contain any data
int data_size; ///< size of the data in bytes int data_size; ///< size of the data in bytes
int num_MBs; ///< number of macroblocks in this tile int num_MBs; ///< number of macroblocks in this tile
...@@ -132,6 +135,7 @@ typedef struct { ...@@ -132,6 +135,7 @@ typedef struct {
int band_num; ///< band number int band_num; ///< band number
int width; int width;
int height; int height;
int aheight; ///< aligned band height
const uint8_t *data_ptr; ///< ptr to the first byte of the band data const uint8_t *data_ptr; ///< ptr to the first byte of the band data
int data_size; ///< size of the band data int data_size; ///< size of the band data
int16_t *buf; ///< pointer to the output buffer for this band int16_t *buf; ///< pointer to the output buffer for this band
...@@ -193,6 +197,63 @@ typedef struct { ...@@ -193,6 +197,63 @@ typedef struct {
uint8_t chroma_bands; uint8_t chroma_bands;
} IVIPicConfig; } IVIPicConfig;
typedef struct IVI45DecContext {
GetBitContext gb;
AVFrame frame;
RVMapDesc rvmap_tabs[9]; ///< local corrected copy of the static rvmap tables
uint32_t frame_num;
int frame_type;
int prev_frame_type; ///< frame type of the previous frame
uint32_t data_size; ///< size of the frame data in bytes from picture header
int is_scalable;
int transp_status; ///< transparency mode status: 1 - enabled
const uint8_t *frame_data; ///< input frame data pointer
int inter_scal; ///< signals a sequence of scalable inter frames
uint32_t frame_size; ///< frame size in bytes
uint32_t pic_hdr_size; ///< picture header size in bytes
uint8_t frame_flags;
uint16_t checksum; ///< frame checksum
IVIPicConfig pic_conf;
IVIPlaneDesc planes[3]; ///< color planes
int buf_switch; ///< used to switch between three buffers
int dst_buf; ///< buffer index for the currently decoded frame
int ref_buf; ///< inter frame reference buffer index
int ref2_buf; ///< temporal storage for switching buffers
IVIHuffTab mb_vlc; ///< current macroblock table descriptor
IVIHuffTab blk_vlc; ///< current block table descriptor
uint8_t rvmap_sel;
uint8_t in_imf;
uint8_t in_q; ///< flag for explicitly stored quantiser delta
uint8_t pic_glob_quant;
uint8_t unknown1;
uint16_t gop_hdr_size;
uint8_t gop_flags;
uint32_t lock_word;
#if IVI4_STREAM_ANALYSER
uint8_t has_b_frames;
uint8_t has_transp;
uint8_t uses_tiling;
uint8_t uses_haar;
uint8_t uses_fullpel;
#endif
int (*decode_pic_hdr) (struct IVI45DecContext *ctx, AVCodecContext *avctx);
int (*decode_band_hdr) (struct IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx);
int (*decode_mb_info) (struct IVI45DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx);
void (*switch_buffers) (struct IVI45DecContext *ctx);
int (*is_nonnull_frame)(struct IVI45DecContext *ctx);
int gop_invalid;
int buf_invalid[3];
} IVI45DecContext;
/** compare some properties of two pictures */ /** compare some properties of two pictures */
static inline int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2) static inline int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2)
{ {
...@@ -339,14 +400,8 @@ void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band, ...@@ -339,14 +400,8 @@ void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
*/ */
void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch); void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch);
/** int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
* Calculate band checksum from band data. AVPacket *avpkt);
*/ av_cold int ff_ivi_decode_close(AVCodecContext *avctx);
uint16_t ivi_calc_band_checksum (IVIBandDesc *band);
/**
* Verify that band data lies in range.
*/
int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch);
#endif /* AVCODEC_IVI_COMMON_H */ #endif /* AVCODEC_IVI_COMMON_H */
...@@ -174,9 +174,12 @@ static void ff_region_offset2size(GranuleDef *g) ...@@ -174,9 +174,12 @@ static void ff_region_offset2size(GranuleDef *g)
static void ff_init_short_region(MPADecodeContext *s, GranuleDef *g) static void ff_init_short_region(MPADecodeContext *s, GranuleDef *g)
{ {
if (g->block_type == 2) if (g->block_type == 2) {
g->region_size[0] = (36 / 2); if (s->sample_rate_index != 8)
else { g->region_size[0] = (36 / 2);
else
g->region_size[0] = (72 / 2);
} else {
if (s->sample_rate_index <= 2) if (s->sample_rate_index <= 2)
g->region_size[0] = (36 / 2); g->region_size[0] = (36 / 2);
else if (s->sample_rate_index != 8) else if (s->sample_rate_index != 8)
...@@ -201,14 +204,12 @@ static void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g) ...@@ -201,14 +204,12 @@ static void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g)
if (g->block_type == 2) { if (g->block_type == 2) {
if (g->switch_point) { if (g->switch_point) {
/* if switched mode, we handle the 36 first samples as /* if switched mode, we handle the 36 first samples as
long blocks. For 8000Hz, we handle the 48 first long blocks. For 8000Hz, we handle the 72 first
exponents as long blocks (XXX: check this!) */ exponents as long blocks */
if (s->sample_rate_index <= 2) if (s->sample_rate_index <= 2)
g->long_end = 8; g->long_end = 8;
else if (s->sample_rate_index != 8)
g->long_end = 6;
else else
g->long_end = 4; /* 8000 Hz */ g->long_end = 6;
g->short_start = 2 + (s->sample_rate_index != 8); g->short_start = 2 + (s->sample_rate_index != 8);
} else { } else {
...@@ -1018,7 +1019,7 @@ static void reorder_block(MPADecodeContext *s, GranuleDef *g) ...@@ -1018,7 +1019,7 @@ static void reorder_block(MPADecodeContext *s, GranuleDef *g)
if (s->sample_rate_index != 8) if (s->sample_rate_index != 8)
ptr = g->sb_hybrid + 36; ptr = g->sb_hybrid + 36;
else else
ptr = g->sb_hybrid + 48; ptr = g->sb_hybrid + 72;
} else { } else {
ptr = g->sb_hybrid; ptr = g->sb_hybrid;
} }
......
...@@ -354,14 +354,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s) ...@@ -354,14 +354,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
if (s->flags & FLAG_SPRITE) { if (s->flags & FLAG_SPRITE) {
av_log_ask_for_sample(s->avctx, "SPRITE frame found.\n"); av_log_ask_for_sample(s->avctx, "SPRITE frame found.\n");
/* FIXME header.width, height, xoffset and yoffset aren't initialized */ /* FIXME header.width, height, xoffset and yoffset aren't initialized */
#if 0
s->w = header.width;
s->h = header.height;
s->x = header.xoffset;
s->y = header.yoffset;
#else
return -1; return -1;
#endif
} else { } else {
s->w = header.xsize; s->w = header.xsize;
s->h = header.ysize; s->h = header.ysize;
......
...@@ -1212,7 +1212,8 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, ...@@ -1212,7 +1212,8 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx,
avctx->sample_fmt, 1); avctx->sample_fmt, 1);
if ((ret = avcodec_fill_audio_frame(frame, avctx->channels, if ((ret = avcodec_fill_audio_frame(frame, avctx->channels,
avctx->sample_fmt, avctx->sample_fmt,
(const uint8_t *)samples, samples_size, 1))) (const uint8_t *) samples,
samples_size, 1)))
return ret; return ret;
/* fabricate frame pts from sample count. /* fabricate frame pts from sample count.
......
...@@ -220,7 +220,7 @@ static int roq_read_packet(AVFormatContext *s, ...@@ -220,7 +220,7 @@ static int roq_read_packet(AVFormatContext *s,
} }
AVInputFormat ff_roq_demuxer = { AVInputFormat ff_roq_demuxer = {
.name = "RoQ", .name = "roq",
.long_name = NULL_IF_CONFIG_SMALL("id RoQ format"), .long_name = NULL_IF_CONFIG_SMALL("id RoQ format"),
.priv_data_size = sizeof(RoqDemuxContext), .priv_data_size = sizeof(RoqDemuxContext),
.read_probe = roq_probe, .read_probe = roq_probe,
......
...@@ -36,7 +36,7 @@ static int roq_write_header(struct AVFormatContext *s) ...@@ -36,7 +36,7 @@ static int roq_write_header(struct AVFormatContext *s)
} }
AVOutputFormat ff_roq_muxer = { AVOutputFormat ff_roq_muxer = {
.name = "RoQ", .name = "roq",
.long_name = NULL_IF_CONFIG_SMALL("raw id RoQ format"), .long_name = NULL_IF_CONFIG_SMALL("raw id RoQ format"),
.extensions = "roq", .extensions = "roq",
.audio_codec = CODEC_ID_ROQ_DPCM, .audio_codec = CODEC_ID_ROQ_DPCM,
......
...@@ -384,7 +384,7 @@ static int iff_read_packet(AVFormatContext *s, ...@@ -384,7 +384,7 @@ static int iff_read_packet(AVFormatContext *s,
} }
AVInputFormat ff_iff_demuxer = { AVInputFormat ff_iff_demuxer = {
.name = "IFF", .name = "iff",
.long_name = NULL_IF_CONFIG_SMALL("Interchange File Format"), .long_name = NULL_IF_CONFIG_SMALL("Interchange File Format"),
.priv_data_size = sizeof(IffDemuxContext), .priv_data_size = sizeof(IffDemuxContext),
.read_probe = iff_probe, .read_probe = iff_probe,
......
...@@ -128,7 +128,7 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -128,7 +128,7 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
} }
AVInputFormat ff_iss_demuxer = { AVInputFormat ff_iss_demuxer = {
.name = "ISS", .name = "iss",
.long_name = NULL_IF_CONFIG_SMALL("Funcom ISS format"), .long_name = NULL_IF_CONFIG_SMALL("Funcom ISS format"),
.priv_data_size = sizeof(IssDemuxContext), .priv_data_size = sizeof(IssDemuxContext),
.read_probe = iss_probe, .read_probe = iss_probe,
......
...@@ -194,7 +194,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -194,7 +194,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
} }
AVInputFormat ff_mtv_demuxer = { AVInputFormat ff_mtv_demuxer = {
.name = "MTV", .name = "mtv",
.long_name = NULL_IF_CONFIG_SMALL("MTV format"), .long_name = NULL_IF_CONFIG_SMALL("MTV format"),
.priv_data_size = sizeof(MTVDemuxContext), .priv_data_size = sizeof(MTVDemuxContext),
.read_probe = mtv_probe, .read_probe = mtv_probe,
......
...@@ -228,7 +228,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename, ...@@ -228,7 +228,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
score_max = 0; score_max = 0;
while ((fmt = av_oformat_next(fmt))) { while ((fmt = av_oformat_next(fmt))) {
score = 0; score = 0;
if (fmt->name && short_name && !strcmp(fmt->name, short_name)) if (fmt->name && short_name && !av_strcasecmp(fmt->name, short_name))
score += 100; score += 100;
if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type)) if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type))
score += 10; score += 10;
......
...@@ -86,16 +86,16 @@ FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%) ...@@ -86,16 +86,16 @@ FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%)
FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%) FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%)
FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%) FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%)
FATE = $(FATE_ACODEC) \ FATE_AVCONV += $(FATE_ACODEC) \
$(FATE_VCODEC) \ $(FATE_VCODEC) \
$(FATE_LAVF) \ $(FATE_LAVF) \
$(FATE_SEEK) \ $(FATE_LAVFI) \
$(FATE_SEEK) \
FATE_FFMPEG += $(FATE_FFMPEG-yes) $(FATE_AVCONV) $(FATE_AVCONV-yes) FATE_FFMPEG += $(FATE_FFMPEG-yes) $(FATE_AVCONV) $(FATE_AVCONV-yes)
FATE-$(CONFIG_FFMPEG) += $(FATE_FFMPEG) FATE-$(CONFIG_FFMPEG) += $(FATE_FFMPEG)
FATE-$(CONFIG_AVCODEC) += $(FATE_LIBAVCODEC) FATE-$(CONFIG_AVCODEC) += $(FATE_LIBAVCODEC)
FATE-$(CONFIG_AVFILTER) += $(FATE_LAVFI)
FATE_SAMPLES-$(CONFIG_FFMPEG) += $(FATE_SAMPLES_AVCONV) $(FATE_SAMPLES_FFMPEG) FATE_SAMPLES-$(CONFIG_FFMPEG) += $(FATE_SAMPLES_AVCONV) $(FATE_SAMPLES_FFMPEG)
FATE_SAMPLES += $(FATE_SAMPLES-yes) FATE_SAMPLES += $(FATE_SAMPLES-yes)
......
...@@ -119,7 +119,7 @@ FATE_VIDEO += fate-id-cin-video ...@@ -119,7 +119,7 @@ FATE_VIDEO += fate-id-cin-video
fate-id-cin-video: CMD = framecrc -i $(SAMPLES)/idcin/idlog-2MB.cin -pix_fmt rgb24 fate-id-cin-video: CMD = framecrc -i $(SAMPLES)/idcin/idlog-2MB.cin -pix_fmt rgb24
FATE_VIDEO-$(CONFIG_AVFILTER) += fate-idroq-video-encode FATE_VIDEO-$(CONFIG_AVFILTER) += fate-idroq-video-encode
fate-idroq-video-encode: CMD = md5 -f image2 -vcodec pgmyuv -i $(SAMPLES)/ffmpeg-synthetic/vsynth1/%02d.pgm -sws_flags +bitexact -vf pad=512:512:80:112 -f RoQ -t 0.2 fate-idroq-video-encode: CMD = md5 -f image2 -vcodec pgmyuv -i $(SAMPLES)/ffmpeg-synthetic/vsynth1/%02d.pgm -sws_flags +bitexact -vf pad=512:512:80:112 -f roq -t 0.2
FATE_IFF += fate-iff-byterun1 FATE_IFF += fate-iff-byterun1
fate-iff-byterun1: CMD = framecrc -i $(SAMPLES)/iff/ASH.LBM -pix_fmt rgb24 fate-iff-byterun1: CMD = framecrc -i $(SAMPLES)/iff/ASH.LBM -pix_fmt rgb24
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment