Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
243396f06d | ||
![]() |
c7ab9de727 | ||
![]() |
b51c4df35b | ||
![]() |
f9225c2884 | ||
![]() |
6ad4a116a2 | ||
![]() |
3f785a538b | ||
![]() |
a77cf47d88 | ||
![]() |
a7faa1d070 | ||
![]() |
9aa60889f3 | ||
![]() |
636c42de19 | ||
![]() |
f48d1fb167 | ||
![]() |
0e2f415adf | ||
![]() |
a4e277312c | ||
![]() |
c82ae85a8a | ||
![]() |
fd7426ed89 | ||
![]() |
459feb7cce | ||
![]() |
aa41212767 | ||
![]() |
7923490712 | ||
![]() |
371e221d63 | ||
![]() |
44e6cf3f75 | ||
![]() |
4eea330a2a |
4
configure
vendored
4
configure
vendored
@@ -1037,6 +1037,7 @@ HAVE_LIST="
|
|||||||
dlfcn_h
|
dlfcn_h
|
||||||
dlopen
|
dlopen
|
||||||
dos_paths
|
dos_paths
|
||||||
|
dxva_h
|
||||||
ebp_available
|
ebp_available
|
||||||
ebx_available
|
ebx_available
|
||||||
exp2
|
exp2
|
||||||
@@ -2543,6 +2544,7 @@ check_func_headers windows.h VirtualAlloc
|
|||||||
|
|
||||||
check_header conio.h
|
check_header conio.h
|
||||||
check_header dlfcn.h
|
check_header dlfcn.h
|
||||||
|
check_header dxva.h
|
||||||
check_header dxva2api.h
|
check_header dxva2api.h
|
||||||
check_header malloc.h
|
check_header malloc.h
|
||||||
check_header poll.h
|
check_header poll.h
|
||||||
@@ -2794,8 +2796,10 @@ elif enabled gcc; then
|
|||||||
check_cflags -fno-tree-vectorize
|
check_cflags -fno-tree-vectorize
|
||||||
check_cflags -Werror=implicit
|
check_cflags -Werror=implicit
|
||||||
check_cflags -Werror=missing-prototypes
|
check_cflags -Werror=missing-prototypes
|
||||||
|
check_cflags -Werror=return-type
|
||||||
elif enabled clang; then
|
elif enabled clang; then
|
||||||
check_cflags -Qunused-arguments
|
check_cflags -Qunused-arguments
|
||||||
|
check_cflags -Werror=return-type
|
||||||
elif enabled armcc; then
|
elif enabled armcc; then
|
||||||
# 2523: use of inline assembler is deprecated
|
# 2523: use of inline assembler is deprecated
|
||||||
add_cflags -Wrvct,--diag_suppress=2523
|
add_cflags -Wrvct,--diag_suppress=2523
|
||||||
|
@@ -3217,7 +3217,7 @@ static void clear_blocks_c(DCTELEM *blocks)
|
|||||||
|
|
||||||
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
|
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
|
||||||
long i;
|
long i;
|
||||||
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
|
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
|
||||||
long a = *(long*)(src+i);
|
long a = *(long*)(src+i);
|
||||||
long b = *(long*)(dst+i);
|
long b = *(long*)(dst+i);
|
||||||
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
|
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
|
||||||
@@ -3228,7 +3228,7 @@ static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
|
|||||||
|
|
||||||
static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
|
static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
|
||||||
long i;
|
long i;
|
||||||
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
|
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
|
||||||
long a = *(long*)(src1+i);
|
long a = *(long*)(src1+i);
|
||||||
long b = *(long*)(src2+i);
|
long b = *(long*)(src2+i);
|
||||||
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
|
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
|
||||||
@@ -3253,7 +3253,7 @@ static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
|
|||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
#endif
|
#endif
|
||||||
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
|
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
|
||||||
long a = *(long*)(src1+i);
|
long a = *(long*)(src1+i);
|
||||||
long b = *(long*)(src2+i);
|
long b = *(long*)(src2+i);
|
||||||
*(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);
|
*(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);
|
||||||
|
@@ -25,7 +25,14 @@
|
|||||||
|
|
||||||
#define _WIN32_WINNT 0x0600
|
#define _WIN32_WINNT 0x0600
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include "dxva2.h"
|
#include "dxva2.h"
|
||||||
|
#if HAVE_DXVA_H
|
||||||
|
#include <dxva.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "mpegvideo.h"
|
#include "mpegvideo.h"
|
||||||
|
|
||||||
|
@@ -437,7 +437,7 @@ static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], in
|
|||||||
int run_mode=0;
|
int run_mode=0;
|
||||||
|
|
||||||
if(s->ac){
|
if(s->ac){
|
||||||
if(c->bytestream_end - c->bytestream < w*20){
|
if(c->bytestream_end - c->bytestream < w*35){
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
|
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -1799,6 +1799,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
|
|||||||
else
|
else
|
||||||
s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3);
|
s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3);
|
||||||
|
|
||||||
|
if (FFALIGN(s->avctx->width, 16) == s->width &&
|
||||||
|
FFALIGN(s->avctx->height, 16) == s->height) {
|
||||||
|
s->width = s->avctx->width;
|
||||||
|
s->height = s->avctx->height;
|
||||||
|
}
|
||||||
|
|
||||||
if (s->context_initialized
|
if (s->context_initialized
|
||||||
&& ( s->width != s->avctx->width || s->height != s->avctx->height
|
&& ( s->width != s->avctx->width || s->height != s->avctx->height
|
||||||
|| av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) {
|
|| av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) {
|
||||||
|
@@ -279,12 +279,13 @@ static void generate_joint_tables(HYuvContext *s){
|
|||||||
for(i=y=0; y<256; y++){
|
for(i=y=0; y<256; y++){
|
||||||
int len0 = s->len[0][y];
|
int len0 = s->len[0][y];
|
||||||
int limit = VLC_BITS - len0;
|
int limit = VLC_BITS - len0;
|
||||||
if(limit <= 0)
|
if(limit <= 0 || !len0)
|
||||||
continue;
|
continue;
|
||||||
for(u=0; u<256; u++){
|
for(u=0; u<256; u++){
|
||||||
int len1 = s->len[p][u];
|
int len1 = s->len[p][u];
|
||||||
if(len1 > limit)
|
if (len1 > limit || !len1)
|
||||||
continue;
|
continue;
|
||||||
|
assert(i < (1 << VLC_BITS));
|
||||||
len[i] = len0 + len1;
|
len[i] = len0 + len1;
|
||||||
bits[i] = (s->bits[0][y] << len1) + s->bits[p][u];
|
bits[i] = (s->bits[0][y] << len1) + s->bits[p][u];
|
||||||
symbols[i] = (y<<8) + u;
|
symbols[i] = (y<<8) + u;
|
||||||
@@ -306,18 +307,19 @@ static void generate_joint_tables(HYuvContext *s){
|
|||||||
for(i=0, g=-16; g<16; g++){
|
for(i=0, g=-16; g<16; g++){
|
||||||
int len0 = s->len[p0][g&255];
|
int len0 = s->len[p0][g&255];
|
||||||
int limit0 = VLC_BITS - len0;
|
int limit0 = VLC_BITS - len0;
|
||||||
if(limit0 < 2)
|
if (limit0 < 2 || !len0)
|
||||||
continue;
|
continue;
|
||||||
for(b=-16; b<16; b++){
|
for(b=-16; b<16; b++){
|
||||||
int len1 = s->len[p1][b&255];
|
int len1 = s->len[p1][b&255];
|
||||||
int limit1 = limit0 - len1;
|
int limit1 = limit0 - len1;
|
||||||
if(limit1 < 1)
|
if (limit1 < 1 || !len1)
|
||||||
continue;
|
continue;
|
||||||
code = (s->bits[p0][g&255] << len1) + s->bits[p1][b&255];
|
code = (s->bits[p0][g&255] << len1) + s->bits[p1][b&255];
|
||||||
for(r=-16; r<16; r++){
|
for(r=-16; r<16; r++){
|
||||||
int len2 = s->len[2][r&255];
|
int len2 = s->len[2][r&255];
|
||||||
if(len2 > limit1)
|
if (len2 > limit1 || !len2)
|
||||||
continue;
|
continue;
|
||||||
|
assert(i < (1 << VLC_BITS));
|
||||||
len[i] = len0 + len1 + len2;
|
len[i] = len0 + len1 + len2;
|
||||||
bits[i] = (code << len2) + s->bits[2][r&255];
|
bits[i] = (code << len2) + s->bits[2][r&255];
|
||||||
if(s->decorrelate){
|
if(s->decorrelate){
|
||||||
@@ -341,6 +343,7 @@ static void generate_joint_tables(HYuvContext *s){
|
|||||||
static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){
|
static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
int i;
|
int i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
init_get_bits(&gb, src, length*8);
|
init_get_bits(&gb, src, length*8);
|
||||||
|
|
||||||
@@ -356,7 +359,8 @@ printf("%6X, %2d, %3d\n", s->bits[i][j], s->len[i][j], j);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
free_vlc(&s->vlc[i]);
|
free_vlc(&s->vlc[i]);
|
||||||
init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0);
|
if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0)) < 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_joint_tables(s);
|
generate_joint_tables(s);
|
||||||
@@ -368,6 +372,7 @@ static int read_old_huffman_tables(HYuvContext *s){
|
|||||||
#if 1
|
#if 1
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
int i;
|
int i;
|
||||||
|
int ret;
|
||||||
|
|
||||||
init_get_bits(&gb, classic_shift_luma, sizeof(classic_shift_luma)*8);
|
init_get_bits(&gb, classic_shift_luma, sizeof(classic_shift_luma)*8);
|
||||||
if(read_len_table(s->len[0], &gb)<0)
|
if(read_len_table(s->len[0], &gb)<0)
|
||||||
@@ -388,7 +393,8 @@ static int read_old_huffman_tables(HYuvContext *s){
|
|||||||
|
|
||||||
for(i=0; i<3; i++){
|
for(i=0; i<3; i++){
|
||||||
free_vlc(&s->vlc[i]);
|
free_vlc(&s->vlc[i]);
|
||||||
init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0);
|
if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0)) < 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_joint_tables(s);
|
generate_joint_tables(s);
|
||||||
|
@@ -851,7 +851,8 @@ static enum PixelFormat avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask,
|
|||||||
/* find exact color match with smallest size */
|
/* find exact color match with smallest size */
|
||||||
dst_pix_fmt = PIX_FMT_NONE;
|
dst_pix_fmt = PIX_FMT_NONE;
|
||||||
min_dist = 0x7fffffff;
|
min_dist = 0x7fffffff;
|
||||||
for(i = 0;i < PIX_FMT_NB; i++) {
|
/* test only the first 64 pixel formats to avoid undefined behaviour */
|
||||||
|
for (i = 0; i < 64; i++) {
|
||||||
if (pix_fmt_mask & (1ULL << i)) {
|
if (pix_fmt_mask & (1ULL << i)) {
|
||||||
loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt, has_alpha) & loss_mask;
|
loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt, has_alpha) & loss_mask;
|
||||||
if (loss == 0) {
|
if (loss == 0) {
|
||||||
|
@@ -727,7 +727,8 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
|||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
ref_picture, pix_op, qpix_op,
|
ref_picture, pix_op, qpix_op,
|
||||||
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
||||||
}else if(!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) && s->mspel){
|
} else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) &&
|
||||||
|
s->mspel && s->codec_id == CODEC_ID_WMV2) {
|
||||||
ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
|
ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
|
||||||
ref_picture, pix_op,
|
ref_picture, pix_op,
|
||||||
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
||||||
|
@@ -184,17 +184,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
|||||||
}
|
}
|
||||||
if (c->codec_frameheader) {
|
if (c->codec_frameheader) {
|
||||||
int w, h, q;
|
int w, h, q;
|
||||||
if (buf_size < 12) {
|
if (buf_size < RTJPEG_HEADER_SIZE || buf[4] != RTJPEG_HEADER_SIZE ||
|
||||||
|
buf[5] != RTJPEG_FILE_VERSION) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n");
|
av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n");
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
w = AV_RL16(&buf[6]);
|
w = AV_RL16(&buf[6]);
|
||||||
h = AV_RL16(&buf[8]);
|
h = AV_RL16(&buf[8]);
|
||||||
q = buf[10];
|
q = buf[10];
|
||||||
if (!codec_reinit(avctx, w, h, q))
|
if (!codec_reinit(avctx, w, h, q))
|
||||||
return -1;
|
return -1;
|
||||||
buf = &buf[12];
|
buf = &buf[RTJPEG_HEADER_SIZE];
|
||||||
buf_size -= 12;
|
buf_size -= RTJPEG_HEADER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyframe && c->pic.data[0])
|
if (keyframe && c->pic.data[0])
|
||||||
|
@@ -83,7 +83,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
|||||||
unsigned short *pixels = (unsigned short *)s->frame.data[0];
|
unsigned short *pixels = (unsigned short *)s->frame.data[0];
|
||||||
|
|
||||||
int row_ptr = 0;
|
int row_ptr = 0;
|
||||||
int pixel_ptr = 0;
|
int pixel_ptr = -4;
|
||||||
int block_ptr;
|
int block_ptr;
|
||||||
int pixel_x, pixel_y;
|
int pixel_x, pixel_y;
|
||||||
int total_blocks;
|
int total_blocks;
|
||||||
@@ -139,6 +139,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
|||||||
colorA = AV_RB16 (&s->buf[stream_ptr]);
|
colorA = AV_RB16 (&s->buf[stream_ptr]);
|
||||||
stream_ptr += 2;
|
stream_ptr += 2;
|
||||||
while (n_blocks--) {
|
while (n_blocks--) {
|
||||||
|
ADVANCE_BLOCK()
|
||||||
block_ptr = row_ptr + pixel_ptr;
|
block_ptr = row_ptr + pixel_ptr;
|
||||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||||
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
||||||
@@ -147,7 +148,6 @@ static void rpza_decode_stream(RpzaContext *s)
|
|||||||
}
|
}
|
||||||
block_ptr += row_inc;
|
block_ptr += row_inc;
|
||||||
}
|
}
|
||||||
ADVANCE_BLOCK();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -184,6 +184,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
|||||||
color4[2] |= ((21 * ta + 11 * tb) >> 5);
|
color4[2] |= ((21 * ta + 11 * tb) >> 5);
|
||||||
|
|
||||||
while (n_blocks--) {
|
while (n_blocks--) {
|
||||||
|
ADVANCE_BLOCK();
|
||||||
block_ptr = row_ptr + pixel_ptr;
|
block_ptr = row_ptr + pixel_ptr;
|
||||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||||
index = s->buf[stream_ptr++];
|
index = s->buf[stream_ptr++];
|
||||||
@@ -194,12 +195,12 @@ static void rpza_decode_stream(RpzaContext *s)
|
|||||||
}
|
}
|
||||||
block_ptr += row_inc;
|
block_ptr += row_inc;
|
||||||
}
|
}
|
||||||
ADVANCE_BLOCK();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Fill block with 16 colors */
|
/* Fill block with 16 colors */
|
||||||
case 0x00:
|
case 0x00:
|
||||||
|
ADVANCE_BLOCK();
|
||||||
block_ptr = row_ptr + pixel_ptr;
|
block_ptr = row_ptr + pixel_ptr;
|
||||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||||
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
||||||
@@ -213,7 +214,6 @@ static void rpza_decode_stream(RpzaContext *s)
|
|||||||
}
|
}
|
||||||
block_ptr += row_inc;
|
block_ptr += row_inc;
|
||||||
}
|
}
|
||||||
ADVANCE_BLOCK();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Unknown opcode */
|
/* Unknown opcode */
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
|
|
||||||
|
#define RTJPEG_FILE_VERSION 0
|
||||||
|
#define RTJPEG_HEADER_SIZE 12
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int w, h;
|
int w, h;
|
||||||
DSPContext *dsp;
|
DSPContext *dsp;
|
||||||
|
@@ -3328,6 +3328,7 @@ AVCodec vc1_decoder = {
|
|||||||
vc1_decode_frame,
|
vc1_decode_frame,
|
||||||
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
|
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
|
||||||
NULL,
|
NULL,
|
||||||
|
.flush = ff_mpeg_flush,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"),
|
.long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"),
|
||||||
.pix_fmts = ff_hwaccel_pixfmt_list_420
|
.pix_fmts = ff_hwaccel_pixfmt_list_420
|
||||||
};
|
};
|
||||||
@@ -3344,6 +3345,7 @@ AVCodec wmv3_decoder = {
|
|||||||
vc1_decode_frame,
|
vc1_decode_frame,
|
||||||
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
|
CODEC_CAP_DR1 | CODEC_CAP_DELAY,
|
||||||
NULL,
|
NULL,
|
||||||
|
.flush = ff_mpeg_flush,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
|
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
|
||||||
.pix_fmts = ff_hwaccel_pixfmt_list_420
|
.pix_fmts = ff_hwaccel_pixfmt_list_420
|
||||||
};
|
};
|
||||||
|
@@ -123,7 +123,8 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values)
|
int ff_vorbis_ready_floor1_list(AVCodecContext *avccontext,
|
||||||
|
vorbis_floor1_entry *list, int values)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
list[0].sort = 0;
|
list[0].sort = 0;
|
||||||
@@ -147,6 +148,11 @@ void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values)
|
|||||||
for (i = 0; i < values - 1; i++) {
|
for (i = 0; i < values - 1; i++) {
|
||||||
int j;
|
int j;
|
||||||
for (j = i + 1; j < values; j++) {
|
for (j = i + 1; j < values; j++) {
|
||||||
|
if (list[i].x == list[j].x) {
|
||||||
|
av_log(avccontext, AV_LOG_ERROR,
|
||||||
|
"Duplicate value found in floor 1 X coordinates\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
if (list[list[i].sort].x > list[list[j].sort].x) {
|
if (list[list[i].sort].x > list[list[j].sort].x) {
|
||||||
int tmp = list[i].sort;
|
int tmp = list[i].sort;
|
||||||
list[i].sort = list[j].sort;
|
list[i].sort = list[j].sort;
|
||||||
@@ -154,6 +160,7 @@ void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void render_line_unrolled(intptr_t x, uint8_t y, int x1,
|
static inline void render_line_unrolled(intptr_t x, uint8_t y, int x1,
|
||||||
|
@@ -35,7 +35,8 @@ typedef struct {
|
|||||||
uint_fast16_t high;
|
uint_fast16_t high;
|
||||||
} vorbis_floor1_entry;
|
} vorbis_floor1_entry;
|
||||||
|
|
||||||
void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values);
|
int ff_vorbis_ready_floor1_list(AVCodecContext *avccontext,
|
||||||
|
vorbis_floor1_entry *list, int values);
|
||||||
unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n)
|
unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n)
|
||||||
int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num);
|
int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num);
|
||||||
void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
|
void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
|
||||||
|
@@ -550,7 +550,11 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Precalculate order of x coordinates - needed for decode
|
// Precalculate order of x coordinates - needed for decode
|
||||||
ff_vorbis_ready_floor1_list(floor_setup->data.t1.list, floor_setup->data.t1.x_list_dim);
|
if (ff_vorbis_ready_floor1_list(vc->avccontext,
|
||||||
|
floor_setup->data.t1.list,
|
||||||
|
floor_setup->data.t1.x_list_dim)) {
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
} else if (floor_setup->floor_type == 0) {
|
} else if (floor_setup->floor_type == 0) {
|
||||||
uint_fast8_t max_codebook_dim = 0;
|
uint_fast8_t max_codebook_dim = 0;
|
||||||
|
|
||||||
|
@@ -302,7 +302,8 @@ static void create_vorbis_context(vorbis_enc_context *venc,
|
|||||||
};
|
};
|
||||||
fc->list[i].x = a[i - 2];
|
fc->list[i].x = a[i - 2];
|
||||||
}
|
}
|
||||||
ff_vorbis_ready_floor1_list(fc->list, fc->values);
|
if (ff_vorbis_ready_floor1_list(avccontext, fc->list, fc->values))
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
venc->nresidues = 1;
|
venc->nresidues = 1;
|
||||||
venc->residues = av_malloc(sizeof(vorbis_enc_residue) * venc->nresidues);
|
venc->residues = av_malloc(sizeof(vorbis_enc_residue) * venc->nresidues);
|
||||||
|
@@ -44,6 +44,9 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
|
|||||||
AVFilterFormats *ret;
|
AVFilterFormats *ret;
|
||||||
unsigned i, j, k = 0;
|
unsigned i, j, k = 0;
|
||||||
|
|
||||||
|
if (a == b)
|
||||||
|
return a;
|
||||||
|
|
||||||
ret = av_mallocz(sizeof(AVFilterFormats));
|
ret = av_mallocz(sizeof(AVFilterFormats));
|
||||||
|
|
||||||
/* merge list of formats */
|
/* merge list of formats */
|
||||||
|
@@ -1868,10 +1868,11 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
|||||||
if (tracks[i].type == MATROSKA_TRACK_TYPE_SUBTITLE
|
if (tracks[i].type == MATROSKA_TRACK_TYPE_SUBTITLE
|
||||||
&& !tracks[i].stream->discard != AVDISCARD_ALL) {
|
&& !tracks[i].stream->discard != AVDISCARD_ALL) {
|
||||||
index_sub = av_index_search_timestamp(tracks[i].stream, st->index_entries[index].timestamp, AVSEEK_FLAG_BACKWARD);
|
index_sub = av_index_search_timestamp(tracks[i].stream, st->index_entries[index].timestamp, AVSEEK_FLAG_BACKWARD);
|
||||||
if (index_sub >= 0
|
while(index_sub >= 0
|
||||||
&& st->index_entries[index_sub].pos < st->index_entries[index_min].pos
|
&& index_min >= 0
|
||||||
&& st->index_entries[index].timestamp - st->index_entries[index_sub].timestamp < 30000000000/matroska->time_scale)
|
&& tracks[i].stream->index_entries[index_sub].pos < st->index_entries[index_min].pos
|
||||||
index_min = index_sub;
|
&& st->index_entries[index].timestamp - tracks[i].stream->index_entries[index_sub].timestamp < 30000000000/matroska->time_scale)
|
||||||
|
index_min--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1820,9 +1820,6 @@ static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
|
|||||||
#if CONFIG_H263_DECODER
|
#if CONFIG_H263_DECODER
|
||||||
case CODEC_ID_H263:
|
case CODEC_ID_H263:
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_H264_DECODER
|
|
||||||
case CODEC_ID_H264:
|
|
||||||
#endif
|
|
||||||
#if CONFIG_MPEG4_DECODER
|
#if CONFIG_MPEG4_DECODER
|
||||||
case CODEC_ID_MPEG4:
|
case CODEC_ID_MPEG4:
|
||||||
#endif
|
#endif
|
||||||
|
@@ -275,11 +275,11 @@ int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end)
|
|||||||
data++;
|
data++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (data + size >= data_end || data + size < data)
|
if (size < 0 || size >= data_end - data)
|
||||||
return -1;
|
return -1;
|
||||||
data += size;
|
data += size;
|
||||||
t = ff_amf_tag_size(data, data_end);
|
t = ff_amf_tag_size(data, data_end);
|
||||||
if (t < 0 || data + t >= data_end)
|
if (t < 0 || t >= data_end - data)
|
||||||
return -1;
|
return -1;
|
||||||
data += t;
|
data += t;
|
||||||
}
|
}
|
||||||
@@ -308,7 +308,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
|
|||||||
int size = bytestream_get_be16(&data);
|
int size = bytestream_get_be16(&data);
|
||||||
if (!size)
|
if (!size)
|
||||||
break;
|
break;
|
||||||
if (data + size >= data_end || data + size < data)
|
if (size < 0 || size >= data_end - data)
|
||||||
return -1;
|
return -1;
|
||||||
data += size;
|
data += size;
|
||||||
if (size == namelen && !memcmp(data-size, name, namelen)) {
|
if (size == namelen && !memcmp(data-size, name, namelen)) {
|
||||||
@@ -329,7 +329,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
len = ff_amf_tag_size(data, data_end);
|
len = ff_amf_tag_size(data, data_end);
|
||||||
if (len < 0 || data + len >= data_end || data + len < data)
|
if (len < 0 || len >= data_end - data)
|
||||||
return -1;
|
return -1;
|
||||||
data += len;
|
data += len;
|
||||||
}
|
}
|
||||||
@@ -359,7 +359,7 @@ static const char* rtmp_packet_type(int type)
|
|||||||
|
|
||||||
static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *data_end)
|
static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *data_end)
|
||||||
{
|
{
|
||||||
int size;
|
unsigned int size;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if (data >= data_end)
|
if (data >= data_end)
|
||||||
@@ -378,7 +378,7 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d
|
|||||||
} else {
|
} else {
|
||||||
size = bytestream_get_be32(&data);
|
size = bytestream_get_be32(&data);
|
||||||
}
|
}
|
||||||
size = FFMIN(size, 1023);
|
size = FFMIN(size, sizeof(buf) - 1);
|
||||||
memcpy(buf, data, size);
|
memcpy(buf, data, size);
|
||||||
buf[size] = 0;
|
buf[size] = 0;
|
||||||
av_log(ctx, AV_LOG_DEBUG, " string '%s'\n", buf);
|
av_log(ctx, AV_LOG_DEBUG, " string '%s'\n", buf);
|
||||||
@@ -391,22 +391,21 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d
|
|||||||
case AMF_DATA_TYPE_OBJECT:
|
case AMF_DATA_TYPE_OBJECT:
|
||||||
av_log(ctx, AV_LOG_DEBUG, " {\n");
|
av_log(ctx, AV_LOG_DEBUG, " {\n");
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int size = bytestream_get_be16(&data);
|
|
||||||
int t;
|
int t;
|
||||||
memcpy(buf, data, size);
|
size = bytestream_get_be16(&data);
|
||||||
buf[size] = 0;
|
av_strlcpy(buf, data, FFMIN(sizeof(buf), size + 1));
|
||||||
if (!size) {
|
if (!size) {
|
||||||
av_log(ctx, AV_LOG_DEBUG, " }\n");
|
av_log(ctx, AV_LOG_DEBUG, " }\n");
|
||||||
data++;
|
data++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (data + size >= data_end || data + size < data)
|
if (size >= data_end - data)
|
||||||
return;
|
return;
|
||||||
data += size;
|
data += size;
|
||||||
av_log(ctx, AV_LOG_DEBUG, " %s: ", buf);
|
av_log(ctx, AV_LOG_DEBUG, " %s: ", buf);
|
||||||
ff_amf_tag_contents(ctx, data, data_end);
|
ff_amf_tag_contents(ctx, data, data_end);
|
||||||
t = ff_amf_tag_size(data, data_end);
|
t = ff_amf_tag_size(data, data_end);
|
||||||
if (t < 0 || data + t >= data_end)
|
if (t < 0 || t >= data_end - data)
|
||||||
return;
|
return;
|
||||||
data += t;
|
data += t;
|
||||||
}
|
}
|
||||||
|
@@ -498,8 +498,10 @@ static int swf_write_trailer(AVFormatContext *s)
|
|||||||
put_le32(pb, file_size);
|
put_le32(pb, file_size);
|
||||||
url_fseek(pb, swf->duration_pos, SEEK_SET);
|
url_fseek(pb, swf->duration_pos, SEEK_SET);
|
||||||
put_le16(pb, swf->video_frame_number);
|
put_le16(pb, swf->video_frame_number);
|
||||||
|
if (swf->vframes_pos) {
|
||||||
url_fseek(pb, swf->vframes_pos, SEEK_SET);
|
url_fseek(pb, swf->vframes_pos, SEEK_SET);
|
||||||
put_le16(pb, swf->video_frame_number);
|
put_le16(pb, swf->video_frame_number);
|
||||||
|
}
|
||||||
url_fseek(pb, file_size, SEEK_SET);
|
url_fseek(pb, file_size, SEEK_SET);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user