Commit b000b86e authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote branch 'qatar/master'

* qatar/master: (23 commits)
  doc: Check standalone compilation before submitting new components.
  Fix standalone compilation of pipe protocol.
  Fix standalone compilation of ac3_fixed encoder.
  Fix standalone compilation of binkaudio_dct / binkaudio_rdft decoders.
  Fix standalone compilation of IMC decoder.
  Fix standalone compilation of WTV demuxer.
  Fix standalone compilation of MXPEG decoder.
  flashsv: K&R cosmetics
  matroskaenc: fix memory leak
  vc1: make overlap filter for I-frames bit-exact.
  vc1dec: use s->start/end_mb_y instead of passing them as function args.
  Revert "VC1: merge idct8x8, coeff adjustments and put_pixels."
  Replace strncpy() with av_strlcpy().
  indeo3: Eliminate use of long.
  get_bits: make cache unsigned to eliminate undefined signed overflow.
  asfdec: fix assert failure on invalid files
  avfilter: check malloc return values.
Not pulled as reason for reindent is not pulled:  mpegvideo: reindent.
  nutenc: check malloc return values.
Not pulled due to much simpler solution in ffmpeg  *: don't av_malloc(0).
  ...

Conflicts:
	doc/developer.texi
	libavcodec/Makefile
	libavcodec/get_bits.h
	libavcodec/mpegvideo.c
	libavformat/Makefile
	libavutil/log.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 9a5624a0 af1ca249
