Skip to content

Commit

Permalink
FFmpeg resync to SHA1:f218121a4d79f9aab45526f3d1655ec2cc8de0d1
Browse files Browse the repository at this point in the history
  • Loading branch information
jyavenard committed Jun 1, 2012
1 parent cc72081 commit ed69ea8
Show file tree
Hide file tree
Showing 34 changed files with 465 additions and 179 deletions.
4 changes: 2 additions & 2 deletions mythtv/configure
Expand Up @@ -2017,9 +2017,9 @@ avformat_deps="avcodec"
postproc_deps="gpl"

# programs
ffmpeg_deps="avcodec avfilter avformat swscale swresample
ffmpeg_deps="avcodec avfilter avformat swscale swresample"
ffmpeg_select="buffersink_filter format_filter aformat_filter
setpts_filter"
ffmpeg_select="buffersink_filter format_filter aformat_filter"
ffplay_deps="avcodec avformat swscale swresample sdl"
ffplay_select="buffersink_filter rdft"
ffprobe_deps="avcodec avformat"
Expand Down
1 change: 1 addition & 0 deletions mythtv/external/FFmpeg/README.sync
Expand Up @@ -3,6 +3,7 @@ This code was resynced upstream to:
git://source.ffmpeg.org/ffmpeg.git at SHA1 d3db8988d on March 31, 2012 (Beirdo)
git://source.ffmpeg.org/ffmpeg.git at SHA1 ea5dab58e on May 23, 2012 (jya)
git://source.ffmpeg.org/ffmpeg.git at SHA1 cc4d80c on June 1st, 2012 (jya)
git://source.ffmpeg.org/ffmpeg.git at SHA1 f218121 on June 1st, 2012 (jya)

List of files modified from original FFmpeg:
Makefile
Expand Down
6 changes: 3 additions & 3 deletions mythtv/external/FFmpeg/configure
Expand Up @@ -1709,9 +1709,9 @@ avformat_deps="avcodec"
postproc_deps="gpl"

# programs
ffmpeg_deps="avcodec avfilter avformat swscale swresample
setpts_filter"
ffmpeg_select="buffersink_filter format_filter aformat_filter"
ffmpeg_deps="avcodec avfilter avformat swscale swresample"
ffmpeg_select="buffersink_filter format_filter aformat_filter
setpts_filter"
ffplay_deps="avcodec avformat swscale swresample sdl"
ffplay_select="buffersink_filter rdft"
ffprobe_deps="avcodec avformat"
Expand Down
1 change: 1 addition & 0 deletions mythtv/external/FFmpeg/ffmpeg.c
Expand Up @@ -1499,6 +1499,7 @@ void av_noreturn exit_program(int ret)
output_streams[i]->bitstream_filters = NULL;

av_freep(&output_streams[i]->filtered_frame);
av_freep(&output_streams[i]->avfilter);
av_freep(&output_streams[i]);
}
for (i = 0; i < nb_input_files; i++) {
Expand Down
2 changes: 1 addition & 1 deletion mythtv/external/FFmpeg/libavcodec/8svx.c
Expand Up @@ -47,7 +47,7 @@ typedef struct EightSvxContext {
/* buffer used to store the whole audio decoded/interleaved chunk,
* which is sent with the first packet */
uint8_t *samples;
size_t samples_size;
int64_t samples_size;
int samples_idx;
} EightSvxContext;

Expand Down
16 changes: 8 additions & 8 deletions mythtv/external/FFmpeg/libavcodec/dnxhdenc.c
Expand Up @@ -127,7 +127,7 @@ static int dnxhd_init_vlc(DNXHDEncContext *ctx)
if (ctx->cid_table->ac_level[j] >> 1 == alevel &&
(!offset || (ctx->cid_table->ac_flags[j] & 1) && offset) &&
(!run || (ctx->cid_table->ac_flags[j] & 2) && run)) {
assert(!ctx->vlc_codes[index]);
av_assert1(!ctx->vlc_codes[index]);
if (alevel) {
ctx->vlc_codes[index] = (ctx->cid_table->ac_codes[j]<<1)|(sign&1);
ctx->vlc_bits [index] = ctx->cid_table->ac_bits[j]+1;
Expand All @@ -138,7 +138,7 @@ static int dnxhd_init_vlc(DNXHDEncContext *ctx)
break;
}
}
assert(!alevel || j < 257);
av_assert0(!alevel || j < 257);
if (offset) {
ctx->vlc_codes[index] = (ctx->vlc_codes[index]<<ctx->cid_table->index_bits)|offset;
ctx->vlc_bits [index]+= ctx->cid_table->index_bits;
Expand All @@ -147,7 +147,7 @@ static int dnxhd_init_vlc(DNXHDEncContext *ctx)
}
for (i = 0; i < 62; i++) {
int run = ctx->cid_table->run[i];
assert(run < 63);
av_assert0(run < 63);
ctx->run_codes[run] = ctx->cid_table->run_codes[i];
ctx->run_bits [run] = ctx->cid_table->run_bits[i];
}
Expand Down Expand Up @@ -542,7 +542,7 @@ static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, int jobnr, i
if (diff < 0) nbits = av_log2_16bit(-2*diff);
else nbits = av_log2_16bit( 2*diff);

assert(nbits < ctx->cid_table->bit_depth + 4);
av_assert1(nbits < ctx->cid_table->bit_depth + 4);
dc_bits += ctx->cid_table->dc_bits[nbits] + nbits;

ctx->m.last_dc[n] = block[0];
Expand Down Expand Up @@ -810,13 +810,13 @@ static void radix_count(const RCCMPEntry *data, int size, int buckets[RADIX_PASS
buckets[j][get_bucket(v, 0)]++;
v >>= BUCKET_BITS;
}
assert(!v);
av_assert1(!v);
}
for (j = 0; j < RADIX_PASSES; j++) {
int offset = size;
for (i = NBUCKETS - 1; i >= 0; i--)
buckets[j][i] = offset -= buckets[j][i];
assert(!buckets[j][0]);
av_assert1(!buckets[j][0]);
}
}

