aboutsummaryrefslogtreecommitdiff
path: root/gst-libs/ext/libav/libavcodec
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs/ext/libav/libavcodec')
-rw-r--r--gst-libs/ext/libav/libavcodec/aacdec.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/alac.c7
-rw-r--r--gst-libs/ext/libav/libavcodec/flacenc.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/flashsv.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/h264.c35
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_ps.c22
-rw-r--r--gst-libs/ext/libav/libavcodec/indeo3.c31
-rw-r--r--gst-libs/ext/libav/libavcodec/ivi_common.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg12.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg12.h1
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodec.c32
-rw-r--r--gst-libs/ext/libav/libavcodec/svq3.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/vp5.c12
-rw-r--r--gst-libs/ext/libav/libavcodec/vp56.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/vp56.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/vp6.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/vp8.c1
17 files changed, 145 insertions, 72 deletions
diff --git a/gst-libs/ext/libav/libavcodec/aacdec.c b/gst-libs/ext/libav/libavcodec/aacdec.c
index 2b9b45c..6478c77 100644
--- a/gst-libs/ext/libav/libavcodec/aacdec.c
+++ b/gst-libs/ext/libav/libavcodec/aacdec.c
@@ -1747,7 +1747,7 @@ static void apply_tns(float coef[1024], TemporalNoiseShaping *tns,
int w, filt, m, i;
int bottom, top, order, start, end, size, inc;
float lpc[TNS_MAX_ORDER];
- float tmp[TNS_MAX_ORDER];
+ float tmp[TNS_MAX_ORDER + 1];
for (w = 0; w < ics->num_windows; w++) {
bottom = ics->num_swb;
diff --git a/gst-libs/ext/libav/libavcodec/alac.c b/gst-libs/ext/libav/libavcodec/alac.c
index 278cc99..da78908 100644
--- a/gst-libs/ext/libav/libavcodec/alac.c
+++ b/gst-libs/ext/libav/libavcodec/alac.c
@@ -605,10 +605,9 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
alac->avctx = avctx;
/* initialize from the extradata */
- if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE) {
- av_log(avctx, AV_LOG_ERROR, "alac: expected %d extradata bytes\n",
- ALAC_EXTRADATA_SIZE);
- return -1;
+ if (alac->avctx->extradata_size < ALAC_EXTRADATA_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "alac: extradata is too small\n");
+ return AVERROR_INVALIDDATA;
}
if (alac_set_info(alac)) {
av_log(avctx, AV_LOG_ERROR, "alac: set_info failed\n");
diff --git a/gst-libs/ext/libav/libavcodec/flacenc.c b/gst-libs/ext/libav/libavcodec/flacenc.c
index 94e381d..2bd4788 100644
--- a/gst-libs/ext/libav/libavcodec/flacenc.c
+++ b/gst-libs/ext/libav/libavcodec/flacenc.c
@@ -915,14 +915,16 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
omethod == ORDER_METHOD_8LEVEL) {
int levels = 1 << omethod;
uint32_t bits[1 << ORDER_METHOD_8LEVEL];
- int order;
+ int order = -1;
int opt_index = levels-1;
opt_order = max_order-1;
bits[opt_index] = UINT32_MAX;
for (i = levels-1; i >= 0; i--) {
+ int last_order = order;
order = min_order + (((max_order-min_order+1) * (i+1)) / levels)-1;
- if (order < 0)
- order = 0;
+ order = av_clip(order, min_order - 1, max_order - 1);
+ if (order == last_order)
+ continue;
encode_residual_lpc(res, smp, n, order+1, coefs[order], shift[order]);
bits[i] = find_subframe_rice_params(s, sub, order+1);
if (bits[i] < bits[opt_index]) {
diff --git a/gst-libs/ext/libav/libavcodec/flashsv.c b/gst-libs/ext/libav/libavcodec/flashsv.c
index c99c21c..4a231ce 100644
--- a/gst-libs/ext/libav/libavcodec/flashsv.c
+++ b/gst-libs/ext/libav/libavcodec/flashsv.c
@@ -370,6 +370,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
}
if (has_diff) {
+ if (!s->keyframe) {
+ av_log(avctx, AV_LOG_ERROR,
+ "inter frame without keyframe\n");
+ return AVERROR_INVALIDDATA;
+ }
s->diff_start = get_bits(&gb, 8);
s->diff_height = get_bits(&gb, 8);
av_log(avctx, AV_LOG_DEBUG,
@@ -389,6 +394,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
av_log_missing_feature(avctx, "zlibprime_curr", 1);
return AVERROR_PATCHWELCOME;
}
+ if (!s->blocks && (s->zlibprime_curr || s->zlibprime_prev)) {
+ av_log(avctx, AV_LOG_ERROR, "no data available for zlib "
+ "priming\n");
+ return AVERROR_INVALIDDATA;
+ }
size--; // account for flags byte
}
diff --git a/gst-libs/ext/libav/libavcodec/h264.c b/gst-libs/ext/libav/libavcodec/h264.c
index d8d0a7d..f3a47fe 100644
--- a/gst-libs/ext/libav/libavcodec/h264.c
+++ b/gst-libs/ext/libav/libavcodec/h264.c
@@ -2866,7 +2866,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
h->mb_mbaff = 0;
h->mb_aff_frame = 0;
last_pic_structure = s0->picture_structure;
- last_pic_dropable = s->dropable;
+ last_pic_dropable = s0->dropable;
s->dropable = h->nal_ref_idc == 0;
if(h->sps.frame_mbs_only_flag){
s->picture_structure= PICT_FRAME;
@@ -2889,6 +2889,11 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
s->picture_structure = last_pic_structure;
s->dropable = last_pic_dropable;
return AVERROR_INVALIDDATA;
+ } else if (!s->current_picture_ptr) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "unset current_picture_ptr on %d. slice\n",
+ h0->current_slice + 1);
+ return AVERROR_INVALIDDATA;
}
} else {
/* Shorten frame num gaps so we don't have to allocate reference
@@ -3116,8 +3121,13 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
if(num_ref_idx_active_override_flag){
h->ref_count[0]= get_ue_golomb(&s->gb) + 1;
- if(h->slice_type_nos==AV_PICTURE_TYPE_B)
+ if (h->ref_count[0] < 1)
+ return AVERROR_INVALIDDATA;
+ if (h->slice_type_nos == AV_PICTURE_TYPE_B) {
h->ref_count[1]= get_ue_golomb(&s->gb) + 1;
+ if (h->ref_count[1] < 1)
+ return AVERROR_INVALIDDATA;
+ }
}
if (h->ref_count[0] > max_refs || h->ref_count[1] > max_refs) {
@@ -3760,9 +3770,10 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END&part_mask);
return 0;
- }else{
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask);
-
+ } else {
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y,
+ s->mb_x - 1, s->mb_y,
+ ER_MB_END & part_mask);
return -1;
}
}
@@ -4007,6 +4018,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
hx->inter_gb_ptr= &hx->inter_gb;
if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
+ && s->current_picture_ptr
&& s->context_initialized
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
@@ -4029,9 +4041,16 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
ff_h264_decode_seq_parameter_set(h);
}
- if (s->flags& CODEC_FLAG_LOW_DELAY ||
- (h->sps.bitstream_restriction_flag && !h->sps.num_reorder_frames))
- s->low_delay=1;
+ if (s->flags & CODEC_FLAG_LOW_DELAY ||
+ (h->sps.bitstream_restriction_flag &&
+ !h->sps.num_reorder_frames)) {
+ if (s->avctx->has_b_frames > 1 || h->delayed_pic[0])
+ av_log(avctx, AV_LOG_WARNING, "Delayed frames seen "
+ "reenabling low delay requires a codec "
+ "flush.\n");
+ else
+ s->low_delay = 1;
+ }
if(avctx->has_b_frames < 2)
avctx->has_b_frames= !s->low_delay;
diff --git a/gst-libs/ext/libav/libavcodec/h264_ps.c b/gst-libs/ext/libav/libavcodec/h264_ps.c
index ff6103c..00c5003 100644
--- a/gst-libs/ext/libav/libavcodec/h264_ps.c
+++ b/gst-libs/ext/libav/libavcodec/h264_ps.c
@@ -37,6 +37,9 @@
//#undef NDEBUG
#include <assert.h>
+#define MAX_LOG2_MAX_FRAME_NUM (12 + 4)
+#define MIN_LOG2_MAX_FRAME_NUM 4
+
static const AVRational pixel_aspect[17]={
{0, 1},
{1, 1},
@@ -301,7 +304,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
MpegEncContext * const s = &h->s;
int profile_idc, level_idc, constraint_set_flags = 0;
unsigned int sps_id;
- int i;
+ int i, log2_max_frame_num_minus4;
SPS *sps;
profile_idc= get_bits(&s->gb, 8);
@@ -330,7 +333,11 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
sps->scaling_matrix_present = 0;
- if(sps->profile_idc >= 100){ //high profile
+ if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
+ sps->profile_idc == 122 || sps->profile_idc == 244 ||
+ sps->profile_idc == 44 || sps->profile_idc == 83 ||
+ sps->profile_idc == 86 || sps->profile_idc == 118 ||
+ sps->profile_idc == 128 || sps->profile_idc == 144) {
sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
if(sps->chroma_format_idc > 3) {
av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc (%u) out of range\n", sps->chroma_format_idc);
@@ -348,7 +355,16 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
sps->bit_depth_chroma = 8;
}
- sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4;
+ log2_max_frame_num_minus4 = get_ue_golomb(&s->gb);
+ if (log2_max_frame_num_minus4 < MIN_LOG2_MAX_FRAME_NUM - 4 ||
+ log2_max_frame_num_minus4 > MAX_LOG2_MAX_FRAME_NUM - 4) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "log2_max_frame_num_minus4 out of range (0-12): %d\n",
+ log2_max_frame_num_minus4);
+ return AVERROR_INVALIDDATA;
+ }
+ sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4;
+
sps->poc_type= get_ue_golomb_31(&s->gb);
if(sps->poc_type == 0){ //FIXME #define
diff --git a/gst-libs/ext/libav/libavcodec/indeo3.c b/gst-libs/ext/libav/libavcodec/indeo3.c
index 294527e..48e5810 100644
--- a/gst-libs/ext/libav/libavcodec/indeo3.c
+++ b/gst-libs/ext/libav/libavcodec/indeo3.c
@@ -207,6 +207,7 @@ static av_cold void free_frame_buffers(Indeo3DecodeContext *ctx)
for (p = 0; p < 3; p++) {
av_freep(&ctx->planes[p].buffers[0]);
av_freep(&ctx->planes[p].buffers[1]);
+ ctx->planes[p].pixels[0] = ctx->planes[p].pixels[1] = 0;
}
}
@@ -344,8 +345,10 @@ if (*data_ptr >= last_ptr) \
fill_64(dst, pix64, num_lines << 1, row_offset)
#define APPLY_DELTA_4 \
- AV_WN16A(dst + line_offset , AV_RN16A(ref ) + delta_tab->deltas[dyad1]);\
- AV_WN16A(dst + line_offset + 2, AV_RN16A(ref + 2) + delta_tab->deltas[dyad2]);\
+ AV_WN16A(dst + line_offset ,\
+ (AV_RN16A(ref ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
+ AV_WN16A(dst + line_offset + 2,\
+ (AV_RN16A(ref + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
if (mode >= 3) {\
if (is_top_of_cell && !cell->ypos) {\
AV_COPY32(dst, dst + row_offset);\
@@ -358,14 +361,14 @@ if (*data_ptr >= last_ptr) \
/* apply two 32-bit VQ deltas to next even line */\
if (is_top_of_cell) { \
AV_WN32A(dst + row_offset , \
- replicate32(AV_RN32A(ref )) + delta_tab->deltas_m10[dyad1]);\
+ (replicate32(AV_RN32A(ref )) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
AV_WN32A(dst + row_offset + 4, \
- replicate32(AV_RN32A(ref + 4)) + delta_tab->deltas_m10[dyad2]);\
+ (replicate32(AV_RN32A(ref + 4)) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
} else { \
AV_WN32A(dst + row_offset , \
- AV_RN32A(ref ) + delta_tab->deltas_m10[dyad1]);\
+ (AV_RN32A(ref ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
AV_WN32A(dst + row_offset + 4, \
- AV_RN32A(ref + 4) + delta_tab->deltas_m10[dyad2]);\
+ (AV_RN32A(ref + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
} \
/* odd lines are not coded but rather interpolated/replicated */\
/* first line of the cell on the top of image? - replicate */\
@@ -379,22 +382,22 @@ if (*data_ptr >= last_ptr) \
#define APPLY_DELTA_1011_INTER \
if (mode == 10) { \
AV_WN32A(dst , \
- AV_RN32A(dst ) + delta_tab->deltas_m10[dyad1]);\
+ (AV_RN32A(dst ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
AV_WN32A(dst + 4 , \
- AV_RN32A(dst + 4 ) + delta_tab->deltas_m10[dyad2]);\
+ (AV_RN32A(dst + 4 ) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
AV_WN32A(dst + row_offset , \
- AV_RN32A(dst + row_offset ) + delta_tab->deltas_m10[dyad1]);\
+ (AV_RN32A(dst + row_offset ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
AV_WN32A(dst + row_offset + 4, \
- AV_RN32A(dst + row_offset + 4) + delta_tab->deltas_m10[dyad2]);\
+ (AV_RN32A(dst + row_offset + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
} else { \
AV_WN16A(dst , \
- AV_RN16A(dst ) + delta_tab->deltas[dyad1]);\
+ (AV_RN16A(dst ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
AV_WN16A(dst + 2 , \
- AV_RN16A(dst + 2 ) + delta_tab->deltas[dyad2]);\
+ (AV_RN16A(dst + 2 ) + delta_tab->deltas[dyad2]) & 0x7F7F);\
AV_WN16A(dst + row_offset , \
- AV_RN16A(dst + row_offset ) + delta_tab->deltas[dyad1]);\
+ (AV_RN16A(dst + row_offset ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
AV_WN16A(dst + row_offset + 2, \
- AV_RN16A(dst + row_offset + 2) + delta_tab->deltas[dyad2]);\
+ (AV_RN16A(dst + row_offset + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
}
diff --git a/gst-libs/ext/libav/libavcodec/ivi_common.c b/gst-libs/ext/libav/libavcodec/ivi_common.c
index db33767..84705c4 100644
--- a/gst-libs/ext/libav/libavcodec/ivi_common.c
+++ b/gst-libs/ext/libav/libavcodec/ivi_common.c
@@ -411,6 +411,11 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
}
if (cbp & 1) { /* block coded ? */
+ if (!band->scan) {
+ av_log(NULL, AV_LOG_ERROR, "Scan pattern is not set.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
scan_pos = -1;
memset(trvec, 0, num_coeffs*sizeof(trvec[0])); /* zero transform vector */
memset(col_flags, 0, sizeof(col_flags)); /* zero column flags */
diff --git a/gst-libs/ext/libav/libavcodec/mpeg12.c b/gst-libs/ext/libav/libavcodec/mpeg12.c
index 65dfe47..436b4cf 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg12.c
+++ b/gst-libs/ext/libav/libavcodec/mpeg12.c
@@ -2223,8 +2223,9 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
s->slice_count = 0;
- if (avctx->extradata && !avctx->frame_number) {
+ if (avctx->extradata && !s->extradata_decoded) {
int ret = decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
+ s->extradata_decoded = 1;
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
return ret;
}
diff --git a/gst-libs/ext/libav/libavcodec/mpeg12.h b/gst-libs/ext/libav/libavcodec/mpeg12.h
index ab0352f..0f9faaf 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg12.h
+++ b/gst-libs/ext/libav/libavcodec/mpeg12.h
@@ -42,6 +42,7 @@ typedef struct Mpeg1Context {
AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator
int sync; ///< Did we reach a sync point like a GOP/SEQ/KEYFrame?
int closed_gop; ///< GOP is closed
+ int extradata_decoded;
} Mpeg1Context;
extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodec.c b/gst-libs/ext/libav/libavcodec/mpegaudiodec.c
index bb1baef..cd0d26d 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudiodec.c
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodec.c
@@ -1632,7 +1632,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
int buf_size = avpkt->size;
MPADecodeContext *s = avctx->priv_data;
uint32_t header;
- int out_size;
+ int ret;
if (buf_size < HEADER_SIZE)
return AVERROR_INVALIDDATA;
@@ -1663,21 +1663,22 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
buf_size= s->frame_size;
}
- out_size = mp_decode_frame(s, NULL, buf, buf_size);
- if (out_size >= 0) {
+ ret = mp_decode_frame(s, NULL, buf, buf_size);
+ if (ret >= 0) {
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
avctx->sample_rate = s->sample_rate;
//FIXME maybe move the other codec info stuff from above here too
} else {
av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n");
- /* Only return an error if the bad frame makes up the whole packet.
- If there is more data in the packet, just consume the bad frame
- instead of returning an error, which would discard the whole
- packet. */
+ /* Only return an error if the bad frame makes up the whole packet or
+ * the error is related to buffer management.
+ * If there is more data in the packet, just consume the bad frame
+ * instead of returning an error, which would discard the whole
+ * packet. */
*got_frame_ptr = 0;
- if (buf_size == avpkt->size)
- return out_size;
+ if (buf_size == avpkt->size || ret != AVERROR_INVALIDDATA)
+ return ret;
}
s->frame_size = 0;
return buf_size;
@@ -1698,7 +1699,7 @@ static int decode_frame_adu(AVCodecContext *avctx, void *data,
int buf_size = avpkt->size;
MPADecodeContext *s = avctx->priv_data;
uint32_t header;
- int len, out_size;
+ int len, out_size, ret = 0;
len = buf_size;
@@ -1735,7 +1736,11 @@ static int decode_frame_adu(AVCodecContext *avctx, void *data,
out_size = buf_size;
else
#endif
- out_size = mp_decode_frame(s, NULL, buf, buf_size);
+ ret = mp_decode_frame(s, NULL, buf, buf_size);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n");
+ return ret;
+ }
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
@@ -1942,7 +1947,10 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
}
ch += m->nb_channels;
- out_size += mp_decode_frame(m, outptr, buf, fsize);
+ if ((ret = mp_decode_frame(m, outptr, buf, fsize)) < 0)
+ return ret;
+
+ out_size += ret;
buf += fsize;
len -= fsize;
diff --git a/gst-libs/ext/libav/libavcodec/svq3.c b/gst-libs/ext/libav/libavcodec/svq3.c
index 3be71a0..ebe4fd9 100644
--- a/gst-libs/ext/libav/libavcodec/svq3.c
+++ b/gst-libs/ext/libav/libavcodec/svq3.c
@@ -409,17 +409,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);
}
}
@@ -487,11 +487,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) {
@@ -499,14 +499,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;
diff --git a/gst-libs/ext/libav/libavcodec/vp5.c b/gst-libs/ext/libav/libavcodec/vp5.c
index 1c6eaa9..05c399c 100644
--- a/gst-libs/ext/libav/libavcodec/vp5.c
+++ b/gst-libs/ext/libav/libavcodec/vp5.c
@@ -49,18 +49,18 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
{
vp56_rac_gets(c, 8);
if(vp56_rac_gets(c, 5) > 5)
- return 0;
+ return AVERROR_INVALIDDATA;
vp56_rac_gets(c, 2);
if (vp56_rac_get(c)) {
av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n");
- return 0;
+ return AVERROR_PATCHWELCOME;
}
rows = vp56_rac_gets(c, 8); /* number of stored macroblock rows */
cols = vp56_rac_gets(c, 8); /* number of stored macroblock cols */
if (!rows || !cols) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid size %dx%d\n",
cols << 4, rows << 4);
- return 0;
+ return AVERROR_INVALIDDATA;
}
vp56_rac_gets(c, 8); /* number of displayed macroblock rows */
vp56_rac_gets(c, 8); /* number of displayed macroblock cols */
@@ -69,11 +69,11 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
16*cols != s->avctx->coded_width ||
16*rows != s->avctx->coded_height) {
avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
- return 2;
+ return VP56_SIZE_CHANGE;
}
} else if (!s->macroblocks)
- return 0;
- return 1;
+ return AVERROR_INVALIDDATA;
+ return 0;
}
static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
diff --git a/gst-libs/ext/libav/libavcodec/vp56.c b/gst-libs/ext/libav/libavcodec/vp56.c
index 3b2ac95..7767461 100644
--- a/gst-libs/ext/libav/libavcodec/vp56.c
+++ b/gst-libs/ext/libav/libavcodec/vp56.c
@@ -513,10 +513,16 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
s->modelp = &s->models[is_alpha];
res = s->parse_header(s, buf, remaining_buf_size, &golden_frame);
- if (!res)
- return -1;
+ if (res < 0) {
+ int i;
+ for (i = 0; i < 4; i++) {
+ if (s->frames[i].data[0])
+ avctx->release_buffer(avctx, &s->frames[i]);
+ }
+ return res;
+ }
- if (res == 2) {
+ if (res == VP56_SIZE_CHANGE) {
int i;
for (i = 0; i < 4; i++) {
if (s->frames[i].data[0])
@@ -535,7 +541,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
return -1;
}
- if (res == 2)
+ if (res == VP56_SIZE_CHANGE)
if (vp56_size_changed(avctx)) {
avctx->release_buffer(avctx, p);
return -1;
diff --git a/gst-libs/ext/libav/libavcodec/vp56.h b/gst-libs/ext/libav/libavcodec/vp56.h
index 0607e0d..770b608 100644
--- a/gst-libs/ext/libav/libavcodec/vp56.h
+++ b/gst-libs/ext/libav/libavcodec/vp56.h
@@ -39,6 +39,8 @@ typedef struct {
int16_t y;
} DECLARE_ALIGNED(4, , VP56mv);
+#define VP56_SIZE_CHANGE 1
+
typedef void (*VP56ParseVectorAdjustment)(VP56Context *s,
VP56mv *vect);
typedef void (*VP56Filter)(VP56Context *s, uint8_t *dst, uint8_t *src,
diff --git a/gst-libs/ext/libav/libavcodec/vp6.c b/gst-libs/ext/libav/libavcodec/vp6.c
index 861a2da..faba49b 100644
--- a/gst-libs/ext/libav/libavcodec/vp6.c
+++ b/gst-libs/ext/libav/libavcodec/vp6.c
@@ -52,7 +52,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
int vrt_shift = 0;
int sub_version;
int rows, cols;
- int res = 1;
+ int res = 0;
int separated_coeff = buf[0] & 1;
s->framep[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80);
@@ -61,11 +61,11 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
sub_version = buf[1] >> 3;
if (sub_version > 8)
- return 0;
+ return AVERROR_INVALIDDATA;
s->filter_header = buf[1] & 0x06;
if (buf[1] & 1) {
- av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n");
- return 0;
+ av_log_missing_feature(s->avctx, "Interlacing", 0);
+ return AVERROR_PATCHWELCOME;
}
if (separated_coeff || !s->filter_header) {
coeff_offset = AV_RB16(buf+2) - 2;
@@ -79,7 +79,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
/* buf[5] is number of displayed macroblock cols */
if (!rows || !cols) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid size %dx%d\n", cols << 4, rows << 4);
- return 0;
+ return AVERROR_INVALIDDATA;
}
if (!s->macroblocks || /* first frame */
@@ -90,7 +90,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
s->avctx->width -= s->avctx->extradata[0] >> 4;
s->avctx->height -= s->avctx->extradata[0] & 0x0F;
}
- res = 2;
+ res = VP56_SIZE_CHANGE;
}
ff_vp56_init_range_decoder(c, buf+6, buf_size-6);
@@ -102,7 +102,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
s->sub_version = sub_version;
} else {
if (!s->sub_version || !s->avctx->coded_width || !s->avctx->coded_height)
- return 0;
+ return AVERROR_INVALIDDATA;
if (separated_coeff || !s->filter_header) {
coeff_offset = AV_RB16(buf+1) - 2;
@@ -146,7 +146,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
if (buf_size < 0) {
if (s->framep[VP56_FRAME_CURRENT]->key_frame)
avcodec_set_dimensions(s->avctx, 0, 0);
- return 0;
+ return AVERROR_INVALIDDATA;
}
if (s->use_huffman) {
s->parse_coeff = vp6_parse_coeff_huffman;
diff --git a/gst-libs/ext/libav/libavcodec/vp8.c b/gst-libs/ext/libav/libavcodec/vp8.c
index 8338198..a16f5ca 100644
--- a/gst-libs/ext/libav/libavcodec/vp8.c
+++ b/gst-libs/ext/libav/libavcodec/vp8.c
@@ -318,6 +318,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
memcpy(s->prob->pred8x8c , vp8_pred8x8c_prob_inter , sizeof(s->prob->pred8x8c));
memcpy(s->prob->mvc , vp8_mv_default_prob , sizeof(s->prob->mvc));
memset(&s->segmentation, 0, sizeof(s->segmentation));
+ memset(&s->lf_delta, 0, sizeof(s->lf_delta));
}
if (!s->macroblocks_base || /* first frame */