Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: svq3: replace unsafe pointer casting with intreadwrite macros Update Changelog for the 0.8.4 Release lavc: remove stats_out from the options table. Prepare for 0.8.4 Release tiffenc: Check av_malloc() results. mpegaudiodec: fix short_start calculation h264: avoid stuck buffer pointer in decode_nal_units vf_pad/scale: use double precision for aspect ratios. yuv4mpeg: return proper error codes. smacker audio: sign-extend the initial 16-bit predicted value Conflicts: Changelog RELEASE libavfilter/vf_pad.c libavfilter/vf_scale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
988910a277
@ -3894,7 +3894,11 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
|
||||
break;
|
||||
}
|
||||
|
||||
if(buf_index+3 >= buf_size) break;
|
||||
|
||||
if (buf_index + 3 >= buf_size) {
|
||||
buf_index = buf_size;
|
||||
break;
|
||||
}
|
||||
|
||||
buf_index+=3;
|
||||
if(buf_index >= next_avc) continue;
|
||||
|
@ -210,7 +210,7 @@ static void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g)
|
||||
else
|
||||
g->long_end = 4; /* 8000 Hz */
|
||||
|
||||
g->short_start = 2 + (s->sample_rate_index != 8);
|
||||
g->short_start = 3;
|
||||
} else {
|
||||
g->long_end = 0;
|
||||
g->short_start = 0;
|
||||
|
@ -223,8 +223,6 @@ static const AVOption options[]={
|
||||
{"parse_only", NULL, OFFSET(parse_only), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
|
||||
#endif
|
||||
{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
|
||||
{"stats_out", NULL, OFFSET(stats_out), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX},
|
||||
{"stats_in", NULL, OFFSET(stats_in), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX},
|
||||
{"qsquish", "how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function)", OFFSET(rc_qsquish), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 99, V|E},
|
||||
{"rc_qmod_amp", "experimental quantizer modulation", OFFSET(rc_qmod_amp), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E},
|
||||
{"rc_qmod_freq", "experimental quantizer modulation", OFFSET(rc_qmod_freq), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
|
||||
|
@ -411,17 +411,17 @@ static inline int svq3_mc_dir(H264Context *h, int size, int mode, int dir,
|
||||
int32_t mv = pack16to32(mx,my);
|
||||
|
||||
if (part_height == 8 && i < 8) {
|
||||
*(int32_t *) h->mv_cache[dir][scan8[k] + 1*8] = mv;
|
||||
AV_WN32A(h->mv_cache[dir][scan8[k] + 1*8], mv);
|
||||
|
||||
if (part_width == 8 && j < 8) {
|
||||
*(int32_t *) h->mv_cache[dir][scan8[k] + 1 + 1*8] = mv;
|
||||
AV_WN32A(h->mv_cache[dir][scan8[k] + 1 + 1*8], mv);
|
||||
}
|
||||
}
|
||||
if (part_width == 8 && j < 8) {
|
||||
*(int32_t *) h->mv_cache[dir][scan8[k] + 1] = mv;
|
||||
AV_WN32A(h->mv_cache[dir][scan8[k] + 1], mv);
|
||||
}
|
||||
if (part_width == 4 || part_height == 4) {
|
||||
*(int32_t *) h->mv_cache[dir][scan8[k]] = mv;
|
||||
AV_WN32A(h->mv_cache[dir][scan8[k]], mv);
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,11 +489,11 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
|
||||
for (m = 0; m < 2; m++) {
|
||||
if (s->mb_x > 0 && h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6] != -1) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
*(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = *(uint32_t *) s->current_picture.f.motion_val[m][b_xy - 1 + i*h->b_stride];
|
||||
AV_COPY32(h->mv_cache[m][scan8[0] - 1 + i*8], s->current_picture.f.motion_val[m][b_xy - 1 + i*h->b_stride]);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 4; i++) {
|
||||
*(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = 0;
|
||||
AV_ZERO32(h->mv_cache[m][scan8[0] - 1 + i*8]);
|
||||
}
|
||||
}
|
||||
if (s->mb_y > 0) {
|
||||
@ -501,14 +501,14 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
|
||||
memset(&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4);
|
||||
|
||||
if (s->mb_x < (s->mb_width - 1)) {
|
||||
*(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1*8] = *(uint32_t *) s->current_picture.f.motion_val[m][b_xy - h->b_stride + 4];
|
||||
AV_COPY32(h->mv_cache[m][scan8[0] + 4 - 1*8], s->current_picture.f.motion_val[m][b_xy - h->b_stride + 4]);
|
||||
h->ref_cache[m][scan8[0] + 4 - 1*8] =
|
||||
(h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride + 1]+6] == -1 ||
|
||||
h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride ] ] == -1) ? PART_NOT_AVAILABLE : 1;
|
||||
}else
|
||||
h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE;
|
||||
if (s->mb_x > 0) {
|
||||
*(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1*8] = *(uint32_t *) s->current_picture.f.motion_val[m][b_xy - h->b_stride - 1];
|
||||
AV_COPY32(h->mv_cache[m][scan8[0] - 1 - 1*8], s->current_picture.f.motion_val[m][b_xy - h->b_stride - 1]);
|
||||
h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] == -1) ? PART_NOT_AVAILABLE : 1;
|
||||
}else
|
||||
h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE;
|
||||
|
@ -336,6 +336,10 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
|
||||
|
||||
strip_sizes = av_mallocz(sizeof(*strip_sizes) * strips);
|
||||
strip_offsets = av_mallocz(sizeof(*strip_offsets) * strips);
|
||||
if (!strip_sizes || !strip_offsets) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bytes_per_row = (((s->width - 1)/s->subsampling[0] + 1) * s->bpp
|
||||
* s->subsampling[0] * s->subsampling[1] + 7) >> 3;
|
||||
@ -343,6 +347,7 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
|
||||
yuv_line = av_malloc(bytes_per_row);
|
||||
if (yuv_line == NULL){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Not enough memory\n");
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
@ -355,6 +360,10 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
|
||||
|
||||
zlen = bytes_per_row * s->rps;
|
||||
zbuf = av_malloc(zlen);
|
||||
if (!zbuf) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
strip_offsets[0] = ptr - buf;
|
||||
zn = 0;
|
||||
for (j = 0; j < s->rps; j++) {
|
||||
@ -379,8 +388,13 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if(s->compr == TIFF_LZW)
|
||||
if (s->compr == TIFF_LZW) {
|
||||
s->lzws = av_malloc(ff_lzw_encode_state_size);
|
||||
if (!s->lzws) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < s->height; i++) {
|
||||
if (strip_sizes[i / s->rps] == 0) {
|
||||
if(s->compr == TIFF_LZW){
|
||||
|
@ -151,9 +151,9 @@ static int config_input(AVFilterLink *inlink)
|
||||
var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h;
|
||||
var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN;
|
||||
var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN;
|
||||
var_values[VAR_A] = (float) inlink->w / inlink->h;
|
||||
var_values[VAR_A] = (double) inlink->w / inlink->h;
|
||||
var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
|
||||
(float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
|
||||
(double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
|
||||
var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
|
||||
var_values[VAR_HSUB] = 1<<pad->hsub;
|
||||
var_values[VAR_VSUB] = 1<<pad->vsub;
|
||||
|
@ -154,9 +154,11 @@ static int config_props(AVFilterLink *outlink)
|
||||
var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h;
|
||||
var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN;
|
||||
var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN;
|
||||
var_values[VAR_A] = (float) inlink->w / inlink->h;
|
||||
var_values[VAR_A] = (double) inlink->w / inlink->h;
|
||||
|
||||
var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
|
||||
(float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
|
||||
|
||||
(double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
|
||||
var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
|
||||
var_values[VAR_HSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
|
||||
var_values[VAR_VSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
|
||||
|
@ -369,7 +369,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
int i;
|
||||
char header[MAX_FRAME_HEADER+1];
|
||||
int packet_size, width, height;
|
||||
int packet_size, width, height, ret;
|
||||
AVStream *st = s->streams[0];
|
||||
struct frame_attributes *s1 = s->priv_data;
|
||||
|
||||
@ -380,20 +380,28 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == MAX_FRAME_HEADER)
|
||||
return -1;
|
||||
if (s->pb->error)
|
||||
return s->pb->error;
|
||||
else if (s->pb->eof_reached)
|
||||
return AVERROR_EOF;
|
||||
else if (i == MAX_FRAME_HEADER)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (strncmp(header, Y4M_FRAME_MAGIC, strlen(Y4M_FRAME_MAGIC)))
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
width = st->codec->width;
|
||||
height = st->codec->height;
|
||||
|
||||
packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
|
||||
if (packet_size < 0)
|
||||
return -1;
|
||||
return packet_size;
|
||||
|
||||
if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
|
||||
return AVERROR(EIO);
|
||||
ret = av_get_packet(s->pb, pkt, packet_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
else if (ret != packet_size)
|
||||
return s->pb->eof_reached ? AVERROR_EOF : AVERROR(EIO);
|
||||
|
||||
if (st->codec->coded_frame) {
|
||||
st->codec->coded_frame->interlaced_frame = s1->interlaced_frame;
|
||||
|
Loading…
x
Reference in New Issue
Block a user