Expand Down Expand Up @@ -941,12 +941,12 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
for (i = 0; i < ctx->m.mb_height; i++) {
AV_WB32(ctx->msip + i * 4, offset);
offset += ctx->slice_size[i];
assert(!(ctx->slice_size[i] & 3));
av_assert1(!(ctx->slice_size[i] & 3));
}

avctx->execute2(avctx, dnxhd_encode_thread, buf, NULL, ctx->m.mb_height);

assert(640 + offset + 4 <= ctx->cid_table->coding_unit_size);
av_assert1(640 + offset + 4 <= ctx->cid_table->coding_unit_size);
memset(buf + 640 + offset, 0, ctx->cid_table->coding_unit_size - 4 - offset - 640);

AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF
Expand Down
5 changes: 5 additions & 0 deletions mythtv/external/FFmpeg/libavcodec/gif.c
Expand Up @@ -145,6 +145,11 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
{
GIFContext *s = avctx->priv_data;

if (avctx->width > 65535 || avctx->height > 65535) {
av_log(avctx, AV_LOG_ERROR, "GIF does not support resolutions above 65535x65535\n");
return -1;
}

avctx->coded_frame = &s->picture;
s->lzw = av_mallocz(ff_lzw_encode_state_size);
if (!s->lzw)
Expand Down
27 changes: 15 additions & 12 deletions mythtv/external/FFmpeg/libavcodec/h264.c
Expand Up @@ -2719,19 +2719,19 @@ static void init_scan_tables(H264Context *h)
#undef T
}
if (h->sps.transform_bypass) { // FIXME same ugly
h->zigzag_scan_q0 = zigzag_scan;
h->zigzag_scan8x8_q0 = ff_zigzag_direct;
h->zigzag_scan8x8_cavlc_q0 = zigzag_scan8x8_cavlc;
h->field_scan_q0 = field_scan;
h->field_scan8x8_q0 = field_scan8x8;
h->field_scan8x8_cavlc_q0 = field_scan8x8_cavlc;
memcpy(h->zigzag_scan_q0 , zigzag_scan , sizeof(h->zigzag_scan_q0 ));
memcpy(h->zigzag_scan8x8_q0 , ff_zigzag_direct , sizeof(h->zigzag_scan8x8_q0 ));
memcpy(h->zigzag_scan8x8_cavlc_q0 , zigzag_scan8x8_cavlc , sizeof(h->zigzag_scan8x8_cavlc_q0));
memcpy(h->field_scan_q0 , field_scan , sizeof(h->field_scan_q0 ));
memcpy(h->field_scan8x8_q0 , field_scan8x8 , sizeof(h->field_scan8x8_q0 ));
memcpy(h->field_scan8x8_cavlc_q0 , field_scan8x8_cavlc , sizeof(h->field_scan8x8_cavlc_q0 ));
} else {
h->zigzag_scan_q0 = h->zigzag_scan;
h->zigzag_scan8x8_q0 = h->zigzag_scan8x8;
h->zigzag_scan8x8_cavlc_q0 = h->zigzag_scan8x8_cavlc;
h->field_scan_q0 = h->field_scan;
h->field_scan8x8_q0 = h->field_scan8x8;
h->field_scan8x8_cavlc_q0 = h->field_scan8x8_cavlc;
memcpy(h->zigzag_scan_q0 , h->zigzag_scan , sizeof(h->zigzag_scan_q0 ));
memcpy(h->zigzag_scan8x8_q0 , h->zigzag_scan8x8 , sizeof(h->zigzag_scan8x8_q0 ));
memcpy(h->zigzag_scan8x8_cavlc_q0 , h->zigzag_scan8x8_cavlc , sizeof(h->zigzag_scan8x8_cavlc_q0));
memcpy(h->field_scan_q0 , h->field_scan , sizeof(h->field_scan_q0 ));
memcpy(h->field_scan8x8_q0 , h->field_scan8x8 , sizeof(h->field_scan8x8_q0 ));
memcpy(h->field_scan8x8_cavlc_q0 , h->field_scan8x8_cavlc , sizeof(h->field_scan8x8_cavlc_q0 ));
}
}