......@@ -1252,14 +1252,14 @@ aac_encoder_select="mdct sinewin"
aac_latm_decoder_select="aac_decoder aac_latm_parser"
ac3_decoder_select="mdct ac3dsp ac3_parser"
ac3_encoder_select="mdct ac3dsp"
ac3_fixed_encoder_select="ac3dsp"
ac3_fixed_encoder_select="mdct ac3dsp"
alac_encoder_select="lpc"
amrnb_decoder_select="lsp"
amrwb_decoder_select="lsp"
atrac1_decoder_select="mdct sinewin"
atrac3_decoder_select="mdct"
binkaudio_dct_decoder_select="mdct rdft dct"
binkaudio_rdft_decoder_select="mdct rdft"
binkaudio_dct_decoder_select="mdct rdft dct sinewin"
binkaudio_rdft_decoder_select="mdct rdft sinewin"
cavs_decoder_select="golomb"
cook_decoder_select="mdct sinewin"
cscd_decoder_suggest="zlib"
......@@ -1291,7 +1291,7 @@ h264_dxva2_hwaccel_deps="dxva2api_h"
h264_dxva2_hwaccel_select="dxva2 h264_decoder"
h264_vaapi_hwaccel_select="vaapi"
h264_vdpau_decoder_select="vdpau h264_decoder"
imc_decoder_select="fft mdct"
imc_decoder_select="fft mdct sinewin"
jpegls_decoder_select="golomb"
jpegls_encoder_select="golomb"
ljpeg_encoder_select="aandct"
......
......@@ -312,9 +312,14 @@ send a reminder by email. Your patch should eventually be dealt with.
If it depends on a parser or a library, did you add that dependency in
configure?
@item
Did you "git add" the appropriate files before committing?
Did you @code{git add} the appropriate files before committing?
@item
Did you make sure it compiles standalone, i.e. with
@code{configure --disable-everything --enable-decoder=foo}
(or @code{--enable-demuxer} or whatever your component is)?
@end enumerate
@section patch submission checklist
@enumerate
......
......@@ -3816,8 +3816,7 @@ static int opt_streamid(const char *opt, const char *arg)
char *p;
char idx_str[16];
strncpy(idx_str, arg, sizeof(idx_str));
idx_str[sizeof(idx_str)-1] = '\0';
av_strlcpy(idx_str, arg, sizeof(idx_str));
p = strchr(idx_str, ':');
if (!p) {
fprintf(stderr,
......
......@@ -277,7 +277,7 @@ OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o
OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o
OBJS-$(CONFIG_MSVIDEO1_ENCODER) += msvideo1enc.o elbg.o
OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o
OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o mjpegdec.o mjpeg.o
OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o
OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o
OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o
......@@ -556,6 +556,7 @@ OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o
OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \
flacdec.o flacdata.o flac.o \
mpegaudiodata.o vorbis_data.o
OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
# external codec libraries
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
......
......@@ -33,6 +33,7 @@
#include "libavutil/audioconvert.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/crc.h"
#include "libavutil/opt.h"
#include "avcodec.h"
......@@ -1551,10 +1552,10 @@ static void dprint_options(AVCodecContext *avctx)
char strbuf[32];
switch (s->bitstream_id) {
case 6: strncpy(strbuf, "AC-3 (alt syntax)", 32); break;
case 8: strncpy(strbuf, "AC-3 (standard)", 32); break;
case 9: strncpy(strbuf, "AC-3 (dnet half-rate)", 32); break;
case 10: strncpy(strbuf, "AC-3 (dnet quater-rate", 32); break;
case 6: av_strlcpy(strbuf, "AC-3 (alt syntax)", 32); break;
case 8: av_strlcpy(strbuf, "AC-3 (standard)", 32); break;
case 9: av_strlcpy(strbuf, "AC-3 (dnet half-rate)", 32); break;
case 10: av_strlcpy(strbuf, "AC-3 (dnet quater-rate", 32); break;
default: snprintf(strbuf, 32, "ERROR");
}
av_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id);
......@@ -1581,9 +1582,9 @@ static void dprint_options(AVCodecContext *avctx)
if (opt->audio_production_info) {
av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level);
switch (opt->room_type) {
case 0: strncpy(strbuf, "notindicated", 32); break;
case 1: strncpy(strbuf, "large", 32); break;
case 2: strncpy(strbuf, "small", 32); break;
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
case 1: av_strlcpy(strbuf, "large", 32); break;
case 2: av_strlcpy(strbuf, "small", 32); break;
default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type);
}
av_dlog(avctx, "room_type: %s\n", strbuf);
......@@ -1595,9 +1596,9 @@ static void dprint_options(AVCodecContext *avctx)
av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level);
if (s->channel_mode == AC3_CHMODE_STEREO) {
switch (opt->dolby_surround_mode) {
case 0: strncpy(strbuf, "notindicated", 32); break;
case 1: strncpy(strbuf, "on", 32); break;
case 2: strncpy(strbuf, "off", 32); break;
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
case 1: av_strlcpy(strbuf, "on", 32); break;
case 2: av_strlcpy(strbuf, "off", 32); break;
default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_mode);
}
av_dlog(avctx, "dsur_mode: %s\n", strbuf);
......@@ -1609,9 +1610,9 @@ static void dprint_options(AVCodecContext *avctx)
if (s->bitstream_id == 6) {
if (opt->extended_bsi_1) {
switch (opt->preferred_stereo_downmix) {
case 0: strncpy(strbuf, "notindicated", 32); break;
case 1: strncpy(strbuf, "ltrt", 32); break;
case 2: strncpy(strbuf, "loro", 32); break;
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
case 1: av_strlcpy(strbuf, "ltrt", 32); break;
case 2: av_strlcpy(strbuf, "loro", 32); break;
default: snprintf(strbuf, 32, "ERROR (%d)", opt->preferred_stereo_downmix);
}
av_dlog(avctx, "dmix_mode: %s\n", strbuf);
......@@ -1628,23 +1629,23 @@ static void dprint_options(AVCodecContext *avctx)
}
if (opt->extended_bsi_2) {
switch (opt->dolby_surround_ex_mode) {
case 0: strncpy(strbuf, "notindicated", 32); break;
case 1: strncpy(strbuf, "on", 32); break;
case 2: strncpy(strbuf, "off", 32); break;
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
case 1: av_strlcpy(strbuf, "on", 32); break;
case 2: av_strlcpy(strbuf, "off", 32); break;
default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_ex_mode);
}
av_dlog(avctx, "dsurex_mode: %s\n", strbuf);
switch (opt->dolby_headphone_mode) {
case 0: strncpy(strbuf, "notindicated", 32); break;
case 1: strncpy(strbuf, "on", 32); break;
case 2: strncpy(strbuf, "off", 32); break;
case 0: av_strlcpy(strbuf, "notindicated", 32); break;
case 1: av_strlcpy(strbuf, "on", 32); break;
case 2: av_strlcpy(strbuf, "off", 32); break;
default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_headphone_mode);
}
av_dlog(avctx, "dheadphone_mode: %s\n", strbuf);
switch (opt->ad_converter_type) {
case 0: strncpy(strbuf, "standard", 32); break;
case 1: strncpy(strbuf, "hdcd", 32); break;
case 0: av_strlcpy(strbuf, "standard", 32); break;
case 1: av_strlcpy(strbuf, "hdcd", 32); break;
default: snprintf(strbuf, 32, "ERROR (%d)", opt->ad_converter_type);
}
av_dlog(avctx, "ad_conv_type: %s\n", strbuf);
......
......@@ -21,6 +21,7 @@
#include "avcodec.h"
#include "ass.h"
#include "libavutil/avstring.h"
int ff_ass_subtitle_header(AVCodecContext *avctx,
const char *font, int font_size,
......@@ -97,8 +98,7 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,
rects[sub->num_rects]->type = SUBTITLE_ASS;
rects[sub->num_rects]->ass = av_malloc(len + dlen + 1);
strcpy (rects[sub->num_rects]->ass , header);
strncpy(rects[sub->num_rects]->ass + len, dialog, dlen);
rects[sub->num_rects]->ass[len+dlen] = 0;
av_strlcpy(rects[sub->num_rects]->ass + len, dialog, dlen + 1);
sub->num_rects++;
return dlen;
}
......@@ -148,7 +148,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
if ((avctx->width != s->image_width) || (avctx->height != s->image_height)) {
av_log(avctx, AV_LOG_ERROR, "Frame width or height differs from first frames!\n");
av_log(avctx, AV_LOG_ERROR, "fh = %d, fv %d vs ch = %d, cv = %d\n", avctx->height,
avctx->width,s->image_height, s->image_width);
avctx->width, s->image_height, s->image_width);
return -1;
}
......@@ -195,7 +195,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
s->zstream.next_in = buf + (get_bits_count(&gb) / 8);
s->zstream.avail_in = size;
s->zstream.next_out = s->tmpblock;
s->zstream.avail_out = s->block_size*3;
s->zstream.avail_out = s->block_size * 3;
ret = inflate(&(s->zstream), Z_FINISH);
if (ret == Z_DATA_ERROR) {
av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n");
......
......@@ -127,7 +127,7 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
# define OPEN_READER(name, gb) \
unsigned int name##_index = (gb)->index; \
av_unused int name##_cache
av_unused unsigned int name##_cache
# define CLOSE_READER(name, gb) (gb)->index = name##_index
......
......@@ -149,13 +149,13 @@ static av_cold void iv_free_func(Indeo3DecodeContext *s)
}
struct ustr {
long xpos;
long ypos;
long width;
long height;
long split_flag;
long split_direction;
long usl7;
int xpos;
int ypos;
int width;
int height;
int split_flag;
int split_direction;
int usl7;
};
......@@ -203,12 +203,12 @@ struct ustr {
static void iv_Decode_Chunk(Indeo3DecodeContext *s,
uint8_t *cur, uint8_t *ref, int width, int height,
const uint8_t *buf1, long cb_offset, const uint8_t *hdr,
const uint8_t *buf1, int cb_offset, const uint8_t *hdr,
const uint8_t *buf2, int min_width_160)
{
uint8_t bit_buf;
unsigned long bit_pos, lv, lv1, lv2;
long *width_tbl, width_tbl_arr[10];
unsigned int bit_pos, lv, lv1, lv2;
int *width_tbl, width_tbl_arr[10];
const signed char *ref_vectors;
uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
uint32_t *cur_lp, *ref_lp;
......@@ -982,7 +982,7 @@ static int iv_decode_frame(AVCodecContext *avctx,
Indeo3DecodeContext *s = avctx->priv_data;
unsigned int image_width, image_height,
chroma_width, chroma_height;
unsigned long flags, cb_offset, data_size,
unsigned int flags, cb_offset, data_size,
y_offset, v_offset, u_offset, mc_vector_count;
const uint8_t *hdr_pos, *buf_pos;
......
......@@ -130,8 +130,7 @@ do { \
/** Do inverse transform on 8x8 block
*/
static void vc1_inv_trans_8x8_altivec(DCTELEM block[64],
int sign, int rangered)
static void vc1_inv_trans_8x8_altivec(DCTELEM block[64])
{
vector signed short src0, src1, src2, src3, src4, src5, src6, src7;
vector signed int s0, s1, s2, s3, s4, s5, s6, s7;
......@@ -145,9 +144,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64],
const vector unsigned int vec_2 = vec_splat_u32(2);
const vector signed int vec_1s = vec_splat_s32(1);
const vector unsigned int vec_1 = vec_splat_u32(1);
const vector unsigned short rangered_shift = vec_splat_u16(1);
const vector signed short signed_bias = vec_sl(vec_splat_s16(4),
vec_splat_u16(4));
src0 = vec_ld( 0, block);
src1 = vec_ld( 16, block);
......@@ -217,27 +213,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64],
src6 = vec_pack(sE, s6);
src7 = vec_pack(sF, s7);
if (rangered) {
if (!sign) {
src0 = vec_sub(src0, signed_bias);
src1 = vec_sub(src1, signed_bias);
src2 = vec_sub(src2, signed_bias);
src3 = vec_sub(src3, signed_bias);
src4 = vec_sub(src4, signed_bias);
src5 = vec_sub(src5, signed_bias);
src6 = vec_sub(src6, signed_bias);
src7 = vec_sub(src7, signed_bias);
}
src0 = vec_sl(src0, rangered_shift);
src1 = vec_sl(src1, rangered_shift);
src2 = vec_sl(src2, rangered_shift);
src3 = vec_sl(src3, rangered_shift);
src4 = vec_sl(src4, rangered_shift);
src5 = vec_sl(src5, rangered_shift);
src6 = vec_sl(src6, rangered_shift);
src7 = vec_sl(src7, rangered_shift);
}
vec_st(src0, 0, block);
vec_st(src1, 16, block);
vec_st(src2, 32, block);
......@@ -248,36 +223,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64],
vec_st(src7,112, block);
}
static void vc1_inv_trans_8x8_add_altivec(uint8_t *dest, int stride, DCTELEM *b)
{
vc1_inv_trans_8x8_altivec(b, 0, 0);
ff_add_pixels_clamped_c(b, dest, stride);
}
static void vc1_inv_trans_8x8_put_signed_altivec(uint8_t *dest, int stride, DCTELEM *b)
{
vc1_inv_trans_8x8_altivec(b, 1, 0);
ff_put_signed_pixels_clamped_c(b, dest, stride);
}
static void vc1_inv_trans_8x8_put_signed_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b)
{
vc1_inv_trans_8x8_altivec(b, 1, 1);
ff_put_signed_pixels_clamped_c(b, dest, stride);
}
static void vc1_inv_trans_8x8_put_altivec(uint8_t *dest, int stride, DCTELEM *b)
{
vc1_inv_trans_8x8_altivec(b, 0, 0);
ff_put_pixels_clamped_c(b, dest, stride);
}
static void vc1_inv_trans_8x8_put_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b)
{
vc1_inv_trans_8x8_altivec(b, 0, 1);
ff_put_pixels_clamped_c(b, dest, stride);
}
/** Do inverse transform on 8x4 part of block
*/
static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block)
......@@ -396,11 +341,7 @@ void ff_vc1dsp_init_altivec(VC1DSPContext* dsp)
if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
return;
dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_altivec;
dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_altivec;
dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_altivec;
dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_altivec;
dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_altivec;
dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec;
dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec;
dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec;
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec;
......
......@@ -280,28 +280,6 @@ static int vop_dquant_decoding(VC1Context *v)
static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb);
static void simple_idct_put_rangered(uint8_t *dest, int line_size, DCTELEM *block)
{
int i;
ff_simple_idct(block);
for (i = 0; i < 64; i++) block[i] = (block[i] - 64) << 1;
ff_put_pixels_clamped_c(block, dest, line_size);
}
static void simple_idct_put_signed(uint8_t *dest, int line_size, DCTELEM *block)
{
ff_simple_idct(block);
ff_put_signed_pixels_clamped_c(block, dest, line_size);
}
static void simple_idct_put_signed_rangered(uint8_t *dest, int line_size, DCTELEM *block)
{
int i;
ff_simple_idct(block);
for (i = 0; i < 64; i++) block[i] <<= 1;
ff_put_signed_pixels_clamped_c(block, dest, line_size);
}
/**
* Decode Simple/Main Profiles sequence header
* @see Figure 7-8, p16-17
......@@ -359,11 +337,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
v->res_fasttx = get_bits1(gb);
if (!v->res_fasttx)
{
v->vc1dsp.vc1_inv_trans_8x8_add = ff_simple_idct_add;
v->vc1dsp.vc1_inv_trans_8x8_put[0] = ff_simple_idct_put;
v->vc1dsp.vc1_inv_trans_8x8_put[1] = simple_idct_put_rangered;
v->vc1dsp.vc1_inv_trans_8x8_put_signed[0] = simple_idct_put_signed;
v->vc1dsp.vc1_inv_trans_8x8_put_signed[1] = simple_idct_put_signed_rangered;
v->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct;
v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add;
v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add;
v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add;
......
......@@ -317,6 +317,8 @@ typedef struct VC1Context{
int bi_type;
int x8_type;
DCTELEM (*block)[6][64];
int n_allocated_blks, cur_blk_idx, left_blk_idx, topleft_blk_idx, top_blk_idx;
uint32_t *cbp_base, *cbp;
uint8_t *is_intra_base, *is_intra;
int16_t (*luma_mv_base)[2], (*luma_mv)[2];
......
This diff is collapsed.
......@@ -78,6 +78,58 @@ static void vc1_h_overlap_c(uint8_t* src, int stride)
}
}
static void vc1_v_s_overlap_c(DCTELEM *top, DCTELEM *bottom)
{
int i;
int a, b, c, d;
int d1, d2;
int rnd1 = 4, rnd2 = 3;
for(i = 0; i < 8; i++) {
a = top[48];
b = top[56];
c = bottom[0];
d = bottom[8];
d1 = a - d;
d2 = a - d + b - c;
top[48] = ((a << 3) - d1 + rnd1) >> 3;
top[56] = ((b << 3) - d2 + rnd2) >> 3;
bottom[0] = ((c << 3) + d2 + rnd1) >> 3;
bottom[8] = ((d << 3) + d1 + rnd2) >> 3;
bottom++;
top++;
rnd2 = 7 - rnd2;
rnd1 = 7 - rnd1;
}
}
static void vc1_h_s_overlap_c(DCTELEM *left, DCTELEM *right)
{
int i;
int a, b, c, d;
int d1, d2;
int rnd1 = 4, rnd2 = 3;
for(i = 0; i < 8; i++) {
a = left[6];
b = left[7];
c = right[0];
d = right[1];
d1 = a - d;
d2 = a - d + b - c;
left[6] = ((a << 3) - d1 + rnd1) >> 3;
left[7] = ((b << 3) - d2 + rnd2) >> 3;
right[0] = ((c << 3) + d2 + rnd1) >> 3;
right[1] = ((d << 3) + d1 + rnd2) >> 3;
right += 8;
left += 8;
rnd2 = 7 - rnd2;
rnd1 = 7 - rnd1;
}
}
/**
* VC-1 in-loop deblocking filter for one line
* @param src source block type
......@@ -199,7 +251,7 @@ static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
}
}
static av_always_inline void vc1_inv_trans_8x8_c(DCTELEM block[64], int shl, int sub)
static void vc1_inv_trans_8x8_c(DCTELEM block[64])
{
int i;
register int t1,t2,t3,t4,t5,t6,t7,t8;
......@@ -254,50 +306,20 @@ static av_always_inline void vc1_inv_trans_8x8_c(DCTELEM block[64], int shl, int
t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dst[ 0] = (((t5 + t1 ) >> 7) - sub) << shl;
dst[ 8] = (((t6 + t2 ) >> 7) - sub) << shl;
dst[16] = (((t7 + t3 ) >> 7) - sub) << shl;
dst[24] = (((t8 + t4 ) >> 7) - sub) << shl;
dst[32] = (((t8 - t4 + 1) >> 7) - sub) << shl;
dst[40] = (((t7 - t3 + 1) >> 7) - sub) << shl;
dst[48] = (((t6 - t2 + 1) >> 7) - sub) << shl;
dst[56] = (((t5 - t1 + 1) >> 7) - sub) << shl;
dst[ 0] = (t5 + t1) >> 7;
dst[ 8] = (t6 + t2) >> 7;
dst[16] = (t7 + t3) >> 7;
dst[24] = (t8 + t4) >> 7;
dst[32] = (t8 - t4 + 1) >> 7;
dst[40] = (t7 - t3 + 1) >> 7;
dst[48] = (t6 - t2 + 1) >> 7;
dst[56] = (t5 - t1 + 1) >> 7;
src++;
dst++;
}
}
static void vc1_inv_trans_8x8_add_c(uint8_t *dest, int linesize, DCTELEM *block)
{
vc1_inv_trans_8x8_c(block, 0, 0);
ff_add_pixels_clamped_c(block, dest, linesize);
}
static void vc1_inv_trans_8x8_put_signed_c(uint8_t *dest, int linesize, DCTELEM *block)
{
vc1_inv_trans_8x8_c(block, 0, 0);
ff_put_signed_pixels_clamped_c(block, dest, linesize);
}
static void vc1_inv_trans_8x8_put_signed_rangered_c(uint8_t *dest, int linesize, DCTELEM *block)
{
vc1_inv_trans_8x8_c(block, 1, 0);
ff_put_signed_pixels_clamped_c(block, dest, linesize);
}
static void vc1_inv_trans_8x8_put_c(uint8_t *dest, int linesize, DCTELEM *block)
{
vc1_inv_trans_8x8_c(block, 0, 0);
ff_put_pixels_clamped_c(block, dest, linesize);
}
static void vc1_inv_trans_8x8_put_rangered_c(uint8_t *dest, int linesize, DCTELEM *block)
{
vc1_inv_trans_8x8_c(block, 1, 64);
ff_put_pixels_clamped_c(block, dest, linesize);
}
/** Do inverse transform on 8x4 part of block
*/
static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
......@@ -692,11 +714,7 @@ static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*a
}
av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) {
dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_c;
dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_c;
dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_c;
dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_c;
dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_c;
dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;
dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c;
dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c;
dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c;
......@@ -706,6 +724,8 @@ av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) {
dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c;
dsp->vc1_h_overlap = vc1_h_overlap_c;
dsp->vc1_v_overlap = vc1_v_overlap_c;
dsp->vc1_h_s_overlap = vc1_h_s_overlap_c;
dsp->vc1_v_s_overlap = vc1_v_s_overlap_c;
dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c;
dsp->vc1_h_loop_filter4 = vc1_h_loop_filter4_c;
dsp->vc1_v_loop_filter8 = vc1_v_loop_filter8_c;
......
......@@ -30,13 +30,9 @@
#include "dsputil.h"
typedef void (*vc1_idct_func)(uint8_t *dest, int line_size, DCTELEM *block);
typedef struct VC1DSPContext {
/* vc1 functions */
vc1_idct_func vc1_inv_trans_8x8_add;
vc1_idct_func vc1_inv_trans_8x8_put_signed[2];
vc1_idct_func vc1_inv_trans_8x8_put[2];
void (*vc1_inv_trans_8x8)(DCTELEM *b);
void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block);
void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block);
void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block);
......@@ -44,8 +40,10 @@ typedef struct VC1DSPContext {
void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block);
void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block);
void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block);
void (*vc1_v_overlap)(uint8_t* src, int stride);
void (*vc1_h_overlap)(uint8_t* src, int stride);
void (*vc1_v_overlap)(uint8_t *src, int stride);
void (*vc1_h_overlap)(uint8_t *src, int stride);
void (*vc1_v_s_overlap)(DCTELEM *top, DCTELEM *bottom);
void (*vc1_h_s_overlap)(DCTELEM *left, DCTELEM *right);
void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq);
void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq);
void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq);
......
......@@ -585,28 +585,53 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
return AVERROR(EINVAL);
ret = av_mallocz(sizeof(AVFilterContext));
if (!ret)
return AVERROR(ENOMEM);
ret->av_class = &avfilter_class;
ret->filter = filter;
ret->name = inst_name ? av_strdup(inst_name) : NULL;
ret->priv = av_mallocz(filter->priv_size);
if (filter->priv_size) {
ret->priv = av_mallocz(filter->priv_size);
if (!ret->priv)
goto err;
}
ret->input_count = pad_count(filter->inputs);
if (ret->input_count) {
ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count);
if (!ret->input_pads)
goto err;
memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count);
ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count);
if (!ret->inputs)
goto err;
}
ret->output_count = pad_count(filter->outputs);
if (ret->output_count) {
ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count);
if (!ret->output_pads)
goto err;
memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count);
ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);
if (!ret->outputs)
goto err;
}
*filter_ctx = ret;
return 0;
err:
av_freep(&ret->inputs);
av_freep(&ret->input_pads);
ret->input_count = 0;
av_freep(&ret->outputs);
av_freep(&ret->output_pads);
ret->output_count = 0;
av_freep(&ret->priv);
av_free(ret);
return AVERROR(ENOMEM);
}
void avfilter_free(AVFilterContext *filter)
......
......@@ -299,7 +299,8 @@ OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \
flacenc_header.o avlanguage.o
OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o
OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o
OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv.o asf.o asfdec.o mpegts.o riff.o
OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv.o asfdec.o asf.o asfcrypt.o \
avlanguage.o mpegts.o isom.o riff.o
OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o
OBJS-$(CONFIG_XA_DEMUXER) += xa.o
OBJS-$(CONFIG_XWMA_DEMUXER) += xwma.o riff.o
......
......@@ -845,11 +845,21 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
if (asf->packet_flags & 0x01) {
DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal
if(asf->packet_frag_size > asf->packet_size_left - rsize){
av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid\n");
return -1;
if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) {
av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, rsize);
return -1;
} else {
int diff = asf->packet_frag_size - (asf->packet_size_left - rsize);
asf->packet_size_left += diff;
asf->packet_padsize -= diff;
}
}
//printf("Fragsize %d\n", asf->packet_frag_size);
} else {
if (rsize > asf->packet_size_left) {
av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n");
return -1;
}
asf->packet_frag_size = asf->packet_size_left - rsize;
//printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize);
}
......
......@@ -51,6 +51,19 @@ static int file_get_handle(URLContext *h)
return (intptr_t) h->priv_data;
}
static int file_check(URLContext *h, int mask)
{
struct stat st;
int ret = stat(h->filename, &st);
if (ret < 0)
return AVERROR(errno);
ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0;
ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
return ret;
}
#if CONFIG_FILE_PROTOCOL
static int file_open(URLContext *h, const char *filename, int flags)
......@@ -95,19 +108,6 @@ static int file_close(URLContext *h)
return close(fd);
}
static int file_check(URLContext *h, int mask)
{
struct stat st;
int ret = stat(h->filename, &st);
if (ret < 0)
return AVERROR(errno);
ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0;
ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
return ret;
}
URLProtocol ff_file_protocol = {
.name = "file",
.url_open = file_open,
......
......@@ -403,8 +403,6 @@ static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks)
}
end_ebml_master(pb, cues_element);
av_free(cues->entries);
av_free(cues);
return currentpos;
}
......@@ -1164,6 +1162,8 @@ static int mkv_write_trailer(AVFormatContext *s)
end_ebml_master(pb, mkv->segment);
av_free(mkv->tracks);
av_freep(&mkv->cues->entries);
av_freep(&mkv->cues);
av_destruct_packet(&mkv->cur_audio_pkt);
avio_flush(pb);
return 0;
......
......@@ -829,7 +829,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
memset(compressor_name,0,32);
/* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
strncpy(compressor_name,track->enc->codec->name,31);
av_strlcpy(compressor_name,track->enc->codec->name,32);
avio_w8(pb, strlen(compressor_name));
avio_write(pb, compressor_name, 31);
......
......@@ -24,6 +24,7 @@
#include "id3v1.h"
#include "id3v2.h"
#include "rawenc.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
......@@ -32,7 +33,7 @@ static int id3v1_set_string(AVFormatContext *s, const char *key,
{
AVMetadataTag *tag;
if ((tag = av_metadata_get(s->metadata, key, NULL, 0)))
strncpy(buf, tag->value, buf_size);
av_strlcpy(buf, tag->value, buf_size);
return !!tag;
}
......
......@@ -589,6 +589,12 @@ static int write_header(AVFormatContext *s){
nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters);
nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams +
s->nb_chapters));
if (!nut->stream || (s->nb_chapters && !nut->chapter) || !nut->time_base) {
av_freep(&nut->stream);
av_freep(&nut->chapter);
av_freep(&nut->time_base);
return AVERROR(ENOMEM);
}
for(i=0; i<s->nb_streams; i++){
AVStream *st= s->streams[i];
......
......@@ -86,6 +86,7 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
//#define DEBUG_BRIGHTNESS
#include "postprocess.h"
#include "postprocess_internal.h"
#include "libavutil/avstring.h"
unsigned postproc_version(void)
{
......@@ -766,7 +767,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
ppMode->maxClippedThreshold= 0.01;
ppMode->error=0;
strncpy(temp, name, GET_MODE_BUFFER_SIZE);
av_strlcpy(temp, name, GET_MODE_BUFFER_SIZE);
av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name);
......
0, 0, 38016, 0xf4715db5
0, 3600, 38016, 0xf4715db5
0, 7200, 38016, 0xf4715db5
0, 10800, 38016, 0xf46af0e1
0, 14400, 38016, 0x9c1c2cf1
0, 18000, 38016, 0xff12d87f
0, 21600, 38016, 0x7408432b
0, 25200, 38016, 0x7408432b
0, 28800, 38016, 0x8d11479a
0, 32400, 38016, 0x8d11479a
0, 36000, 38016, 0xc4a121ab
0, 39600, 38016, 0xc4a121ab
0, 43200, 38016, 0xc4a121ab
0, 46800, 38016, 0xc4a121ab
0, 50400, 38016, 0xc4a121ab
0, 0, 38016, 0xa6f15db5
0, 3600, 38016, 0xa6f15db5
0, 7200, 38016, 0xa6f15db5
0, 10800, 38016, 0x5c4ef0e7
0, 14400, 38016, 0x53a42d1d
0, 18000, 38016, 0x68f7d89e
0, 21600, 38016, 0xc15f4368
0, 25200, 38016, 0xc15f4368
0, 28800, 38016, 0xd1bd47a8
0, 32400, 38016, 0xd1bd47a8
0, 36000, 38016, 0xe1e821ca
0, 39600, 38016, 0xe1e821ca
0, 43200, 38016, 0xe1e821ca
0, 46800, 38016, 0xe1e821ca
0, 50400, 38016, 0xe1e821ca
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