Compare commits
79 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b44506c393 | ||
![]() |
9395a3a96b | ||
![]() |
25d2a4dde7 | ||
![]() |
bfee1e9072 | ||
![]() |
0db579445f | ||
![]() |
e3275571c7 | ||
![]() |
7b7d12ea04 | ||
![]() |
e26fd791ef | ||
![]() |
ad98b2891c | ||
![]() |
1ec6a3c768 | ||
![]() |
5c791b1c9c | ||
![]() |
4a03c31728 | ||
![]() |
c3c8857263 | ||
![]() |
4fbdac00e9 | ||
![]() |
0f4c149730 | ||
![]() |
d887a12145 | ||
![]() |
f2fba07494 | ||
![]() |
1ebd7d2ccf | ||
![]() |
5f7e48a113 | ||
![]() |
e2e0c5b7f6 | ||
![]() |
279003eb9e | ||
![]() |
5926bea980 | ||
![]() |
cbfd6b1fa4 | ||
![]() |
fdc8f4e5b4 | ||
![]() |
603f4ecd14 | ||
![]() |
1ac4ae2a32 | ||
![]() |
3998071039 | ||
![]() |
6fb9bfb1a3 | ||
![]() |
693faadd30 | ||
![]() |
9806028fbb | ||
![]() |
433e15bb87 | ||
![]() |
c3af801c63 | ||
![]() |
01817d508b | ||
![]() |
b5ef1eee45 | ||
![]() |
e2c5f88237 | ||
![]() |
d005e2ecce | ||
![]() |
57bdb3f3dd | ||
![]() |
5e34dded10 | ||
![]() |
45ca270ec9 | ||
![]() |
ca2ccd85d7 | ||
![]() |
437f6fb488 | ||
![]() |
f913da3e15 | ||
![]() |
ed9c6529f0 | ||
![]() |
aa40bbb492 | ||
![]() |
8e276fc96a | ||
![]() |
4a4e30a6d8 | ||
![]() |
1c733a440a | ||
![]() |
5c3bc127ca | ||
![]() |
be94d15a03 | ||
![]() |
9c57328b81 | ||
![]() |
6952f6f39b | ||
![]() |
6359be6751 | ||
![]() |
beb55b3981 | ||
![]() |
80aec733ad | ||
![]() |
77bb6b5bcc | ||
![]() |
f68395f7fc | ||
![]() |
eefb6b654d | ||
![]() |
d18d48def6 | ||
![]() |
8df77c3758 | ||
![]() |
08f56b846c | ||
![]() |
f903147f2d | ||
![]() |
9a840d5e17 | ||
![]() |
9e43d92d6a | ||
![]() |
e13e928baa | ||
![]() |
d3bfb66a66 | ||
![]() |
17a6ca7d31 | ||
![]() |
8a20224059 | ||
![]() |
29ee8b72c4 | ||
![]() |
25864cf562 | ||
![]() |
f74206cb40 | ||
![]() |
148d9cd122 | ||
![]() |
bc259185cb | ||
![]() |
3b6bde3b3d | ||
![]() |
4f187f0af1 | ||
![]() |
10c2d22ba1 | ||
![]() |
35738e5898 | ||
![]() |
59d98fc050 | ||
![]() |
60bfa9154d | ||
![]() |
9794727ccd |
@@ -1,6 +1,12 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 2.3.3:
|
||||
- h264: fix grayscale only decoding with weighted prediction
|
||||
- mjpegdec: support AV_PIX_FMT_YUV420P16 with upscale_h
|
||||
- proresenc_ks: fix buffer overflow
|
||||
- matroskadec: fix crash
|
||||
|
||||
version 2.3.2:
|
||||
- snow: fix null pointer dereference
|
||||
- huffyucdec: fix overread
|
||||
|
1
configure
vendored
1
configure
vendored
@@ -4528,6 +4528,7 @@ EOF
|
||||
fi
|
||||
|
||||
check_ldflags -Wl,--as-needed
|
||||
check_ldflags -Wl,-z,noexecstack
|
||||
|
||||
if check_func dlopen; then
|
||||
ldl=
|
||||
|
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 2.3.2
|
||||
PROJECT_NUMBER = 2.3.5
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
@@ -491,7 +491,7 @@ aeval=val(ch)/2:c=same
|
||||
@item
|
||||
Invert phase of the second channel:
|
||||
@example
|
||||
eval=val(0)|-val(1)
|
||||
aeval=val(0)|-val(1)
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@@ -9318,7 +9318,7 @@ Default value is "all", which will cycle through the list of all tests.
|
||||
|
||||
Some examples:
|
||||
@example
|
||||
testsrc=t=dc_luma
|
||||
mptestsrc=t=dc_luma
|
||||
@end example
|
||||
|
||||
will generate a "dc_luma" test pattern.
|
||||
|
11
ffmpeg.c
11
ffmpeg.c
@@ -1799,18 +1799,10 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
|
||||
for (i = 0; i < nb_filtergraphs; i++)
|
||||
if (ist_in_filtergraph(filtergraphs[i], ist)) {
|
||||
FilterGraph *fg = filtergraphs[i];
|
||||
int j;
|
||||
if (configure_filtergraph(fg) < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n");
|
||||
exit_program(1);
|
||||
}
|
||||
for (j = 0; j < fg->nb_outputs; j++) {
|
||||
OutputStream *ost = fg->outputs[j]->ost;
|
||||
if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
|
||||
!(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
|
||||
av_buffersink_set_frame_size(ost->filter->filter,
|
||||
ost->enc_ctx->frame_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3419,7 +3411,7 @@ static int process_input(int file_index)
|
||||
}
|
||||
|
||||
/* add the stream-global side data to the first packet */
|
||||
if (ist->nb_packets == 1)
|
||||
if (ist->nb_packets == 1) {
|
||||
if (ist->st->nb_side_data)
|
||||
av_packet_split_side_data(&pkt);
|
||||
for (i = 0; i < ist->st->nb_side_data; i++) {
|
||||
@@ -3435,6 +3427,7 @@ static int process_input(int file_index)
|
||||
|
||||
memcpy(dst_data, src_sd->data, src_sd->size);
|
||||
}
|
||||
}
|
||||
|
||||
if (pkt.dts != AV_NOPTS_VALUE)
|
||||
pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
|
||||
|
@@ -919,6 +919,16 @@ int configure_filtergraph(FilterGraph *fg)
|
||||
}
|
||||
|
||||
fg->reconfiguration = 1;
|
||||
|
||||
for (i = 0; i < fg->nb_outputs; i++) {
|
||||
OutputStream *ost = fg->outputs[i]->ost;
|
||||
if (ost &&
|
||||
ost->enc->type == AVMEDIA_TYPE_AUDIO &&
|
||||
!(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
|
||||
av_buffersink_set_frame_size(ost->filter->filter,
|
||||
ost->enc_ctx->frame_size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
|
||||
int size;
|
||||
union {
|
||||
uint64_t u64;
|
||||
uint8_t u8[8];
|
||||
uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
|
||||
} tmp;
|
||||
|
||||
tmp.u64 = av_be2ne64(state);
|
||||
|
@@ -166,7 +166,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
|
||||
int err;
|
||||
union {
|
||||
uint64_t u64;
|
||||
uint8_t u8[8];
|
||||
uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
|
||||
} tmp = { av_be2ne64(state) };
|
||||
AC3HeaderInfo hdr, *phdr = &hdr;
|
||||
GetBitContext gbc;
|
||||
|
@@ -263,7 +263,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
|
||||
energy_cpl = energy[blk][CPL_CH][bnd];
|
||||
energy_ch = energy[blk][ch][bnd];
|
||||
blk1 = blk+1;
|
||||
while (!s->blocks[blk1].new_cpl_coords[ch] && blk1 < s->num_blocks) {
|
||||
while (blk1 < s->num_blocks && !s->blocks[blk1].new_cpl_coords[ch]) {
|
||||
if (s->blocks[blk1].cpl_in_use) {
|
||||
energy_cpl += energy[blk1][CPL_CH][bnd];
|
||||
energy_ch += energy[blk1][ch][bnd];
|
||||
|
@@ -32,6 +32,10 @@
|
||||
#include "cabac.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifndef UNCHECKED_BITSTREAM_READER
|
||||
#define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER
|
||||
#endif
|
||||
|
||||
#if ARCH_AARCH64
|
||||
# include "aarch64/cabac.h"
|
||||
#endif
|
||||
|
@@ -135,7 +135,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip,
|
||||
const uint8_t *eod = (data + size);
|
||||
uint32_t flag, mask;
|
||||
uint8_t *cb0, *cb1, *cb2, *cb3;
|
||||
unsigned int x, y;
|
||||
int x, y;
|
||||
char *ip0, *ip1, *ip2, *ip3;
|
||||
|
||||
flag = 0;
|
||||
|
@@ -1215,8 +1215,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
||||
|
||||
q->num_subpackets++;
|
||||
s++;
|
||||
if (s > MAX_SUBPACKETS) {
|
||||
avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS);
|
||||
if (s > FFMIN(MAX_SUBPACKETS, avctx->block_align)) {
|
||||
avpriv_request_sample(avctx, "subpackets > %d", FFMIN(MAX_SUBPACKETS, avctx->block_align));
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
}
|
||||
|
@@ -171,6 +171,10 @@ static inline int dirac_get_arith_uint(DiracArith *c, int follow_ctx, int data_c
|
||||
{
|
||||
int ret = 1;
|
||||
while (!dirac_get_arith_bit(c, follow_ctx)) {
|
||||
if (ret >= 0x40000000) {
|
||||
av_log(NULL, AV_LOG_ERROR, "dirac_get_arith_uint overflow\n");
|
||||
return -1;
|
||||
}
|
||||
ret <<= 1;
|
||||
ret += dirac_get_arith_bit(c, data_ctx);
|
||||
follow_ctx = ff_dirac_next_ctx[follow_ctx];
|
||||
|
@@ -611,10 +611,10 @@ static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b
|
||||
|
||||
top = 0;
|
||||
for (cb_y = 0; cb_y < cb_height; cb_y++) {
|
||||
bottom = (b->height * (cb_y+1)) / cb_height;
|
||||
bottom = (b->height * (cb_y+1LL)) / cb_height;
|
||||
left = 0;
|
||||
for (cb_x = 0; cb_x < cb_width; cb_x++) {
|
||||
right = (b->width * (cb_x+1)) / cb_width;
|
||||
right = (b->width * (cb_x+1LL)) / cb_width;
|
||||
codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith);
|
||||
left = right;
|
||||
}
|
||||
@@ -1003,8 +1003,8 @@ static int dirac_unpack_idwt_params(DiracContext *s)
|
||||
/* Codeblock parameters (core syntax only) */
|
||||
if (get_bits1(gb)) {
|
||||
for (i = 0; i <= s->wavelet_depth; i++) {
|
||||
CHECKEDREAD(s->codeblock[i].width , tmp < 1, "codeblock width invalid\n")
|
||||
CHECKEDREAD(s->codeblock[i].height, tmp < 1, "codeblock height invalid\n")
|
||||
CHECKEDREAD(s->codeblock[i].width , tmp < 1 || tmp > (s->avctx->width >>s->wavelet_depth-i), "codeblock width invalid\n")
|
||||
CHECKEDREAD(s->codeblock[i].height, tmp < 1 || tmp > (s->avctx->height>>s->wavelet_depth-i), "codeblock height invalid\n")
|
||||
}
|
||||
|
||||
CHECKEDREAD(s->codeblock_mode, tmp > 1, "unknown codeblock mode\n")
|
||||
|
@@ -38,6 +38,7 @@ typedef struct DNXHDContext {
|
||||
BlockDSPContext bdsp;
|
||||
int64_t cid; ///< compression id
|
||||
unsigned int width, height;
|
||||
enum AVPixelFormat pix_fmt;
|
||||
unsigned int mb_width, mb_height;
|
||||
uint32_t mb_scan_index[68]; /* max for 1080p */
|
||||
int cur_field; ///< current interlaced field
|
||||
@@ -141,7 +142,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
||||
|
||||
ctx->is_444 = 0;
|
||||
if (buf[0x4] == 0x2) {
|
||||
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
|
||||
ctx->pix_fmt = AV_PIX_FMT_YUV444P10;
|
||||
ctx->avctx->bits_per_raw_sample = 10;
|
||||
if (ctx->bit_depth != 10) {
|
||||
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
|
||||
@@ -151,7 +152,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
||||
}
|
||||
ctx->is_444 = 1;
|
||||
} else if (buf[0x21] & 0x40) {
|
||||
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
|
||||
ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
|
||||
ctx->avctx->bits_per_raw_sample = 10;
|
||||
if (ctx->bit_depth != 10) {
|
||||
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
|
||||
@@ -160,7 +161,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
||||
ctx->decode_dct_block = dnxhd_decode_dct_block_10;
|
||||
}
|
||||
} else {
|
||||
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||
ctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||
ctx->avctx->bits_per_raw_sample = 8;
|
||||
if (ctx->bit_depth != 8) {
|
||||
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
|
||||
@@ -446,7 +447,13 @@ decode_coding_unit:
|
||||
avctx->width, avctx->height, ctx->width, ctx->height);
|
||||
first_field = 1;
|
||||
}
|
||||
if (avctx->pix_fmt != AV_PIX_FMT_NONE && avctx->pix_fmt != ctx->pix_fmt) {
|
||||
av_log(avctx, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",
|
||||
av_get_pix_fmt_name(avctx->pix_fmt), av_get_pix_fmt_name(ctx->pix_fmt));
|
||||
first_field = 1;
|
||||
}
|
||||
|
||||
avctx->pix_fmt = ctx->pix_fmt;
|
||||
ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@@ -329,6 +329,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
DxaDecContext * const c = avctx->priv_data;
|
||||
|
||||
if (avctx->width%4 || avctx->height%4) {
|
||||
avpriv_request_sample(avctx, "dimensions are not a multiple of 4");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
c->prev = av_frame_alloc();
|
||||
if (!c->prev)
|
||||
return AVERROR(ENOMEM);
|
||||
|
@@ -736,8 +736,10 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
c->tile_width = bytestream2_get_be32(&bc);
|
||||
c->tile_height = bytestream2_get_be32(&bc);
|
||||
if (!c->tile_width || !c->tile_height ||
|
||||
((c->tile_width | c->tile_height) & 0xF)) {
|
||||
if (c->tile_width <= 0 || c->tile_height <= 0 ||
|
||||
((c->tile_width | c->tile_height) & 0xF) ||
|
||||
c->tile_width * 4LL * c->tile_height >= INT_MAX
|
||||
) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid tile dimensions %dx%d\n",
|
||||
c->tile_width, c->tile_height);
|
||||
|
@@ -258,26 +258,21 @@ static int gif_read_image(GifState *s, AVFrame *frame)
|
||||
case 1:
|
||||
y1 += 8;
|
||||
ptr += linesize * 8;
|
||||
if (y1 >= height) {
|
||||
y1 = pass ? 2 : 4;
|
||||
ptr = ptr1 + linesize * y1;
|
||||
pass++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
y1 += 4;
|
||||
ptr += linesize * 4;
|
||||
if (y1 >= height) {
|
||||
y1 = 1;
|
||||
ptr = ptr1 + linesize;
|
||||
pass++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
y1 += 2;
|
||||
ptr += linesize * 2;
|
||||
break;
|
||||
}
|
||||
while (y1 >= height) {
|
||||
y1 = 4 >> pass;
|
||||
ptr = ptr1 + linesize * y1;
|
||||
pass++;
|
||||
}
|
||||
} else {
|
||||
ptr += linesize;
|
||||
}
|
||||
|
@@ -336,6 +336,14 @@ static int decode_slice(MpegEncContext *s)
|
||||
s->padding_bug_score += 32;
|
||||
}
|
||||
|
||||
if (s->codec_id == AV_CODEC_ID_H263 &&
|
||||
(s->workaround_bugs & FF_BUG_AUTODETECT) &&
|
||||
get_bits_left(&s->gb) >= 64 &&
|
||||
AV_RB64(s->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) {
|
||||
|
||||
s->padding_bug_score += 32;
|
||||
}
|
||||
|
||||
if (s->workaround_bugs & FF_BUG_AUTODETECT) {
|
||||
if (s->padding_bug_score > -2 && !s->data_partitioning)
|
||||
s->workaround_bugs |= FF_BUG_NO_PADDING;
|
||||
|
@@ -215,18 +215,18 @@ int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma)
|
||||
|
||||
if ((h->left_samples_available & 0x8080) != 0x8080) {
|
||||
mode = left[mode];
|
||||
if (is_chroma && (h->left_samples_available & 0x8080)) {
|
||||
// mad cow disease mode, aka MBAFF + constrained_intra_pred
|
||||
mode = ALZHEIMER_DC_L0T_PRED8x8 +
|
||||
(!(h->left_samples_available & 0x8000)) +
|
||||
2 * (mode == DC_128_PRED8x8);
|
||||
}
|
||||
if (mode < 0) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"left block unavailable for requested intra mode at %d %d\n",
|
||||
h->mb_x, h->mb_y);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (is_chroma && (h->left_samples_available & 0x8080)) {
|
||||
// mad cow disease mode, aka MBAFF + constrained_intra_pred
|
||||
mode = ALZHEIMER_DC_L0T_PRED8x8 +
|
||||
(!(h->left_samples_available & 0x8000)) +
|
||||
2 * (mode == DC_128_PRED8x8);
|
||||
}
|
||||
}
|
||||
|
||||
return mode;
|
||||
@@ -248,7 +248,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
|
||||
|
||||
#define STARTCODE_TEST \
|
||||
if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
|
||||
if (src[i + 2] != 3) { \
|
||||
if (src[i + 2] != 3 && src[i + 2] != 0) { \
|
||||
/* startcode, so we must be past the end */ \
|
||||
length = i; \
|
||||
} \
|
||||
@@ -321,7 +321,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
|
||||
if (src[si + 2] > 3) {
|
||||
dst[di++] = src[si++];
|
||||
dst[di++] = src[si++];
|
||||
} else if (src[si] == 0 && src[si + 1] == 0) {
|
||||
} else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) {
|
||||
if (src[si + 2] == 3) { // escape
|
||||
dst[di++] = 0;
|
||||
dst[di++] = 0;
|
||||
|
@@ -420,10 +420,12 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square,
|
||||
int weight1 = 64 - weight0;
|
||||
luma_weight_avg(dest_y, tmp_y, h->mb_linesize,
|
||||
height, 5, weight0, weight1, 0);
|
||||
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize,
|
||||
chroma_height, 5, weight0, weight1, 0);
|
||||
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize,
|
||||
chroma_height, 5, weight0, weight1, 0);
|
||||
if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
|
||||
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize,
|
||||
chroma_height, 5, weight0, weight1, 0);
|
||||
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize,
|
||||
chroma_height, 5, weight0, weight1, 0);
|
||||
}
|
||||
} else {
|
||||
luma_weight_avg(dest_y, tmp_y, h->mb_linesize, height,
|
||||
h->luma_log2_weight_denom,
|
||||
@@ -431,18 +433,20 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square,
|
||||
h->luma_weight[refn1][1][0],
|
||||
h->luma_weight[refn0][0][1] +
|
||||
h->luma_weight[refn1][1][1]);
|
||||
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, chroma_height,
|
||||
h->chroma_log2_weight_denom,
|
||||
h->chroma_weight[refn0][0][0][0],
|
||||
h->chroma_weight[refn1][1][0][0],
|
||||
h->chroma_weight[refn0][0][0][1] +
|
||||
h->chroma_weight[refn1][1][0][1]);
|
||||
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, chroma_height,
|
||||
h->chroma_log2_weight_denom,
|
||||
h->chroma_weight[refn0][0][1][0],
|
||||
h->chroma_weight[refn1][1][1][0],
|
||||
h->chroma_weight[refn0][0][1][1] +
|
||||
h->chroma_weight[refn1][1][1][1]);
|
||||
if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
|
||||
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, chroma_height,
|
||||
h->chroma_log2_weight_denom,
|
||||
h->chroma_weight[refn0][0][0][0],
|
||||
h->chroma_weight[refn1][1][0][0],
|
||||
h->chroma_weight[refn0][0][0][1] +
|
||||
h->chroma_weight[refn1][1][0][1]);
|
||||
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, chroma_height,
|
||||
h->chroma_log2_weight_denom,
|
||||
h->chroma_weight[refn0][0][1][0],
|
||||
h->chroma_weight[refn1][1][1][0],
|
||||
h->chroma_weight[refn0][0][1][1] +
|
||||
h->chroma_weight[refn1][1][1][1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int list = list1 ? 1 : 0;
|
||||
@@ -456,15 +460,17 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square,
|
||||
h->luma_log2_weight_denom,
|
||||
h->luma_weight[refn][list][0],
|
||||
h->luma_weight[refn][list][1]);
|
||||
if (h->use_weight_chroma) {
|
||||
chroma_weight_op(dest_cb, h->mb_uvlinesize, chroma_height,
|
||||
h->chroma_log2_weight_denom,
|
||||
h->chroma_weight[refn][list][0][0],
|
||||
h->chroma_weight[refn][list][0][1]);
|
||||
chroma_weight_op(dest_cr, h->mb_uvlinesize, chroma_height,
|
||||
h->chroma_log2_weight_denom,
|
||||
h->chroma_weight[refn][list][1][0],
|
||||
h->chroma_weight[refn][list][1][1]);
|
||||
if (!CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
|
||||
if (h->use_weight_chroma) {
|
||||
chroma_weight_op(dest_cb, h->mb_uvlinesize, chroma_height,
|
||||
h->chroma_log2_weight_denom,
|
||||
h->chroma_weight[refn][list][0][0],
|
||||
h->chroma_weight[refn][list][0][1]);
|
||||
chroma_weight_op(dest_cr, h->mb_uvlinesize, chroma_height,
|
||||
h->chroma_log2_weight_denom,
|
||||
h->chroma_weight[refn][list][1][0],
|
||||
h->chroma_weight[refn][list][1][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -978,7 +978,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0,
|
||||
for (i = 0; i < (size * size); i++) {
|
||||
coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3);
|
||||
}
|
||||
s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride);
|
||||
s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1007,7 +1007,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0,
|
||||
for (i = 0; i < (size * size); i++) {
|
||||
coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3);
|
||||
}
|
||||
s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride);
|
||||
s->hevcdsp.transform_add[log2_trafo_size_c-2](dst, coeffs, stride);
|
||||
}
|
||||
}
|
||||
} else if (blk_idx == 3) {
|
||||
|
@@ -269,6 +269,11 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s,
|
||||
x += stride;
|
||||
}
|
||||
|
||||
if (x >= w) {
|
||||
av_log(NULL, AV_LOG_ERROR, "run overflow\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* decode run termination value */
|
||||
Rb = R(last, x);
|
||||
RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
|
||||
|
@@ -96,8 +96,7 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
WebRtcIlbcfix_DecodeImpl((WebRtc_Word16*) frame->data[0],
|
||||
(const WebRtc_UWord16*) buf, &s->decoder, 1);
|
||||
WebRtcIlbcfix_DecodeImpl((int16_t *) frame->data[0], (const uint16_t *) buf, &s->decoder, 1);
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
@@ -170,7 +169,7 @@ static int ilbc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, 50)) < 0)
|
||||
return ret;
|
||||
|
||||
WebRtcIlbcfix_EncodeImpl((WebRtc_UWord16*) avpkt->data, (const WebRtc_Word16*) frame->data[0], &s->encoder);
|
||||
WebRtcIlbcfix_EncodeImpl((uint16_t *) avpkt->data, (const int16_t *) frame->data[0], &s->encoder);
|
||||
|
||||
avpkt->size = s->encoder.no_of_bytes;
|
||||
*got_packet_ptr = 1;
|
||||
|
@@ -244,7 +244,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
|
||||
|
||||
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
{
|
||||
int len, nb_components, i, width, height, pix_fmt_id, ret;
|
||||
int len, nb_components, i, width, height, bits, pix_fmt_id, ret;
|
||||
int h_count[MAX_COMPONENTS];
|
||||
int v_count[MAX_COMPONENTS];
|
||||
|
||||
@@ -254,11 +254,11 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
/* XXX: verify len field validity */
|
||||
len = get_bits(&s->gb, 16);
|
||||
s->avctx->bits_per_raw_sample =
|
||||
s->bits = get_bits(&s->gb, 8);
|
||||
bits = get_bits(&s->gb, 8);
|
||||
|
||||
if (s->pegasus_rct)
|
||||
s->bits = 9;
|
||||
if (s->bits == 9 && !s->pegasus_rct)
|
||||
bits = 9;
|
||||
if (bits == 9 && !s->pegasus_rct)
|
||||
s->rct = 1; // FIXME ugly
|
||||
|
||||
if(s->lossless && s->avctx->lowres){
|
||||
@@ -291,7 +291,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
if (s->ls && !(s->bits <= 8 || nb_components == 1)) {
|
||||
if (s->ls && !(bits <= 8 || nb_components == 1)) {
|
||||
avpriv_report_missing_feature(s->avctx,
|
||||
"JPEG-LS that is not <= 8 "
|
||||
"bits/component or 16-bit gray");
|
||||
@@ -337,11 +337,13 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
|
||||
/* if different size, realloc/alloc picture */
|
||||
if ( width != s->width || height != s->height
|
||||
|| bits != s->bits
|
||||
|| memcmp(s->h_count, h_count, sizeof(h_count))
|
||||
|| memcmp(s->v_count, v_count, sizeof(v_count))) {
|
||||
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
s->bits = bits;
|
||||
memcpy(s->h_count, h_count, sizeof(h_count));
|
||||
memcpy(s->v_count, v_count, sizeof(v_count));
|
||||
s->interlaced = 0;
|
||||
@@ -1894,6 +1896,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
int start_code;
|
||||
int i, index;
|
||||
int ret = 0;
|
||||
int is16bit;
|
||||
|
||||
av_dict_free(&s->exif_metadata);
|
||||
av_freep(&s->stereo3d);
|
||||
@@ -2072,6 +2075,9 @@ fail:
|
||||
s->got_picture = 0;
|
||||
return ret;
|
||||
the_end:
|
||||
|
||||
is16bit = av_pix_fmt_desc_get(s->avctx->pix_fmt)->comp[0].step_minus1;
|
||||
|
||||
if (s->upscale_h) {
|
||||
int p;
|
||||
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
|
||||
@@ -2081,6 +2087,7 @@ the_end:
|
||||
avctx->pix_fmt == AV_PIX_FMT_YUVA444P ||
|
||||
avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
|
||||
avctx->pix_fmt == AV_PIX_FMT_YUV420P ||
|
||||
avctx->pix_fmt == AV_PIX_FMT_YUV420P16||
|
||||
avctx->pix_fmt == AV_PIX_FMT_GBRAP
|
||||
);
|
||||
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
|
||||
@@ -2091,9 +2098,16 @@ the_end:
|
||||
continue;
|
||||
if (p==1 || p==2)
|
||||
w >>= hshift;
|
||||
av_assert0(w > 0);
|
||||
for (i = 0; i < s->chroma_height; i++) {
|
||||
for (index = w - 1; index; index--)
|
||||
line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1;
|
||||
if (is16bit) ((uint16_t*)line)[w - 1] = ((uint16_t*)line)[(w - 1) / 2];
|
||||
else line[w - 1] = line[(w - 1) / 2];
|
||||
for (index = w - 2; index > 0; index--) {
|
||||
if (is16bit)
|
||||
((uint16_t*)line)[index] = (((uint16_t*)line)[index / 2] + ((uint16_t*)line)[(index + 1) / 2]) >> 1;
|
||||
else
|
||||
line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1;
|
||||
}
|
||||
line += s->linesize[p];
|
||||
}
|
||||
}
|
||||
@@ -2118,7 +2132,7 @@ the_end:
|
||||
for (i = s->height - 1; i; i--) {
|
||||
uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[p])[i / 2 * s->linesize[p]];
|
||||
uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[p])[(i + 1) / 2 * s->linesize[p]];
|
||||
if (src1 == src2) {
|
||||
if (src1 == src2 || i == s->height - 1) {
|
||||
memcpy(dst, src1, w);
|
||||
} else {
|
||||
for (index = 0; index < w; index++)
|
||||
|
@@ -111,7 +111,7 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert)
|
||||
|
||||
if (color) {
|
||||
memset(s->frame->data[0] + y*s->frame->linesize[0] + x, color, run_length);
|
||||
if (half_vert)
|
||||
if (half_vert && y + half_vert < s->avctx->height)
|
||||
memset(s->frame->data[0] + (y+1)*s->frame->linesize[0] + x, color, run_length);
|
||||
}
|
||||
x+= run_length;
|
||||
|
@@ -1436,6 +1436,9 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s)
|
||||
{
|
||||
int i, err = 0;
|
||||
|
||||
if (!s->context_initialized)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (s->slice_context_count > 1) {
|
||||
for (i = 0; i < s->slice_context_count; i++) {
|
||||
free_duplicate_context(s->thread_context[i]);
|
||||
@@ -1465,8 +1468,8 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s)
|
||||
s->mb_height = (s->height + 15) / 16;
|
||||
|
||||
if ((s->width || s->height) &&
|
||||
av_image_check_size(s->width, s->height, 0, s->avctx))
|
||||
return AVERROR_INVALIDDATA;
|
||||
(err = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
|
||||
goto fail;
|
||||
|
||||
if ((err = init_context_frame(s)))
|
||||
goto fail;
|
||||
@@ -1482,7 +1485,7 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s)
|
||||
}
|
||||
|
||||
for (i = 0; i < nb_slices; i++) {
|
||||
if (init_duplicate_context(s->thread_context[i]) < 0)
|
||||
if ((err = init_duplicate_context(s->thread_context[i])) < 0)
|
||||
goto fail;
|
||||
s->thread_context[i]->start_mb_y =
|
||||
(s->mb_height * (i) + nb_slices / 2) / nb_slices;
|
||||
|
@@ -908,6 +908,11 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
|
||||
On2AVCContext *c = avctx->priv_data;
|
||||
int i;
|
||||
|
||||
if (avctx->channels > 2U) {
|
||||
avpriv_request_sample(avctx, "Decoding more than 2 channels");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
c->avctx = avctx;
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||
avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO
|
||||
|
@@ -644,7 +644,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
} else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) &&
|
||||
s->color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
} else if (s->bit_depth == 1) {
|
||||
} else if (s->bit_depth == 1 && s->bits_per_pixel == 1) {
|
||||
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
|
||||
} else if (s->bit_depth == 8 &&
|
||||
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
||||
@@ -851,10 +851,11 @@ exit_loop:
|
||||
int i, j;
|
||||
uint8_t *pd = p->data[0];
|
||||
uint8_t *pd_last = s->last_picture.f->data[0];
|
||||
int ls = FFMIN(av_image_get_linesize(p->format, s->width, 0), s->width * s->bpp);
|
||||
|
||||
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
|
||||
for (j = 0; j < s->height; j++) {
|
||||
for (i = 0; i < s->width * s->bpp; i++)
|
||||
for (i = 0; i < ls; i++)
|
||||
pd[i] += pd_last[i];
|
||||
pd += s->image_linesize;
|
||||
pd_last += s->image_linesize;
|
||||
|
@@ -471,7 +471,6 @@ static void put_alpha_run(PutBitContext *pb, int run)
|
||||
|
||||
// todo alpha quantisation for high quants
|
||||
static int encode_alpha_plane(ProresContext *ctx, PutBitContext *pb,
|
||||
const uint16_t *src, int linesize,
|
||||
int mbs_per_slice, uint16_t *blocks,
|
||||
int quant)
|
||||
{
|
||||
@@ -566,11 +565,16 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
|
||||
get_alpha_data(ctx, src, linesize, xp, yp,
|
||||
pwidth, avctx->height / ctx->pictures_per_frame,
|
||||
ctx->blocks[0], mbs_per_slice, ctx->alpha_bits);
|
||||
sizes[i] = encode_alpha_plane(ctx, pb, src, linesize,
|
||||
sizes[i] = encode_alpha_plane(ctx, pb,
|
||||
mbs_per_slice, ctx->blocks[0],
|
||||
quant);
|
||||
}
|
||||
total_size += sizes[i];
|
||||
if (put_bits_left(pb) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Serious underevaluation of"
|
||||
"required buffer size");
|
||||
return AVERROR_BUFFER_TOO_SMALL;
|
||||
}
|
||||
}
|
||||
return total_size;
|
||||
}
|
||||
@@ -941,9 +945,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
avctx->coded_frame->key_frame = 1;
|
||||
|
||||
pkt_size = ctx->frame_size_upper_bound + FF_MIN_BUFFER_SIZE;
|
||||
pkt_size = ctx->frame_size_upper_bound;
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0)
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size + FF_MIN_BUFFER_SIZE)) < 0)
|
||||
return ret;
|
||||
|
||||
orig_buf = pkt->data;
|
||||
@@ -1020,7 +1024,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
slice_hdr = buf;
|
||||
buf += slice_hdr_size - 1;
|
||||
init_put_bits(&pb, buf, (pkt_size - (buf - orig_buf)) * 8);
|
||||
encode_slice(avctx, pic, &pb, sizes, x, y, q, mbs_per_slice);
|
||||
ret = encode_slice(avctx, pic, &pb, sizes, x, y, q, mbs_per_slice);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
bytestream_put_byte(&slice_hdr, q);
|
||||
slice_size = slice_hdr_size + sizes[ctx->num_planes - 1];
|
||||
@@ -1202,8 +1208,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
ctx->bits_per_mb = ls * 8;
|
||||
if (ctx->chroma_factor == CFACTOR_Y444)
|
||||
ctx->bits_per_mb += ls * 4;
|
||||
if (ctx->num_planes == 4)
|
||||
ctx->bits_per_mb += ls * 4;
|
||||
}
|
||||
|
||||
ctx->frame_size_upper_bound = ctx->pictures_per_frame *
|
||||
@@ -1212,6 +1216,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
(mps * ctx->bits_per_mb) / 8)
|
||||
+ 200;
|
||||
|
||||
if (ctx->alpha_bits) {
|
||||
// alpha plane is run-coded and might run over bit budget
|
||||
ctx->frame_size_upper_bound += ctx->pictures_per_frame *
|
||||
ctx->slices_per_picture *
|
||||
/* num pixels per slice */ (ctx->mbs_per_slice * 256 *
|
||||
/* bits per pixel */ (1 + ctx->alpha_bits + 1) + 7 >> 3);
|
||||
}
|
||||
|
||||
avctx->codec_tag = ctx->profile_info->tag;
|
||||
|
||||
av_log(avctx, AV_LOG_DEBUG,
|
||||
|
@@ -163,7 +163,7 @@ static void av_noinline qpeg_decode_inter(QpegContext *qctx, uint8_t *dst,
|
||||
|
||||
/* check motion vector */
|
||||
if ((me_x + filled < 0) || (me_x + me_w + filled > width) ||
|
||||
(height - me_y - me_h < 0) || (height - me_y > orig_height) ||
|
||||
(height - me_y - me_h < 0) || (height - me_y >= orig_height) ||
|
||||
(filled + me_w > width) || (height - me_h < 0))
|
||||
av_log(NULL, AV_LOG_ERROR, "Bogus motion vector (%i,%i), block size %ix%i at %i,%i\n",
|
||||
me_x, me_y, me_w, me_h, filled, height);
|
||||
|
@@ -98,7 +98,7 @@ static int expand_rle_row16(SgiState *s, uint16_t *out_buf,
|
||||
break;
|
||||
|
||||
/* Check for buffer overflow. */
|
||||
if (pixelstride * (count - 1) >= len) {
|
||||
if (out_end - out_buf <= pixelstride * (count - 1)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid pixel count.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ static int read_rle_sgi(uint8_t *out_buf, SgiState *s)
|
||||
for (z = 0; z < s->depth; z++) {
|
||||
dest_row = out_buf;
|
||||
for (y = 0; y < s->height; y++) {
|
||||
linesize = s->width * s->depth * s->bytes_per_channel;
|
||||
linesize = s->width * s->depth;
|
||||
dest_row -= s->linesize;
|
||||
start_offset = bytestream2_get_be32(&g_table);
|
||||
bytestream2_seek(&s->g, start_offset, SEEK_SET);
|
||||
|
@@ -70,7 +70,7 @@ typedef struct SmcContext {
|
||||
row_ptr += stride * 4; \
|
||||
} \
|
||||
total_blocks--; \
|
||||
if (total_blocks < 0) \
|
||||
if (total_blocks < 0 + !!n_blocks) \
|
||||
{ \
|
||||
av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
|
||||
return; \
|
||||
|
@@ -659,7 +659,10 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i
|
||||
if(v){
|
||||
v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1);
|
||||
v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l&0xFF] + 3*ff_quant3bA[t&0xFF]]);
|
||||
|
||||
if ((uint16_t)v != v) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Coefficient damaged\n");
|
||||
v = 1;
|
||||
}
|
||||
xc->x=x;
|
||||
(xc++)->coeff= v;
|
||||
}
|
||||
@@ -669,6 +672,10 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i
|
||||
else run= INT_MAX;
|
||||
v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1);
|
||||
v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]);
|
||||
if ((uint16_t)v != v) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Coefficient damaged\n");
|
||||
v = 1;
|
||||
}
|
||||
|
||||
xc->x=x;
|
||||
(xc++)->coeff= v;
|
||||
|
@@ -495,7 +495,7 @@ static int svq1_decode_delta_block(AVCodecContext *avctx, HpelDSPContext *hdsp,
|
||||
return result;
|
||||
}
|
||||
|
||||
static void svq1_parse_string(GetBitContext *bitbuf, uint8_t *out)
|
||||
static void svq1_parse_string(GetBitContext *bitbuf, uint8_t out[257])
|
||||
{
|
||||
uint8_t seed;
|
||||
int i;
|
||||
@@ -507,6 +507,7 @@ static void svq1_parse_string(GetBitContext *bitbuf, uint8_t *out)
|
||||
out[i] = get_bits(bitbuf, 8) ^ seed;
|
||||
seed = string_table[out[i] ^ seed];
|
||||
}
|
||||
out[i] = 0;
|
||||
}
|
||||
|
||||
static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
|
||||
@@ -549,12 +550,12 @@ static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
|
||||
}
|
||||
|
||||
if ((s->frame_code ^ 0x10) >= 0x50) {
|
||||
uint8_t msg[256];
|
||||
uint8_t msg[257];
|
||||
|
||||
svq1_parse_string(bitbuf, msg);
|
||||
|
||||
av_log(avctx, AV_LOG_INFO,
|
||||
"embedded message:\n%s\n", (char *)msg);
|
||||
"embedded message:\n%s\n", ((char *)msg) + 1);
|
||||
}
|
||||
|
||||
skip_bits(bitbuf, 2);
|
||||
|
@@ -1176,7 +1176,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
h->cur_pic_ptr = s->cur_pic;
|
||||
av_frame_unref(&h->cur_pic.f);
|
||||
h->cur_pic = *s->cur_pic;
|
||||
memcpy(&h->cur_pic.tf, &s->cur_pic->tf, sizeof(h->cur_pic) - offsetof(H264Picture, tf));
|
||||
ret = av_frame_ref(&h->cur_pic.f, &s->cur_pic->f);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@@ -712,13 +712,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
s->height = value;
|
||||
break;
|
||||
case TIFF_BPP:
|
||||
s->bppcount = count;
|
||||
if (count > 4) {
|
||||
if (count > 4U) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"This format is not supported (bpp=%d, %d components)\n",
|
||||
s->bpp, count);
|
||||
value, count);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->bppcount = count;
|
||||
if (count == 1)
|
||||
s->bpp = value;
|
||||
else {
|
||||
@@ -736,6 +736,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
s->bpp = -1;
|
||||
}
|
||||
}
|
||||
if (s->bpp > 64U) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"This format is not supported (bpp=%d, %d components)\n",
|
||||
s->bpp, count);
|
||||
s->bpp = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
case TIFF_SAMPLES_PER_PIXEL:
|
||||
if (count != 1) {
|
||||
|
@@ -305,7 +305,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
|
||||
strips = (s->height - 1) / s->rps + 1;
|
||||
|
||||
packet_size = avctx->height * ((avctx->width * s->bpp + 7) >> 3) * 2 +
|
||||
bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
|
||||
s->subsampling[0] * s->subsampling[1] + 7) >> 3;
|
||||
packet_size = avctx->height * bytes_per_row * 2 +
|
||||
avctx->height * 4 + FF_MIN_BUFFER_SIZE;
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, packet_size)) < 0)
|
||||
@@ -333,8 +335,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
|
||||
s->subsampling[0] * s->subsampling[1] + 7) >> 3;
|
||||
if (is_yuv) {
|
||||
av_fast_padded_malloc(&s->yuv_line, &s->yuv_line_size, bytes_per_row);
|
||||
if (s->yuv_line == NULL) {
|
||||
|
@@ -297,6 +297,12 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
int i;
|
||||
int w_align = 1;
|
||||
int h_align = 1;
|
||||
AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
|
||||
|
||||
if (desc) {
|
||||
w_align = 1 << desc->log2_chroma_w;
|
||||
h_align = 1 << desc->log2_chroma_h;
|
||||
}
|
||||
|
||||
switch (s->pix_fmt) {
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
@@ -374,6 +380,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
case AV_PIX_FMT_GBRP12BE:
|
||||
case AV_PIX_FMT_GBRP14LE:
|
||||
case AV_PIX_FMT_GBRP14BE:
|
||||
case AV_PIX_FMT_GBRP16LE:
|
||||
case AV_PIX_FMT_GBRP16BE:
|
||||
w_align = 16; //FIXME assume 16 pixel per macroblock
|
||||
h_align = 16 * 2; // interlaced needs 2 macroblocks height
|
||||
break;
|
||||
@@ -403,6 +411,10 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
w_align = 4;
|
||||
h_align = 4;
|
||||
}
|
||||
if (s->codec_id == AV_CODEC_ID_JV) {
|
||||
w_align = 8;
|
||||
h_align = 8;
|
||||
}
|
||||
break;
|
||||
case AV_PIX_FMT_BGR24:
|
||||
if ((s->codec_id == AV_CODEC_ID_MSZH) ||
|
||||
@@ -418,8 +430,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
w_align = 1;
|
||||
h_align = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -389,7 +389,7 @@ static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
|
||||
}
|
||||
|
||||
static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
uint8_t *dst, int stride,
|
||||
uint8_t *dst, int stride, int plane_no,
|
||||
int width, int height, PutByteContext *pb)
|
||||
{
|
||||
UtvideoContext *c = avctx->priv_data;
|
||||
@@ -399,6 +399,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
HuffEntry he[256];
|
||||
|
||||
uint32_t offset = 0, slice_len = 0;
|
||||
const int cmask = ~(!plane_no && avctx->pix_fmt == AV_PIX_FMT_YUV420P);
|
||||
int i, sstart, send = 0;
|
||||
int symbol;
|
||||
int ret;
|
||||
@@ -408,7 +409,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
case PRED_NONE:
|
||||
for (i = 0; i < c->slices; i++) {
|
||||
sstart = send;
|
||||
send = height * (i + 1) / c->slices;
|
||||
send = height * (i + 1) / c->slices & cmask;
|
||||
av_image_copy_plane(dst + sstart * width, width,
|
||||
src + sstart * stride, stride,
|
||||
width, send - sstart);
|
||||
@@ -417,7 +418,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
case PRED_LEFT:
|
||||
for (i = 0; i < c->slices; i++) {
|
||||
sstart = send;
|
||||
send = height * (i + 1) / c->slices;
|
||||
send = height * (i + 1) / c->slices & cmask;
|
||||
left_predict(src + sstart * stride, dst + sstart * width,
|
||||
stride, width, send - sstart);
|
||||
}
|
||||
@@ -425,7 +426,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
case PRED_MEDIAN:
|
||||
for (i = 0; i < c->slices; i++) {
|
||||
sstart = send;
|
||||
send = height * (i + 1) / c->slices;
|
||||
send = height * (i + 1) / c->slices & cmask;
|
||||
median_predict(c, src + sstart * stride, dst + sstart * width,
|
||||
stride, width, send - sstart);
|
||||
}
|
||||
@@ -489,7 +490,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
|
||||
send = 0;
|
||||
for (i = 0; i < c->slices; i++) {
|
||||
sstart = send;
|
||||
send = height * (i + 1) / c->slices;
|
||||
send = height * (i + 1) / c->slices & cmask;
|
||||
|
||||
/*
|
||||
* Write the huffman codes to a buffer,
|
||||
@@ -571,7 +572,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
case AV_PIX_FMT_RGBA:
|
||||
for (i = 0; i < c->planes; i++) {
|
||||
ret = encode_plane(avctx, c->slice_buffer[i] + 2 * c->slice_stride,
|
||||
c->slice_buffer[i], c->slice_stride,
|
||||
c->slice_buffer[i], c->slice_stride, i,
|
||||
width, height, &pb);
|
||||
|
||||
if (ret) {
|
||||
@@ -583,7 +584,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
case AV_PIX_FMT_YUV422P:
|
||||
for (i = 0; i < c->planes; i++) {
|
||||
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
|
||||
pic->linesize[i], width >> !!i, height, &pb);
|
||||
pic->linesize[i], i, width >> !!i, height, &pb);
|
||||
|
||||
if (ret) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Error encoding plane %d.\n", i);
|
||||
@@ -594,7 +595,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
for (i = 0; i < c->planes; i++) {
|
||||
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
|
||||
pic->linesize[i], width >> !!i, height >> !!i,
|
||||
pic->linesize[i], i, width >> !!i, height >> !!i,
|
||||
&pb);
|
||||
|
||||
if (ret) {
|
||||
|
@@ -5484,7 +5484,7 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (!s->current_picture.f->data[0]) {
|
||||
if (!s->current_picture.f || !s->current_picture.f->data[0]) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Got no sprites\n");
|
||||
return -1;
|
||||
}
|
||||
|
@@ -1314,7 +1314,9 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
|
||||
vorbis_residue *vr,
|
||||
uint8_t *do_not_decode,
|
||||
unsigned ch_used,
|
||||
int partition_count)
|
||||
int partition_count,
|
||||
int ptns_to_read
|
||||
)
|
||||
{
|
||||
int p, j, i;
|
||||
unsigned c_p_c = vc->codebooks[vr->classbook].dimensions;
|
||||
@@ -1336,7 +1338,7 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
|
||||
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
|
||||
temp2 = (((uint64_t)temp) * inverse_class) >> 32;
|
||||
|
||||
if (i < vr->ptns_to_read)
|
||||
if (i < ptns_to_read)
|
||||
vr->classifs[p + i] = temp - temp2 * vr->classifications;
|
||||
temp = temp2;
|
||||
}
|
||||
@@ -1344,13 +1346,13 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
|
||||
for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
|
||||
temp2 = temp / vr->classifications;
|
||||
|
||||
if (i < vr->ptns_to_read)
|
||||
if (i < ptns_to_read)
|
||||
vr->classifs[p + i] = temp - temp2 * vr->classifications;
|
||||
temp = temp2;
|
||||
}
|
||||
}
|
||||
}
|
||||
p += vr->ptns_to_read;
|
||||
p += ptns_to_read;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1404,7 +1406,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
for (partition_count = 0; partition_count < ptns_to_read;) { // SPEC error
|
||||
if (!pass) {
|
||||
int ret;
|
||||
if ((ret = setup_classifs(vc, vr, do_not_decode, ch_used, partition_count)) < 0)
|
||||
if ((ret = setup_classifs(vc, vr, do_not_decode, ch_used, partition_count, ptns_to_read)) < 0)
|
||||
return ret;
|
||||
}
|
||||
for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) {
|
||||
|
@@ -253,6 +253,10 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb,
|
||||
return sign ? ~ret : ret;
|
||||
|
||||
error:
|
||||
ret = get_bits_left(gb);
|
||||
if (ret <= 0) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Too few bits (%d) left\n", ret);
|
||||
}
|
||||
*last = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -2876,10 +2876,11 @@ static int wavpack_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, s->block_samples * avctx->channels * 8)) < 0)
|
||||
buf_size = s->block_samples * avctx->channels * 8
|
||||
+ 200 /* for headers */;
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, buf_size)) < 0)
|
||||
return ret;
|
||||
buf = avpkt->data;
|
||||
buf_size = avpkt->size;
|
||||
|
||||
for (s->ch_offset = 0; s->ch_offset < avctx->channels;) {
|
||||
set_samplerate(s);
|
||||
|
@@ -1028,7 +1028,7 @@ static int apply_color_indexing_transform(WebPContext *s)
|
||||
ImageContext *img;
|
||||
ImageContext *pal;
|
||||
int i, x, y;
|
||||
uint8_t *p, *pi;
|
||||
uint8_t *p;
|
||||
|
||||
img = &s->image[IMAGE_ROLE_ARGB];
|
||||
pal = &s->image[IMAGE_ROLE_COLOR_INDEXING];
|
||||
@@ -1066,11 +1066,11 @@ static int apply_color_indexing_transform(WebPContext *s)
|
||||
p = GET_PIXEL(img->frame, x, y);
|
||||
i = p[2];
|
||||
if (i >= pal->frame->width) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid palette index %d\n", i);
|
||||
return AVERROR_INVALIDDATA;
|
||||
AV_WB32(p, 0x00000000);
|
||||
} else {
|
||||
const uint8_t *pi = GET_PIXEL(pal->frame, i, 0);
|
||||
AV_COPY32(p, pi);
|
||||
}
|
||||
pi = GET_PIXEL(pal->frame, i, 0);
|
||||
AV_COPY32(p, pi);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,10 +20,10 @@
|
||||
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
;******************************************************************************
|
||||
|
||||
%if ARCH_X86_64
|
||||
|
||||
%include "libavutil/x86/x86util.asm"
|
||||
|
||||
%if ARCH_X86_64
|
||||
|
||||
SECTION_RODATA
|
||||
|
||||
cextern pb_3
|
||||
|
@@ -1,4 +1,4 @@
|
||||
LIBAVDEVICE_$MAJOR {
|
||||
global: avdevice_*;
|
||||
global: avdevice_*; av_*;
|
||||
local: *;
|
||||
};
|
||||
|
@@ -55,8 +55,10 @@ static int ape_tag_read_field(AVFormatContext *s)
|
||||
av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key);
|
||||
return -1;
|
||||
}
|
||||
if (size >= UINT_MAX)
|
||||
return -1;
|
||||
if (size > INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
|
||||
av_log(s, AV_LOG_ERROR, "APE tag size too large.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (flags & APE_TAG_FLAG_IS_BINARY) {
|
||||
uint8_t filename[1024];
|
||||
enum AVCodecID id;
|
||||
|
@@ -33,13 +33,15 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
|
||||
|
||||
for(i=0; i<probe_packet->buf_size; i++){
|
||||
temp_buffer = (temp_buffer<<8) + probe_packet->buf[i];
|
||||
if ((temp_buffer & 0xffffff00) != 0x100)
|
||||
if (temp_buffer & 0xfffffe00)
|
||||
continue;
|
||||
if (temp_buffer < 2)
|
||||
continue;
|
||||
|
||||
if (temp_buffer == VOP_START_CODE) VOP++;
|
||||
else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++;
|
||||
else if (temp_buffer < 0x120) VO++;
|
||||
else if (temp_buffer < 0x130) VOL++;
|
||||
else if (temp_buffer >= 0x100 && temp_buffer < 0x120) VO++;
|
||||
else if (temp_buffer >= 0x120 && temp_buffer < 0x130) VOL++;
|
||||
else if ( !(0x1AF < temp_buffer && temp_buffer < 0x1B7)
|
||||
&& !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++;
|
||||
}
|
||||
|
@@ -2161,8 +2161,10 @@ static int matroska_read_header(AVFormatContext *s)
|
||||
(AVRational) { 1, 1000000000 },
|
||||
chapters[i].start, chapters[i].end,
|
||||
chapters[i].title);
|
||||
av_dict_set(&chapters[i].chapter->metadata,
|
||||
"title", chapters[i].title, 0);
|
||||
if (chapters[i].chapter) {
|
||||
av_dict_set(&chapters[i].chapter->metadata,
|
||||
"title", chapters[i].title, 0);
|
||||
}
|
||||
max_start = chapters[i].start;
|
||||
}
|
||||
|
||||
|
@@ -783,7 +783,7 @@ static int vobsub_read_header(AVFormatContext *s)
|
||||
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
av_log(s, AV_LOG_DEBUG, "IDX stream[%d] name=%s\n", st->id, p);
|
||||
av_log(s, AV_LOG_DEBUG, "IDX stream[%d] name=%s\n", stream_id, p);
|
||||
av_strlcpy(alt, p, sizeof(alt));
|
||||
header_parsed = 1;
|
||||
|
||||
|
@@ -506,6 +506,7 @@ static int analyze(const uint8_t *buf, int size, int packet_size, int *index)
|
||||
int stat[TS_MAX_PACKET_SIZE];
|
||||
int i;
|
||||
int best_score = 0;
|
||||
int best_score2 = 0;
|
||||
|
||||
memset(stat, 0, packet_size * sizeof(*stat));
|
||||
|
||||
@@ -517,11 +518,13 @@ static int analyze(const uint8_t *buf, int size, int packet_size, int *index)
|
||||
best_score = stat[x];
|
||||
if (index)
|
||||
*index = x;
|
||||
} else if (stat[x] > best_score2) {
|
||||
best_score2 = stat[x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return best_score;
|
||||
return best_score - best_score2;
|
||||
}
|
||||
|
||||
/* autodetect fec presence. Must have at least 1024 bytes */
|
||||
@@ -849,8 +852,12 @@ static int read_sl_header(PESContext *pes, SLConfigDescr *sl,
|
||||
int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
|
||||
int dts_flag = -1, cts_flag = -1;
|
||||
int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
|
||||
uint8_t buf_padded[128 + FF_INPUT_BUFFER_PADDING_SIZE];
|
||||
int buf_padded_size = FFMIN(buf_size, sizeof(buf_padded) - FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
||||
init_get_bits(&gb, buf, buf_size * 8);
|
||||
memcpy(buf_padded, buf, buf_padded_size);
|
||||
|
||||
init_get_bits(&gb, buf_padded, buf_padded_size * 8);
|
||||
|
||||
if (sl->use_au_start)
|
||||
au_start_flag = get_bits1(&gb);
|
||||
@@ -1985,7 +1992,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
break;
|
||||
desc_len = get8(&p, desc_list_end);
|
||||
desc_end = p + desc_len;
|
||||
if (desc_end > desc_list_end)
|
||||
if (desc_len < 0 || desc_end > desc_list_end)
|
||||
break;
|
||||
|
||||
av_dlog(ts->stream, "tag: 0x%02x len=%d\n",
|
||||
|
@@ -817,7 +817,6 @@ retry:
|
||||
return psize;
|
||||
fail:
|
||||
av_free_packet(pkt);
|
||||
av_free(pkt);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
|
@@ -209,11 +209,15 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, int flags)
|
||||
void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
|
||||
const AVCodecTag *tags, int for_asf, int ignore_extradata)
|
||||
{
|
||||
int keep_height = enc->extradata_size >= 9 &&
|
||||
!memcmp(enc->extradata + enc->extradata_size - 9, "BottomUp", 9);
|
||||
int extradata_size = enc->extradata_size - 9*keep_height;
|
||||
|
||||
/* size */
|
||||
avio_wl32(pb, 40 + (ignore_extradata ? 0 : enc->extradata_size));
|
||||
avio_wl32(pb, 40 + (ignore_extradata ? 0 :extradata_size));
|
||||
avio_wl32(pb, enc->width);
|
||||
//We always store RGB TopDown
|
||||
avio_wl32(pb, enc->codec_tag ? enc->height : -enc->height);
|
||||
avio_wl32(pb, enc->codec_tag || keep_height ? enc->height : -enc->height);
|
||||
/* planes */
|
||||
avio_wl16(pb, 1);
|
||||
/* depth */
|
||||
@@ -227,9 +231,9 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
|
||||
avio_wl32(pb, 0);
|
||||
|
||||
if (!ignore_extradata) {
|
||||
avio_write(pb, enc->extradata, enc->extradata_size);
|
||||
avio_write(pb, enc->extradata, extradata_size);
|
||||
|
||||
if (!for_asf && enc->extradata_size & 1)
|
||||
if (!for_asf && extradata_size & 1)
|
||||
avio_w8(pb, 0);
|
||||
}
|
||||
}
|
||||
|
@@ -684,7 +684,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
end_pts = seg->segment_count < seg->nb_times ?
|
||||
seg->times[seg->segment_count] : INT64_MAX;
|
||||
} else if (seg->frames) {
|
||||
start_frame = seg->segment_count <= seg->nb_frames ?
|
||||
start_frame = seg->segment_count < seg->nb_frames ?
|
||||
seg->frames[seg->segment_count] : INT_MAX;
|
||||
} else {
|
||||
if (seg->use_clocktime) {
|
||||
|
@@ -289,6 +289,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
const int bmp_fmt = avio_r8(pb);
|
||||
const int width = avio_rl16(pb);
|
||||
const int height = avio_rl16(pb);
|
||||
int pix_fmt;
|
||||
|
||||
len -= 2+1+2+2;
|
||||
|
||||
@@ -353,17 +354,21 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
avpriv_set_pts_info(vst, 64, 256, swf->frame_rate);
|
||||
st = vst;
|
||||
}
|
||||
st->codec->width = width;
|
||||
st->codec->height = height;
|
||||
|
||||
if ((res = av_new_packet(pkt, out_len - colormapsize * colormapbpp)) < 0)
|
||||
goto bitmap_end;
|
||||
if (!st->codec->width && !st->codec->height) {
|
||||
st->codec->width = width;
|
||||
st->codec->height = height;
|
||||
} else {
|
||||
ff_add_param_change(pkt, 0, 0, 0, width, height);
|
||||
}
|
||||
pkt->pos = pos;
|
||||
pkt->stream_index = st->index;
|
||||
|
||||
switch (bmp_fmt) {
|
||||
case 3:
|
||||
st->codec->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
pix_fmt = AV_PIX_FMT_PAL8;
|
||||
for (i = 0; i < colormapsize; i++)
|
||||
if (alpha_bmp) colormap[i] = buf[3]<<24 | AV_RB24(buf + 4*i);
|
||||
else colormap[i] = 0xffU <<24 | AV_RB24(buf + 3*i);
|
||||
@@ -375,14 +380,20 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
memcpy(pal, colormap, AVPALETTE_SIZE);
|
||||
break;
|
||||
case 4:
|
||||
st->codec->pix_fmt = AV_PIX_FMT_RGB555;
|
||||
pix_fmt = AV_PIX_FMT_RGB555;
|
||||
break;
|
||||
case 5:
|
||||
st->codec->pix_fmt = alpha_bmp ? AV_PIX_FMT_ARGB : AV_PIX_FMT_0RGB;
|
||||
pix_fmt = alpha_bmp ? AV_PIX_FMT_ARGB : AV_PIX_FMT_0RGB;
|
||||
break;
|
||||
default:
|
||||
av_assert0(0);
|
||||
}
|
||||
if (st->codec->pix_fmt != AV_PIX_FMT_NONE && st->codec->pix_fmt != pix_fmt) {
|
||||
av_log(s, AV_LOG_ERROR, "pixel format change unsupported\n");
|
||||
res = AVERROR_PATCHWELCOME;
|
||||
goto bitmap_end;
|
||||
}
|
||||
st->codec->pix_fmt = pix_fmt;
|
||||
|
||||
if (linesize * height > pkt->size) {
|
||||
res = AVERROR_INVALIDDATA;
|
||||
|
@@ -631,7 +631,7 @@ int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int searc
|
||||
"The value set by option '%s' is not a channel layout.\n", o->name);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
*(int *)(((int64_t *)target_obj) + o->offset) = cl;
|
||||
*(int64_t *)(((uint8_t *)target_obj) + o->offset) = cl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,7 @@
|
||||
"cpuid \n\t" \
|
||||
"xchg %%"REG_b", %%"REG_S \
|
||||
: "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx) \
|
||||
: "0" (index))
|
||||
: "0" (index), "2"(0))
|
||||
|
||||
#define xgetbv(index, eax, edx) \
|
||||
__asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index))
|
||||
|
@@ -979,7 +979,7 @@ void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
|
||||
|
||||
if(pict_type & PP_PICT_TYPE_QP2){
|
||||
int i;
|
||||
const int count= mbHeight * absQPStride;
|
||||
const int count= FFMAX(mbHeight * absQPStride, mbWidth);
|
||||
for(i=0; i<(count>>2); i++){
|
||||
((uint32_t*)c->stdQPTable)[i] = (((const uint32_t*)QP_store)[i]>>1) & 0x7F7F7F7F;
|
||||
}
|
||||
@@ -1004,7 +1004,7 @@ void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
|
||||
if((pict_type&7)!=3){
|
||||
if (QPStride >= 0){
|
||||
int i;
|
||||
const int count= mbHeight * QPStride;
|
||||
const int count= FFMAX(mbHeight * QPStride, mbWidth);
|
||||
for(i=0; i<(count>>2); i++){
|
||||
((uint32_t*)c->nonBQPTable)[i] = ((const uint32_t*)QP_store)[i] & 0x3F3F3F3F;
|
||||
}
|
||||
|
@@ -639,6 +639,8 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
|
||||
in_count = 0;
|
||||
if(ret>0) {
|
||||
s->drop_output -= ret;
|
||||
if (!s->drop_output && !out_arg)
|
||||
return 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
pp3 f38fdc2dfa4c8d889918efe6d7a7ac3a
|
||||
pp3 ef0f10f1859af2f75717e8c9d64ee38a
|
||||
|
@@ -33,6 +33,10 @@
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/timer.h"
|
||||
|
||||
#ifndef AV_READ_TIME
|
||||
#define AV_READ_TIME(x) 0
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h> /* for getopt */
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user