Expand Down Expand Up @@ -4399,6 +4399,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
init_get_bits(&hx->inter_gb, ptr, bit_length);
hx->inter_gb_ptr = &hx->inter_gb;

av_log(h->s.avctx, AV_LOG_ERROR, "Partitioned H.264 support is incomplete\n");
return AVERROR_PATCHWELCOME;

if (hx->redundant_pic_count == 0 &&
hx->intra_gb_ptr &&
hx->s.data_partitioning &&
Expand Down
12 changes: 6 additions & 6 deletions mythtv/external/FFmpeg/libavcodec/h264.h
Expand Up @@ -421,12 +421,12 @@ typedef struct H264Context {
uint8_t field_scan[16];
uint8_t field_scan8x8[64];
uint8_t field_scan8x8_cavlc[64];
const uint8_t *zigzag_scan_q0;
const uint8_t *zigzag_scan8x8_q0;
const uint8_t *zigzag_scan8x8_cavlc_q0;
const uint8_t *field_scan_q0;
const uint8_t *field_scan8x8_q0;
const uint8_t *field_scan8x8_cavlc_q0;
uint8_t zigzag_scan_q0[16];
uint8_t zigzag_scan8x8_q0[64];
uint8_t zigzag_scan8x8_cavlc_q0[64];
uint8_t field_scan_q0[16];
uint8_t field_scan8x8_q0[64];
uint8_t field_scan8x8_cavlc_q0[64];

int x264_build;

Expand Down
5 changes: 0 additions & 5 deletions mythtv/external/FFmpeg/libavcodec/h264data.h
Expand Up @@ -57,15 +57,13 @@ static const uint8_t zigzag_scan[16+1] = {
1 + 1 * 4, 2 + 0 * 4, 3 + 0 * 4, 2 + 1 * 4,
1 + 2 * 4, 0 + 3 * 4, 1 + 3 * 4, 2 + 2 * 4,
3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4,
0,
};

static const uint8_t field_scan[16+1] = {
0 + 0 * 4, 0 + 1 * 4, 1 + 0 * 4, 0 + 2 * 4,
0 + 3 * 4, 1 + 1 * 4, 1 + 2 * 4, 1 + 3 * 4,
2 + 0 * 4, 2 + 1 * 4, 2 + 2 * 4, 2 + 3 * 4,
3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4, 3 + 3 * 4,
0,
};

static const uint8_t luma_dc_zigzag_scan[16] = {
Expand Down Expand Up @@ -112,7 +110,6 @@ static const uint8_t zigzag_scan8x8_cavlc[64+1] = {
1 + 4 * 8, 2 + 4 * 8, 6 + 0 * 8, 4 + 3 * 8,
0 + 7 * 8, 4 + 4 * 8, 7 + 2 * 8, 3 + 6 * 8,
5 + 5 * 8, 6 + 5 * 8, 6 + 6 * 8, 7 + 7 * 8,
0,
};

static const uint8_t field_scan8x8[64+1] = {
Expand All @@ -132,7 +129,6 @@ static const uint8_t field_scan8x8[64+1] = {
7 + 0 * 8, 7 + 1 * 8, 6 + 4 * 8, 6 + 5 * 8,
6 + 6 * 8, 6 + 7 * 8, 7 + 2 * 8, 7 + 3 * 8,
7 + 4 * 8, 7 + 5 * 8, 7 + 6 * 8, 7 + 7 * 8,
0,
};

static const uint8_t field_scan8x8_cavlc[64+1] = {
Expand All @@ -152,7 +148,6 @@ static const uint8_t field_scan8x8_cavlc[64+1] = {
1 + 7 * 8, 3 + 2 * 8, 2 + 7 * 8, 4 + 2 * 8,
3 + 7 * 8, 5 + 2 * 8, 4 + 7 * 8, 5 + 4 * 8,
6 + 3 * 8, 6 + 5 * 8, 7 + 3 * 8, 7 + 7 * 8,
0,
};

typedef struct IMbInfo {
Expand Down
3 changes: 2 additions & 1 deletion mythtv/external/FFmpeg/libavcodec/libmp3lame.c
Expand Up @@ -304,7 +304,8 @@ AVCodec ff_libmp3lame_encoder = {
AV_SAMPLE_FMT_NONE },
.supported_samplerates = libmp3lame_sample_rates,
.channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO },
AV_CH_LAYOUT_STEREO,
0},
.long_name = NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"),
.priv_class = &libmp3lame_class,
.defaults = libmp3lame_defaults,
Expand Down
5 changes: 5 additions & 0 deletions mythtv/external/FFmpeg/libavcodec/mjpegenc.c
Expand Up @@ -48,6 +48,11 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
{
MJpegContext *m;

if (s->width > 65500 || s->height > 65500) {
av_log(s, AV_LOG_ERROR, "JPEG does not support resolutions above 65500x65500\n");
return -1;
}

m = av_malloc(sizeof(MJpegContext));
if (!m)
return -1;
Expand Down
4 changes: 4 additions & 0 deletions mythtv/external/FFmpeg/libavcodec/mpeg4videodec.c
Expand Up @@ -2055,6 +2055,10 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
if(s->pict_type == AV_PICTURE_TYPE_B)
skip_bits_long(gb, s->cplx_estimation_trash_b);

if(get_bits_left(gb) < 3) {
av_log(s->avctx, AV_LOG_ERROR, "Header truncated\n");
return -1;
}
s->intra_dc_threshold= ff_mpeg4_dc_threshold[ get_bits(gb, 3) ];
if(!s->progressive_sequence){
s->top_field_first= get_bits1(gb);
Expand Down
3 changes: 2 additions & 1 deletion mythtv/external/FFmpeg/libavcodec/qdm2.c
Expand Up @@ -1363,7 +1363,8 @@ static void qdm2_fft_decode_tones (QDM2Context *q, int duration, GetBitContext *
if (q->superblocktype_2_3) {
while ((n = qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2)) < 2) {
if (get_bits_left(gb)<0) {
av_log(0, AV_LOG_ERROR, "overread in qdm2_fft_decode_tones()\n");
if(local_int_4 < q->group_size)
av_log(0, AV_LOG_ERROR, "overread in qdm2_fft_decode_tones()\n");
return;
}
offset = 1;
Expand Down
5 changes: 5 additions & 0 deletions mythtv/external/FFmpeg/libavcodec/sgienc.c
Expand Up @@ -36,6 +36,11 @@ static av_cold int encode_init(AVCodecContext *avctx)
{
SgiContext *s = avctx->priv_data;

if (avctx->width > 65535 || avctx->height > 65535) {
av_log(avctx, AV_LOG_ERROR, "SGI does not support resolutions above 65535x65535\n");
return -1;
}

avcodec_get_frame_defaults(&s->picture);
avctx->coded_frame = &s->picture;

Expand Down
38 changes: 20 additions & 18 deletions mythtv/external/FFmpeg/libavcodec/vp8.c
Expand Up @@ -708,56 +708,58 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
* @return 0 if no coeffs were decoded
* otherwise, the index of the last coeff decoded plus one
*/
static int decode_block_coeffs_internal(VP56RangeCoder *c, DCTELEM block[16],
static int decode_block_coeffs_internal(VP56RangeCoder *r, DCTELEM block[16],
uint8_t probs[16][3][NUM_DCT_TOKENS-1],
int i, uint8_t *token_prob, int16_t qmul[2])
{
VP56RangeCoder c = *r;
goto skip_eob;
do {
int coeff;
if (!vp56_rac_get_prob_branchy(c, token_prob[0])) // DCT_EOB
return i;
if (!vp56_rac_get_prob_branchy(&c, token_prob[0])) // DCT_EOB
break;

skip_eob:
if (!vp56_rac_get_prob_branchy(c, token_prob[1])) { // DCT_0
if (!vp56_rac_get_prob_branchy(&c, token_prob[1])) { // DCT_0
if (++i == 16)
return i; // invalid input; blocks should end with EOB
break; // invalid input; blocks should end with EOB
token_prob = probs[i][0];
goto skip_eob;
}

if (!vp56_rac_get_prob_branchy(c, token_prob[2])) { // DCT_1
if (!vp56_rac_get_prob_branchy(&c, token_prob[2])) { // DCT_1
coeff = 1;
token_prob = probs[i+1][1];
} else {
if (!vp56_rac_get_prob_branchy(c, token_prob[3])) { // DCT 2,3,4
coeff = vp56_rac_get_prob_branchy(c, token_prob[4]);
if (!vp56_rac_get_prob_branchy(&c, token_prob[3])) { // DCT 2,3,4
coeff = vp56_rac_get_prob_branchy(&c, token_prob[4]);
if (coeff)
coeff += vp56_rac_get_prob(c, token_prob[5]);
coeff += vp56_rac_get_prob(&c, token_prob[5]);
coeff += 2;
} else {
// DCT_CAT*
if (!vp56_rac_get_prob_branchy(c, token_prob[6])) {
if (!vp56_rac_get_prob_branchy(c, token_prob[7])) { // DCT_CAT1
coeff = 5 + vp56_rac_get_prob(c, vp8_dct_cat1_prob[0]);
if (!vp56_rac_get_prob_branchy(&c, token_prob[6])) {
if (!vp56_rac_get_prob_branchy(&c, token_prob[7])) { // DCT_CAT1
coeff = 5 + vp56_rac_get_prob(&c, vp8_dct_cat1_prob[0]);
} else { // DCT_CAT2
coeff = 7;
coeff += vp56_rac_get_prob(c, vp8_dct_cat2_prob[0]) << 1;
coeff += vp56_rac_get_prob(c, vp8_dct_cat2_prob[1]);
coeff += vp56_rac_get_prob(&c, vp8_dct_cat2_prob[0]) << 1;
coeff += vp56_rac_get_prob(&c, vp8_dct_cat2_prob[1]);
}
} else { // DCT_CAT3 and up
int a = vp56_rac_get_prob(c, token_prob[8]);
int b = vp56_rac_get_prob(c, token_prob[9+a]);
int a = vp56_rac_get_prob(&c, token_prob[8]);
int b = vp56_rac_get_prob(&c, token_prob[9+a]);
int cat = (a<<1) + b;
coeff = 3 + (8<<cat);
coeff += vp8_rac_get_coeff(c, ff_vp8_dct_cat_prob[cat]);
coeff += vp8_rac_get_coeff(&c, ff_vp8_dct_cat_prob[cat]);
}
}
token_prob = probs[i+1][2];
}
block[zigzag_scan[i]] = (vp8_rac_get(c) ? -coeff : coeff) * qmul[!!i];
block[zigzag_scan[i]] = (vp8_rac_get(&c) ? -coeff : coeff) * qmul[!!i];
} while (++i < 16);

*r = c;
return i;
}
#endif
Expand Down
19 changes: 12 additions & 7 deletions mythtv/external/FFmpeg/libavfilter/af_amix.c
Expand Up @@ -389,6 +389,10 @@ static int request_frame(AVFilterLink *outlink)
int ret;
int wanted_samples, available_samples;

ret = calc_active_inputs(s);
if (ret < 0)
return ret;

if (s->input_state[0] == INPUT_OFF) {
ret = request_samples(ctx, 1);
if (ret < 0)
Expand Down Expand Up @@ -419,15 +423,16 @@ static int request_frame(AVFilterLink *outlink)
av_assert0(s->frame_list->nb_frames > 0);

wanted_samples = frame_list_next_frame_size(s->frame_list);
ret = request_samples(ctx, wanted_samples);
if (ret < 0)
return ret;

ret = calc_active_inputs(s);
if (ret < 0)
return ret;

if (s->active_inputs > 1) {
ret = request_samples(ctx, wanted_samples);
if (ret < 0)
return ret;

ret = calc_active_inputs(s);
if (ret < 0)
return ret;

available_samples = get_available_samples(s);
if (!available_samples)
return 0;
Expand Down

0 comments on commit ed69ea8

Please sign in to comment.