Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b901d1bbc9 | |||
| 3fd30f53a9 | |||
| 80fc1f3399 | |||
| 82db8bcffa | |||
| 232c2ed4a4 | |||
| f0b6705e1a | |||
| 1ba90ce49e | |||
| 4bafd67795 | |||
| 8b93f6676b | |||
| 6d5fca34a6 | |||
| fbfef00e68 | |||
| 9b8d1a183d | |||
| 6d48354321 | |||
| 60956a9dc8 | |||
| 526b5facc5 | |||
| bb1263185b | |||
| aa5ae8b213 | |||
| c0315b74e2 | |||
| 81bac54ab3 | |||
| 482ca8241d | |||
| f3cf94fa47 | |||
| 85732714ce | |||
| dbe194002a | |||
| 9c4d8343bb | |||
| a5fb5a18e3 | |||
| bb70069e6a | |||
| b90796ab86 |
@@ -1,6 +1,33 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 2.6.7:
|
||||
- configure: bump copyright year to 2016
|
||||
- avformat/hls: Even stricter URL checks
|
||||
- avformat/hls: More strict url checks
|
||||
- swscale/utils: Detect and skip unneeded sws_setColorspaceDetails() calls
|
||||
- swscale/yuv2rgb: Increase YUV2RGB table headroom
|
||||
- swscale/yuv2rgb: Factor YUVRGB_TABLE_LUMA_HEADROOM out
|
||||
- avformat/hls: forbid all protocols except http(s) & file
|
||||
- avformat/aviobuf: Fix end check in put_str16()
|
||||
- avformat/asfenc: Check pts
|
||||
- avcodec/mpeg4video: Check time_incr
|
||||
- avcodec/wavpackenc: Check the number of channels
|
||||
- avcodec/wavpackenc: Headers are per channel
|
||||
- avcodec/dvdec: Fix "left shift of negative value -254"
|
||||
- avcodec/mjpegdec: Fix negative shift
|
||||
- avcodec/mss2: Check for repeat overflow
|
||||
- avformat: Add integer fps from 31 to 60 to get_std_framerate()
|
||||
- avcodec/mpegvideo_enc: Clip bits_per_raw_sample within valid range
|
||||
- avfilter/vf_scale: set proper out frame color range
|
||||
- avcodec/motion_est: Fix mv_penalty table size
|
||||
- avcodec/h264_slice: Fix integer overflow in implicit weight computation
|
||||
- swscale/utils: Use normal bilinear scaler if fast cannot be used due to tiny dimensions
|
||||
- avcodec/put_bits: Always check buffer end before writing
|
||||
- mjpegdec: extend check for incompatible values of s->rgb and s->ls
|
||||
- swscale/utils: Fix intermediate format for cascaded alpha downscaling
|
||||
- x86/float_dsp: zero extend offset from ff_scalarproduct_float_sse
|
||||
|
||||
|
||||
version 2.6.6:
|
||||
- nuv: sanitize negative fps rate
|
||||
|
||||
@@ -5748,7 +5748,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2015
|
||||
#define CONFIG_THIS_YEAR 2016
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
+1
-1
@@ -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.6.6
|
||||
PROJECT_NUMBER = 2.6.7
|
||||
|
||||
# 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
|
||||
|
||||
+1
-1
@@ -333,7 +333,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
|
||||
dct_mode * 22 * 64 +
|
||||
(quant + ff_dv_quant_offset[class1]) * 64];
|
||||
}
|
||||
dc = dc << 2;
|
||||
dc = dc * 4;
|
||||
/* convert to unsigned because 128 is not added in the
|
||||
* standard IDCT */
|
||||
dc += 1024;
|
||||
|
||||
@@ -893,7 +893,7 @@ static void implicit_weight_table(H264Context *h, int field)
|
||||
cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure - 1];
|
||||
}
|
||||
if (h->ref_count[0] == 1 && h->ref_count[1] == 1 && !FRAME_MBAFF(h) &&
|
||||
h->ref_list[0][0].poc + h->ref_list[1][0].poc == 2 * cur_poc) {
|
||||
h->ref_list[0][0].poc + (int64_t)h->ref_list[1][0].poc == 2 * cur_poc) {
|
||||
h->use_weight = 0;
|
||||
h->use_weight_chroma = 0;
|
||||
return;
|
||||
@@ -914,7 +914,7 @@ static void implicit_weight_table(H264Context *h, int field)
|
||||
h->chroma_log2_weight_denom = 5;
|
||||
|
||||
for (ref0 = ref_start; ref0 < ref_count0; ref0++) {
|
||||
int poc0 = h->ref_list[0][ref0].poc;
|
||||
int64_t poc0 = h->ref_list[0][ref0].poc;
|
||||
for (ref1 = ref_start; ref1 < ref_count1; ref1++) {
|
||||
int w = 32;
|
||||
if (!h->ref_list[0][ref0].long_ref && !h->ref_list[1][ref1].long_ref) {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
/**
|
||||
* Table of number of bits a motion vector component needs.
|
||||
*/
|
||||
static uint8_t mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
|
||||
static uint8_t mv_penalty[MAX_FCODE+1][MAX_DMV*2+1];
|
||||
|
||||
/**
|
||||
* Minimal fcode that a motion vector component would need.
|
||||
@@ -676,7 +676,7 @@ static av_cold void init_mv_penalty_and_fcode(MpegEncContext *s)
|
||||
int mv;
|
||||
|
||||
for(f_code=1; f_code<=MAX_FCODE; f_code++){
|
||||
for(mv=-MAX_MV; mv<=MAX_MV; mv++){
|
||||
for(mv=-MAX_DMV; mv<=MAX_DMV; mv++){
|
||||
int len;
|
||||
|
||||
if(mv==0) len= ff_mvtab[0][1];
|
||||
@@ -697,7 +697,7 @@ static av_cold void init_mv_penalty_and_fcode(MpegEncContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
mv_penalty[f_code][mv+MAX_MV]= len;
|
||||
mv_penalty[f_code][mv+MAX_DMV]= len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -606,7 +606,8 @@ unk_pixfmt:
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
|
||||
}
|
||||
|
||||
if (s->rgb && !s->lossless && !s->ls) {
|
||||
if ((s->rgb && !s->lossless && !s->ls) ||
|
||||
(!s->rgb && s->ls && s->nb_components > 1)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
@@ -971,7 +972,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
return -1;
|
||||
|
||||
left[i] = buffer[mb_x][i] =
|
||||
mask & (pred + (dc << point_transform));
|
||||
mask & (pred + (dc * (1 << point_transform)));
|
||||
}
|
||||
|
||||
if (s->restart_interval && !--s->restart_count) {
|
||||
|
||||
@@ -906,7 +906,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
|
||||
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
|
||||
c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
|
||||
c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
|
||||
|
||||
get_limits(s, 16*mb_x, 16*mb_y);
|
||||
c->skip=0;
|
||||
@@ -1082,7 +1082,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s,
|
||||
av_assert0(s->quarter_sample==0 || s->quarter_sample==1);
|
||||
|
||||
c->pre_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_pre_cmp);
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
|
||||
|
||||
get_limits(s, 16*mb_x, 16*mb_y);
|
||||
c->skip=0;
|
||||
@@ -1131,7 +1131,7 @@ static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y,
|
||||
const int shift= 1+s->quarter_sample;
|
||||
const int mot_stride = s->mb_stride;
|
||||
const int mot_xy = mb_y*mot_stride + mb_x;
|
||||
uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_MV;
|
||||
uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_DMV;
|
||||
int mv_scale;
|
||||
|
||||
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
|
||||
@@ -1205,8 +1205,8 @@ static inline int check_bidir_mv(MpegEncContext * s,
|
||||
//FIXME better f_code prediction (max mv & distance)
|
||||
//FIXME pointers
|
||||
MotionEstContext * const c= &s->me;
|
||||
uint8_t * const mv_penalty_f= c->mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame
|
||||
uint8_t * const mv_penalty_b= c->mv_penalty[s->b_code] + MAX_MV; // f_code of the prev frame
|
||||
uint8_t * const mv_penalty_f= c->mv_penalty[s->f_code] + MAX_DMV; // f_code of the prev frame
|
||||
uint8_t * const mv_penalty_b= c->mv_penalty[s->b_code] + MAX_DMV; // f_code of the prev frame
|
||||
int stride= c->stride;
|
||||
uint8_t *dest_y = c->scratchpad;
|
||||
uint8_t *ptr;
|
||||
@@ -1419,7 +1419,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y)
|
||||
int mx, my, xmin, xmax, ymin, ymax;
|
||||
int16_t (*mv_table)[2]= s->b_direct_mv_table;
|
||||
|
||||
c->current_mv_penalty= c->mv_penalty[1] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[1] + MAX_DMV;
|
||||
ymin= xmin=(-32)>>shift;
|
||||
ymax= xmax= 31>>shift;
|
||||
|
||||
@@ -1555,11 +1555,11 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
|
||||
if(s->flags & CODEC_FLAG_INTERLACED_ME){
|
||||
//FIXME mb type penalty
|
||||
c->skip=0;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
|
||||
fimin= interlaced_search(s, 0,
|
||||
s->b_field_mv_table[0], s->b_field_select_table[0],
|
||||
s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 0);
|
||||
c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_DMV;
|
||||
bimin= interlaced_search(s, 2,
|
||||
s->b_field_mv_table[1], s->b_field_select_table[1],
|
||||
s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 0);
|
||||
|
||||
@@ -52,7 +52,7 @@ static const uint8_t svcd_scan_offset_placeholder[] = {
|
||||
0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
};
|
||||
|
||||
static uint8_t mv_penalty[MAX_FCODE + 1][MAX_MV * 2 + 1];
|
||||
static uint8_t mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
|
||||
static uint8_t fcode_tab[MAX_MV * 2 + 1];
|
||||
|
||||
static uint8_t uni_mpeg1_ac_vlc_len[64 * 64 * 2];
|
||||
@@ -1051,7 +1051,7 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
|
||||
}
|
||||
|
||||
for (f_code = 1; f_code <= MAX_FCODE; f_code++)
|
||||
for (mv = -MAX_MV; mv <= MAX_MV; mv++) {
|
||||
for (mv = -MAX_DMV; mv <= MAX_DMV; mv++) {
|
||||
int len;
|
||||
|
||||
if (mv == 0) {
|
||||
@@ -1074,7 +1074,7 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
|
||||
2 + bit_size;
|
||||
}
|
||||
|
||||
mv_penalty[f_code][mv + MAX_MV] = len;
|
||||
mv_penalty[f_code][mv + MAX_DMV] = len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s,
|
||||
void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n,
|
||||
int dir);
|
||||
void ff_set_mpeg4_time(MpegEncContext *s);
|
||||
void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
|
||||
int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
|
||||
|
||||
int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb);
|
||||
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
|
||||
|
||||
@@ -1086,7 +1086,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
|
||||
}
|
||||
|
||||
/* write mpeg4 VOP header */
|
||||
void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
{
|
||||
int time_incr;
|
||||
int time_div, time_mod;
|
||||
@@ -1112,6 +1112,12 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
time_mod = FFUMOD(s->time, s->avctx->time_base.den);
|
||||
time_incr = time_div - s->last_time_base;
|
||||
av_assert0(time_incr >= 0);
|
||||
|
||||
// This limits the frame duration to max 1 hour
|
||||
if (time_incr > 3600) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "time_incr %d too large\n", time_incr);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
while (time_incr--)
|
||||
put_bits(&s->pb, 1, 1);
|
||||
|
||||
@@ -1137,6 +1143,8 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
put_bits(&s->pb, 3, s->f_code); /* fcode_for */
|
||||
if (s->pict_type == AV_PICTURE_TYPE_B)
|
||||
put_bits(&s->pb, 3, s->b_code); /* fcode_back */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold void init_uni_dc_tab(void)
|
||||
|
||||
@@ -66,6 +66,7 @@ enum OutputFormat {
|
||||
|
||||
#define MAX_FCODE 7
|
||||
#define MAX_MV 4096
|
||||
#define MAX_DMV (2*MAX_MV)
|
||||
|
||||
#define MAX_THREADS 32
|
||||
#define MAX_PICTURE_COUNT 36
|
||||
@@ -198,7 +199,7 @@ typedef struct MotionEstContext{
|
||||
op_pixels_func (*hpel_avg)[4];
|
||||
qpel_mc_func (*qpel_put)[16];
|
||||
qpel_mc_func (*qpel_avg)[16];
|
||||
uint8_t (*mv_penalty)[MAX_MV*2+1]; ///< amount of bits needed to encode a MV
|
||||
uint8_t (*mv_penalty)[MAX_DMV*2+1]; ///< amount of bits needed to encode a MV
|
||||
uint8_t *current_mv_penalty;
|
||||
int (*sub_motion_search)(struct MpegEncContext * s,
|
||||
int *mx_ptr, int *my_ptr, int dmin,
|
||||
|
||||
@@ -70,7 +70,7 @@ static int sse_mb(MpegEncContext *s);
|
||||
static void denoise_dct_c(MpegEncContext *s, int16_t *block);
|
||||
static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
|
||||
|
||||
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_MV * 2 + 1];
|
||||
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
|
||||
static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
|
||||
|
||||
const AVOption ff_mpv_generic_options[] = {
|
||||
@@ -315,6 +315,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
||||
break;
|
||||
}
|
||||
|
||||
avctx->bits_per_raw_sample = av_clip(avctx->bits_per_raw_sample, 0, 8);
|
||||
s->bit_rate = avctx->bit_rate;
|
||||
s->width = avctx->width;
|
||||
s->height = avctx->height;
|
||||
@@ -3713,9 +3714,11 @@ static int encode_picture(MpegEncContext *s, int picture_number)
|
||||
ff_wmv2_encode_picture_header(s, picture_number);
|
||||
else if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version)
|
||||
ff_msmpeg4_encode_picture_header(s, picture_number);
|
||||
else if (CONFIG_MPEG4_ENCODER && s->h263_pred)
|
||||
ff_mpeg4_encode_picture_header(s, picture_number);
|
||||
else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
|
||||
else if (CONFIG_MPEG4_ENCODER && s->h263_pred) {
|
||||
ret = ff_mpeg4_encode_picture_header(s, picture_number);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
|
||||
ret = ff_rv10_encode_picture_header(s, picture_number);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+6
-1
@@ -209,8 +209,13 @@ static int decode_555(GetByteContext *gB, uint16_t *dst, int stride,
|
||||
last_symbol = b << 8 | bytestream2_get_byte(gB);
|
||||
else if (b > 129) {
|
||||
repeat = 0;
|
||||
while (b-- > 130)
|
||||
while (b-- > 130) {
|
||||
if (repeat >= (INT_MAX >> 8) - 1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "repeat overflow\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
repeat = (repeat << 8) + bytestream2_get_byte(gB) + 1;
|
||||
}
|
||||
if (last_symbol == -2) {
|
||||
int skip = FFMIN((unsigned)repeat, dst + w - p);
|
||||
repeat -= skip;
|
||||
|
||||
+14
-6
@@ -163,9 +163,13 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
|
||||
#ifdef BITSTREAM_WRITER_LE
|
||||
bit_buf |= value << (32 - bit_left);
|
||||
if (n >= bit_left) {
|
||||
av_assert2(s->buf_ptr+3<s->buf_end);
|
||||
AV_WL32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
if (3 < s->buf_end - s->buf_ptr) {
|
||||
AV_WL32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_ERROR, "Internal error, put_bits buffer too small\n");
|
||||
av_assert2(0);
|
||||
}
|
||||
bit_buf = (bit_left == 32) ? 0 : value >> bit_left;
|
||||
bit_left += 32;
|
||||
}
|
||||
@@ -177,9 +181,13 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
|
||||
} else {
|
||||
bit_buf <<= bit_left;
|
||||
bit_buf |= value >> (n - bit_left);
|
||||
av_assert2(s->buf_ptr+3<s->buf_end);
|
||||
AV_WB32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
if (3 < s->buf_end - s->buf_ptr) {
|
||||
AV_WB32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_ERROR, "Internal error, put_bits buffer too small\n");
|
||||
av_assert2(0);
|
||||
}
|
||||
bit_left += 32 - n;
|
||||
bit_buf = value;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){
|
||||
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
|
||||
c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
|
||||
c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
|
||||
c->current_mv_penalty= c->mv_penalty[s->m.f_code=1] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->m.f_code=1] + MAX_DMV;
|
||||
|
||||
c->xmin = - x*block_w - 16+3;
|
||||
c->ymin = - y*block_w - 16+3;
|
||||
|
||||
@@ -128,6 +128,11 @@ static av_cold int wavpack_encode_init(AVCodecContext *avctx)
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
if (avctx->channels > 255) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid channel count: %d\n", avctx->channels);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (!avctx->frame_size) {
|
||||
int block_samples;
|
||||
if (!(avctx->sample_rate & 1))
|
||||
@@ -2882,7 +2887,7 @@ static int wavpack_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
}
|
||||
|
||||
buf_size = s->block_samples * avctx->channels * 8
|
||||
+ 200 /* for headers */;
|
||||
+ 200 * avctx->channels /* for headers */;
|
||||
if ((ret = ff_alloc_packet2(avctx, avpkt, buf_size)) < 0)
|
||||
return ret;
|
||||
buf = avpkt->data;
|
||||
|
||||
@@ -523,6 +523,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
||||
sws_setColorspaceDetails(scale->isws[1], inv_table, in_full,
|
||||
table, out_full,
|
||||
brightness, contrast, saturation);
|
||||
|
||||
av_frame_set_color_range(out, out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG);
|
||||
}
|
||||
|
||||
av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den,
|
||||
|
||||
@@ -925,6 +925,11 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
|
||||
pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts;
|
||||
av_assert0(pts != AV_NOPTS_VALUE);
|
||||
if ( pts < - PREROLL_TIME
|
||||
|| pts > (INT_MAX-3)/10000LL * ASF_INDEXED_INTERVAL - PREROLL_TIME) {
|
||||
av_log(s, AV_LOG_ERROR, "input pts %"PRId64" is invalid\n", pts);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
pts *= 10000;
|
||||
asf->duration = FFMAX(asf->duration, pts + pkt->duration * 10000);
|
||||
|
||||
|
||||
@@ -921,7 +921,7 @@ typedef struct AVStream {
|
||||
/**
|
||||
* Stream information used internally by av_find_stream_info()
|
||||
*/
|
||||
#define MAX_STD_TIMEBASES (30*12+7+6)
|
||||
#define MAX_STD_TIMEBASES (30*12+30+3+6)
|
||||
struct {
|
||||
int64_t last_dts;
|
||||
int64_t duration_gcd;
|
||||
|
||||
@@ -359,6 +359,8 @@ static inline int put_str16(AVIOContext *s, const char *str, const int be)
|
||||
invalid:
|
||||
av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16%s\n", be ? "be" : "le");
|
||||
err = AVERROR(EINVAL);
|
||||
if (!*(q-1))
|
||||
break;
|
||||
}
|
||||
if (be)
|
||||
avio_wb16(s, 0);
|
||||
|
||||
@@ -911,6 +911,23 @@ static void update_options(char **dest, const char *name, void *src)
|
||||
av_freep(dest);
|
||||
}
|
||||
|
||||
static int check_url(const char *url) {
|
||||
const char *proto_name = avio_find_protocol_name(url);
|
||||
|
||||
if (!proto_name)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!av_strstart(proto_name, "http", NULL) && !av_strstart(proto_name, "file", NULL))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':')
|
||||
return 0;
|
||||
else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int open_input(HLSContext *c, struct playlist *pls)
|
||||
{
|
||||
AVDictionary *opts = NULL;
|
||||
@@ -938,6 +955,10 @@ static int open_input(HLSContext *c, struct playlist *pls)
|
||||
seg->url, seg->url_offset, pls->index);
|
||||
|
||||
if (seg->key_type == KEY_NONE) {
|
||||
ret = check_url(seg->url);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = ffurl_open(&pls->input, seg->url, AVIO_FLAG_READ,
|
||||
&pls->parent->interrupt_callback, &opts);
|
||||
|
||||
@@ -945,6 +966,10 @@ static int open_input(HLSContext *c, struct playlist *pls)
|
||||
char iv[33], key[33], url[MAX_URL_SIZE];
|
||||
if (strcmp(seg->key, pls->key_url)) {
|
||||
URLContext *uc;
|
||||
ret = check_url(seg->key);
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ,
|
||||
&pls->parent->interrupt_callback, &opts2) == 0) {
|
||||
if (ffurl_read_complete(uc, pls->key, sizeof(pls->key))
|
||||
|
||||
+7
-3
@@ -2824,10 +2824,14 @@ static int get_std_framerate(int i)
|
||||
return (i + 1) * 1001;
|
||||
i -= 30*12;
|
||||
|
||||
if (i < 7)
|
||||
return ((const int[]) { 40, 48, 50, 60, 80, 120, 240})[i] * 1001 * 12;
|
||||
if (i < 30)
|
||||
return (i + 31) * 1001 * 12;
|
||||
i -= 30;
|
||||
|
||||
i -= 7;
|
||||
if (i < 3)
|
||||
return ((const int[]) { 80, 120, 240})[i] * 1001 * 12;
|
||||
|
||||
i -= 3;
|
||||
|
||||
return ((const int[]) { 24, 30, 60, 12, 15, 48 })[i] * 1000 * 12;
|
||||
}
|
||||
|
||||
@@ -332,10 +332,10 @@ VECTOR_FMUL_REVERSE
|
||||
; float scalarproduct_float_sse(const float *v1, const float *v2, int len)
|
||||
INIT_XMM sse
|
||||
cglobal scalarproduct_float, 3,3,2, v1, v2, offset
|
||||
shl offsetd, 2
|
||||
add v1q, offsetq
|
||||
add v2q, offsetq
|
||||
neg offsetq
|
||||
shl offsetq, 2
|
||||
sub v1q, offsetq
|
||||
sub v2q, offsetq
|
||||
xorps xmm0, xmm0
|
||||
.loop:
|
||||
movaps xmm1, [v1q+offsetq]
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
|
||||
#define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long
|
||||
|
||||
#define YUVRGB_TABLE_HEADROOM 256
|
||||
#define YUVRGB_TABLE_HEADROOM 512
|
||||
#define YUVRGB_TABLE_LUMA_HEADROOM 512
|
||||
|
||||
#define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE
|
||||
|
||||
|
||||
+27
-4
@@ -825,8 +825,6 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
|
||||
const AVPixFmtDescriptor *desc_dst;
|
||||
const AVPixFmtDescriptor *desc_src;
|
||||
int need_reinit = 0;
|
||||
memmove(c->srcColorspaceTable, inv_table, sizeof(int) * 4);
|
||||
memmove(c->dstColorspaceTable, table, sizeof(int) * 4);
|
||||
|
||||
handle_formats(c);
|
||||
desc_dst = av_pix_fmt_desc_get(c->dstFormat);
|
||||
@@ -837,11 +835,24 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
|
||||
if(!isYUV(c->srcFormat) && !isGray(c->srcFormat))
|
||||
srcRange = 0;
|
||||
|
||||
if (c->srcRange != srcRange ||
|
||||
c->dstRange != dstRange ||
|
||||
c->brightness != brightness ||
|
||||
c->contrast != contrast ||
|
||||
c->saturation != saturation ||
|
||||
memcmp(c->srcColorspaceTable, inv_table, sizeof(int) * 4) ||
|
||||
memcmp(c->dstColorspaceTable, table, sizeof(int) * 4)
|
||||
)
|
||||
need_reinit = 1;
|
||||
|
||||
memmove(c->srcColorspaceTable, inv_table, sizeof(int) * 4);
|
||||
memmove(c->dstColorspaceTable, table, sizeof(int) * 4);
|
||||
|
||||
|
||||
|
||||
c->brightness = brightness;
|
||||
c->contrast = contrast;
|
||||
c->saturation = saturation;
|
||||
if (c->srcRange != srcRange || c->dstRange != dstRange)
|
||||
need_reinit = 1;
|
||||
c->srcRange = srcRange;
|
||||
c->dstRange = dstRange;
|
||||
|
||||
@@ -856,6 +867,9 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
|
||||
c->dstFormatBpp = av_get_bits_per_pixel(desc_dst);
|
||||
c->srcFormatBpp = av_get_bits_per_pixel(desc_src);
|
||||
|
||||
if (!need_reinit)
|
||||
return 0;
|
||||
|
||||
if (!isYUV(c->dstFormat) && !isGray(c->dstFormat)) {
|
||||
ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness,
|
||||
contrast, saturation);
|
||||
@@ -1052,6 +1066,12 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
srcW, srcH, dstW, dstH);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (flags & SWS_FAST_BILINEAR) {
|
||||
if (srcW < 8 || dstW < 8) {
|
||||
flags ^= SWS_FAST_BILINEAR | SWS_BILINEAR;
|
||||
c->flags = flags;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dstFilter)
|
||||
dstFilter = &dummyFilter;
|
||||
@@ -1528,6 +1548,9 @@ fail: // FIXME replace things by appropriate error codes
|
||||
int tmpH = sqrt(srcH * (int64_t)dstH);
|
||||
enum AVPixelFormat tmpFormat = AV_PIX_FMT_YUV420P;
|
||||
|
||||
if (isALPHA(srcFormat))
|
||||
tmpFormat = AV_PIX_FMT_YUVA420P;
|
||||
|
||||
if (srcW*(int64_t)srcH <= 4LL*dstW*dstH)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
|
||||
+45
-44
@@ -776,7 +776,8 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
uint16_t *y_table16;
|
||||
uint32_t *y_table32;
|
||||
int i, base, rbase, gbase, bbase, av_uninit(abase), needAlpha;
|
||||
const int yoffs = fullRange ? 384 : 326;
|
||||
const int yoffs = (fullRange ? 384 : 326) + YUVRGB_TABLE_LUMA_HEADROOM;
|
||||
const int table_plane_size = 1024 + 2*YUVRGB_TABLE_LUMA_HEADROOM;
|
||||
|
||||
int64_t crv = inv_table[0];
|
||||
int64_t cbu = inv_table[1];
|
||||
@@ -833,10 +834,10 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
return AVERROR(ENOMEM);
|
||||
switch (bpp) {
|
||||
case 1:
|
||||
ALLOC_YUV_TABLE(1024);
|
||||
ALLOC_YUV_TABLE(table_plane_size);
|
||||
y_table = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024 - 110; i++) {
|
||||
yb = -(384 << 16) - YUVRGB_TABLE_LUMA_HEADROOM*cy - oy;
|
||||
for (i = 0; i < table_plane_size - 110; i++) {
|
||||
y_table[i + 110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7;
|
||||
yb += cy;
|
||||
}
|
||||
@@ -848,60 +849,60 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
rbase = isRgb ? 3 : 0;
|
||||
gbase = 1;
|
||||
bbase = isRgb ? 0 : 3;
|
||||
ALLOC_YUV_TABLE(1024 * 3);
|
||||
ALLOC_YUV_TABLE(table_plane_size * 3);
|
||||
y_table = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024 - 110; i++) {
|
||||
yb = -(384 << 16) - YUVRGB_TABLE_LUMA_HEADROOM*cy - oy;
|
||||
for (i = 0; i < table_plane_size - 110; i++) {
|
||||
int yval = av_clip_uint8((yb + 0x8000) >> 16);
|
||||
y_table[i + 110] = (yval >> 7) << rbase;
|
||||
y_table[i + 37 + 1024] = ((yval + 43) / 85) << gbase;
|
||||
y_table[i + 110 + 2048] = (yval >> 7) << bbase;
|
||||
y_table[i + 37 + table_plane_size] = ((yval + 43) / 85) << gbase;
|
||||
y_table[i + 110 + 2*table_plane_size] = (yval >> 7) << bbase;
|
||||
yb += cy;
|
||||
}
|
||||
fill_table(c->table_rV, 1, crv, y_table + yoffs);
|
||||
fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
|
||||
fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
|
||||
fill_table(c->table_gU, 1, cgu, y_table + yoffs + table_plane_size);
|
||||
fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2*table_plane_size);
|
||||
fill_gv_table(c->table_gV, 1, cgv);
|
||||
break;
|
||||
case 8:
|
||||
rbase = isRgb ? 5 : 0;
|
||||
gbase = isRgb ? 2 : 3;
|
||||
bbase = isRgb ? 0 : 6;
|
||||
ALLOC_YUV_TABLE(1024 * 3);
|
||||
ALLOC_YUV_TABLE(table_plane_size * 3);
|
||||
y_table = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024 - 38; i++) {
|
||||
yb = -(384 << 16) - YUVRGB_TABLE_LUMA_HEADROOM*cy - oy;
|
||||
for (i = 0; i < table_plane_size - 38; i++) {
|
||||
int yval = av_clip_uint8((yb + 0x8000) >> 16);
|
||||
y_table[i + 16] = ((yval + 18) / 36) << rbase;
|
||||
y_table[i + 16 + 1024] = ((yval + 18) / 36) << gbase;
|
||||
y_table[i + 37 + 2048] = ((yval + 43) / 85) << bbase;
|
||||
y_table[i + 16 + table_plane_size] = ((yval + 18) / 36) << gbase;
|
||||
y_table[i + 37 + 2*table_plane_size] = ((yval + 43) / 85) << bbase;
|
||||
yb += cy;
|
||||
}
|
||||
fill_table(c->table_rV, 1, crv, y_table + yoffs);
|
||||
fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
|
||||
fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
|
||||
fill_table(c->table_gU, 1, cgu, y_table + yoffs + table_plane_size);
|
||||
fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2*table_plane_size);
|
||||
fill_gv_table(c->table_gV, 1, cgv);
|
||||
break;
|
||||
case 12:
|
||||
rbase = isRgb ? 8 : 0;
|
||||
gbase = 4;
|
||||
bbase = isRgb ? 0 : 8;
|
||||
ALLOC_YUV_TABLE(1024 * 3 * 2);
|
||||
ALLOC_YUV_TABLE(table_plane_size * 3 * 2);
|
||||
y_table16 = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024; i++) {
|
||||
yb = -(384 << 16) - YUVRGB_TABLE_LUMA_HEADROOM*cy - oy;
|
||||
for (i = 0; i < table_plane_size; i++) {
|
||||
uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
|
||||
y_table16[i] = (yval >> 4) << rbase;
|
||||
y_table16[i + 1024] = (yval >> 4) << gbase;
|
||||
y_table16[i + 2048] = (yval >> 4) << bbase;
|
||||
y_table16[i + table_plane_size] = (yval >> 4) << gbase;
|
||||
y_table16[i + 2*table_plane_size] = (yval >> 4) << bbase;
|
||||
yb += cy;
|
||||
}
|
||||
if (isNotNe)
|
||||
for (i = 0; i < 1024 * 3; i++)
|
||||
for (i = 0; i < table_plane_size * 3; i++)
|
||||
y_table16[i] = av_bswap16(y_table16[i]);
|
||||
fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
|
||||
fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
|
||||
fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
|
||||
fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + table_plane_size);
|
||||
fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2*table_plane_size);
|
||||
fill_gv_table(c->table_gV, 2, cgv);
|
||||
break;
|
||||
case 15:
|
||||
@@ -909,30 +910,30 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
rbase = isRgb ? bpp - 5 : 0;
|
||||
gbase = 5;
|
||||
bbase = isRgb ? 0 : (bpp - 5);
|
||||
ALLOC_YUV_TABLE(1024 * 3 * 2);
|
||||
ALLOC_YUV_TABLE(table_plane_size * 3 * 2);
|
||||
y_table16 = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024; i++) {
|
||||
yb = -(384 << 16) - YUVRGB_TABLE_LUMA_HEADROOM*cy - oy;
|
||||
for (i = 0; i < table_plane_size; i++) {
|
||||
uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
|
||||
y_table16[i] = (yval >> 3) << rbase;
|
||||
y_table16[i + 1024] = (yval >> (18 - bpp)) << gbase;
|
||||
y_table16[i + 2048] = (yval >> 3) << bbase;
|
||||
y_table16[i + table_plane_size] = (yval >> (18 - bpp)) << gbase;
|
||||
y_table16[i + 2*table_plane_size] = (yval >> 3) << bbase;
|
||||
yb += cy;
|
||||
}
|
||||
if (isNotNe)
|
||||
for (i = 0; i < 1024 * 3; i++)
|
||||
for (i = 0; i < table_plane_size * 3; i++)
|
||||
y_table16[i] = av_bswap16(y_table16[i]);
|
||||
fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
|
||||
fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
|
||||
fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
|
||||
fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + table_plane_size);
|
||||
fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2*table_plane_size);
|
||||
fill_gv_table(c->table_gV, 2, cgv);
|
||||
break;
|
||||
case 24:
|
||||
case 48:
|
||||
ALLOC_YUV_TABLE(1024);
|
||||
ALLOC_YUV_TABLE(table_plane_size);
|
||||
y_table = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024; i++) {
|
||||
yb = -(384 << 16) - YUVRGB_TABLE_LUMA_HEADROOM*cy - oy;
|
||||
for (i = 0; i < table_plane_size; i++) {
|
||||
y_table[i] = av_clip_uint8((yb + 0x8000) >> 16);
|
||||
yb += cy;
|
||||
}
|
||||
@@ -951,20 +952,20 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
|
||||
if (!needAlpha)
|
||||
abase = (base + 24) & 31;
|
||||
ALLOC_YUV_TABLE(1024 * 3 * 4);
|
||||
ALLOC_YUV_TABLE(table_plane_size * 3 * 4);
|
||||
y_table32 = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024; i++) {
|
||||
yb = -(384 << 16) - YUVRGB_TABLE_LUMA_HEADROOM*cy - oy;
|
||||
for (i = 0; i < table_plane_size; i++) {
|
||||
unsigned yval = av_clip_uint8((yb + 0x8000) >> 16);
|
||||
y_table32[i] = (yval << rbase) +
|
||||
(needAlpha ? 0 : (255u << abase));
|
||||
y_table32[i + 1024] = yval << gbase;
|
||||
y_table32[i + 2048] = yval << bbase;
|
||||
y_table32[i + table_plane_size] = yval << gbase;
|
||||
y_table32[i + 2*table_plane_size] = yval << bbase;
|
||||
yb += cy;
|
||||
}
|
||||
fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
|
||||
fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024);
|
||||
fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048);
|
||||
fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + table_plane_size);
|
||||
fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2*table_plane_size);
|
||||
fill_gv_table(c->table_gV, 4, cgv);
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user