Commit 15285d8f authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master: (22 commits)
  arm: remove disabled function dct_unquantize_h263_inter_iwmmxt()
  Remove commented-out call to non-existing function print_pow1().
  Do not decode RV30 files if the extradata is too small
  flashsv: split flashsv_decode_block() off from flashsv_decode_frame().
  ppc: remove disabled code
  libspeexdec: Drop const qualifier to silence compiler warning.
  libopenjpeg: Drop const qualifier to silence compiler warning.
  alac: Remove unused dummy code.
  Remove unused structs and tables.
  vaapi: do not assert on value read from input bitstream
  flashsvenc: replace bitstream description by a link to the specification
  flashsvenc: drop unnecessary cast
  flashsvenc: improve some variable names and fix corresponding comments
  flashsvenc: merge two consecutive if-conditions
  flashsvenc: merge variable declarations and initializations
  flashsvenc: convert some debug av_log() to av_dlog()
  flashsvenc: whitespace cosmetics
  flashsvenc: drop some unnecessary parentheses
  flashsvenc: fix some comment typos
  aacps: skip some memcpy() if src and dst would be equal
  ...

Conflicts:
	libavcodec/vaapi_mpeg2.c
	libavformat/aviobuf.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents c31a5b23 8342a826
......@@ -813,14 +813,17 @@ static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2
const float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;
//Remapping
memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0]));
memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0]));
memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0]));
memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0]));
memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0]));
memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0]));
memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0]));
memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0]));
if (ps->num_env_old) {
memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0]));
memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0]));
memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0]));
memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0]));
memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0]));
memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0]));
memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0]));
memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0]));
}
if (is34) {
remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
......
......@@ -284,20 +284,9 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
buffer_out[i+1] = val;
}
#if 0
/* 4 and 8 are very common cases (the only ones i've seen). these
* should be unrolled and optimized
*/
if (predictor_coef_num == 4) {
/* FIXME: optimized general case */
return;
}
if (predictor_coef_table == 8) {
/* FIXME: optimized general case */
return;
}
#endif
/* general case */
if (predictor_coef_num > 0) {
......
......@@ -93,29 +93,9 @@ static void dct_unquantize_h263_intra_iwmmxt(MpegEncContext *s,
block_orig[0] = level;
}
#if 0
static void dct_unquantize_h263_inter_iwmmxt(MpegEncContext *s,
DCTELEM *block, int n, int qscale)
{
int nCoeffs;
assert(s->block_last_index[n]>=0);
if(s->ac_pred)
nCoeffs=63;
else
nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
ippiQuantInvInter_Compact_H263_16s_I(block, nCoeffs+1, qscale);
}
#endif
void MPV_common_init_iwmmxt(MpegEncContext *s)
{
if (!(mm_flags & AV_CPU_FLAG_IWMMXT)) return;
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt;
#if 0
s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_iwmmxt;
#endif
}
......@@ -75,18 +75,7 @@ static const uint8_t lps_state[64]= {
33,33,34,34,35,35,35,36,
36,36,37,37,37,38,38,63,
};
#if 0
const uint8_t ff_h264_norm_shift_old[128]= {
7,6,5,5,4,4,4,4,3,3,3,3,3,3,3,3,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
#endif
const uint8_t ff_h264_norm_shift[512]= {
9,8,7,7,6,6,6,6,5,5,5,5,5,5,5,5,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
......
......@@ -71,6 +71,45 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx)
}
static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
GetBitContext *gb, int block_size,
int width, int height, int x_pos, int y_pos)
{
struct FlashSVContext *s = avctx->priv_data;
uint8_t *line = s->tmpblock;
int k;
int ret = inflateReset(&s->zstream);
if (ret != Z_OK) {
//return -1;
}
s->zstream.next_in = avpkt->data + get_bits_count(gb) / 8;
s->zstream.avail_in = block_size;
s->zstream.next_out = s->tmpblock;
s->zstream.avail_out = s->block_size * 3;
ret = inflate(&s->zstream, Z_FINISH);
if (ret == Z_DATA_ERROR) {
av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n");
inflateSync(&s->zstream);
ret = inflate(&s->zstream, Z_FINISH);
}
if (ret != Z_OK && ret != Z_STREAM_END) {
//return -1;
}
/* Flash Screen Video stores the image upside down, so copy
* lines to destination in reverse order. */
for (k = 1; k <= height; k++) {
memcpy(s->frame.data[0] + x_pos * 3 +
(s->image_height - y_pos - k) * s->frame.linesize[0],
line, width * 3);
/* advance source pointer to next line */
line += width * 3;
}
skip_bits_long(gb, 8 * block_size); /* skip the consumed bits */
return 0;
}
static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
......@@ -159,41 +198,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
/* skip unchanged blocks, which have size 0 */
if (size) {
/* decompress block */
uint8_t *line = s->tmpblock;
int k;
int ret = inflateReset(&s->zstream);
if (ret != Z_OK) {
av_log(avctx, AV_LOG_ERROR,
"error in decompression (reset) of block %dx%d\n", i, j);
/* return -1; */
}
s->zstream.next_in = avpkt->data + get_bits_count(&gb) / 8;
s->zstream.avail_in = size;
s->zstream.next_out = s->tmpblock;
s->zstream.avail_out = s->block_size * 3;
ret = inflate(&s->zstream, Z_FINISH);
if (ret == Z_DATA_ERROR) {
av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n");
inflateSync(&s->zstream);
ret = inflate(&s->zstream, Z_FINISH);
}
if (ret != Z_OK && ret != Z_STREAM_END) {
if (flashsv_decode_block(avctx, avpkt, &gb, size,
cur_blk_width, cur_blk_height,
x_pos, y_pos))
av_log(avctx, AV_LOG_ERROR,
"error in decompression of block %dx%d: %d\n", i, j, ret);
/* return -1; */
}
/* Flash Screen Video stores the image upside down, so copy
* lines to destination in reverse order. */
for (k = 1; k <= cur_blk_height; k++) {
memcpy(s->frame.data[0] + x_pos * 3 +
(s->image_height - y_pos - k) * s->frame.linesize[0],
line, cur_blk_width * 3);
/* advance source pointer to next line */
line += cur_blk_width * 3;
}
skip_bits_long(&gb, 8 * size); /* skip the consumed bits */
"error in decompression of block %dx%d\n", i, j);
}
}
}
......
......@@ -27,31 +27,21 @@
* Flash Screen Video encoder
* @author Alex Beregszaszi
* @author Benjamin Larsson
*
* A description of the bitstream format for Flash Screen Video version 1/2
* is part of the SWF File Format Specification (version 10), which can be
* downloaded from http://www.adobe.com/devnet/swf.html.
*/
/* Bitstream description
* The picture is divided into blocks that are zlib-compressed.
*
* The decoder is fed complete frames, the frameheader contains:
* 4bits of block width
* 12bits of frame width
* 4bits of block height
* 12bits of frame height
*
* Directly after the header are the compressed blocks. The blocks
* have their compressed size represented with 16bits in the beginig.
* If the size = 0 then the block is unchanged from the previous frame.
* All blocks are decompressed until the buffer is consumed.
*
* Encoding ideas, a basic encoder would just use a fixed block size.
* Block sizes can be multipels of 16, from 16 to 256. The blocks don't
/*
* Encoding ideas: A basic encoder would just use a fixed block size.
* Block sizes can be multiples of 16, from 16 to 256. The blocks don't
* have to be quadratic. A brute force search with a set of different
* block sizes should give a better result than to just use a fixed size.
*/
/* TODO:
* Don't reencode the frame in brute force mode if the frame is a dupe. Speed up.
* Make the difference check faster.
*
* TODO:
* Don't reencode the frame in brute force mode if the frame is a dupe.
* Speed up. Make the difference check faster.
*/
#include <stdio.h>
......@@ -85,8 +75,8 @@ static int copy_region_enc(uint8_t *sptr, uint8_t *dptr, int dx, int dy,
int diff = 0;
for (i = dx + h; i > dx; i--) {
nsptr = sptr + (i * stride) + dy * 3;
npfptr = pfptr + (i * stride) + dy * 3;
nsptr = sptr + i * stride + dy * 3;
npfptr = pfptr + i * stride + dy * 3;
for (j = 0; j < w * 3; j++) {
diff |= npfptr[j] ^ nsptr[j];
dptr[j] = nsptr[j];
......@@ -104,13 +94,14 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx)
s->avctx = avctx;
if ((avctx->width > 4095) || (avctx->height > 4095)) {
av_log(avctx, AV_LOG_ERROR, "Input dimensions too large, input must be max 4096x4096 !\n");
if (avctx->width > 4095 || avctx->height > 4095) {
av_log(avctx, AV_LOG_ERROR,
"Input dimensions too large, input must be max 4096x4096 !\n");
return AVERROR_INVALIDDATA;
}
// Needed if zlib unused or init aborted before deflateInit
memset(&(s->zstream), 0, sizeof(z_stream));
memset(&s->zstream, 0, sizeof(z_stream));
s->last_key_frame = 0;
......@@ -141,9 +132,9 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf,
init_put_bits(&pb, buf, buf_size * 8);
put_bits(&pb, 4, (block_width / 16) - 1);
put_bits(&pb, 4, block_width / 16 - 1);
put_bits(&pb, 12, s->image_width);
put_bits(&pb, 4, (block_height / 16) - 1);
put_bits(&pb, 4, block_height / 16 - 1);
put_bits(&pb, 12, s->image_height);
flush_put_bits(&pb);
buf_pos = 4;
......@@ -156,37 +147,36 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf,
/* loop over all block columns */
for (j = 0; j < v_blocks + (v_part ? 1 : 0); j++) {
int hp = j * block_height; // horiz position in frame
int hs = (j < v_blocks) ? block_height : v_part; // size of block
int y_pos = j * block_height; // vertical position in frame
int cur_blk_height = (j < v_blocks) ? block_height : v_part;
/* loop over all block rows */
for (i = 0; i < h_blocks + (h_part ? 1 : 0); i++) {
int wp = i * block_width; // vert position in frame
int ws = (i < h_blocks) ? block_width : h_part; // size of block
int x_pos = i * block_width; // horizontal position in frame
int cur_blk_width = (i < h_blocks) ? block_width : h_part;
int ret = Z_OK;
uint8_t *ptr;
ptr = buf + buf_pos;
uint8_t *ptr = buf + buf_pos;
/* copy the block to the temp buffer before compression
* (if it differs from the previous frame's block) */
res = copy_region_enc(p->data[0], s->tmpblock,
s->image_height - (hp + hs + 1),
wp, hs, ws, p->linesize[0], previous_frame);
s->image_height - (y_pos + cur_blk_height + 1),
x_pos, cur_blk_height, cur_blk_width,
p->linesize[0], previous_frame);
if (res || *I_frame) {
unsigned long zsize;
zsize = 3 * block_width * block_height;
ret = compress2(ptr + 2, &zsize, s->tmpblock, 3 * ws * hs, 9);
unsigned long zsize = 3 * block_width * block_height;
ret = compress2(ptr + 2, &zsize, s->tmpblock,
3 * cur_blk_width * cur_blk_height, 9);
//ret = deflateReset(&(s->zstream));
//ret = deflateReset(&s->zstream);
if (ret != Z_OK)
av_log(s->avctx, AV_LOG_ERROR, "error while compressing block %dx%d\n", i, j);
av_log(s->avctx, AV_LOG_ERROR,
"error while compressing block %dx%d\n", i, j);
bytestream_put_be16(&ptr, (unsigned int) zsize);
bytestream_put_be16(&ptr, zsize);
buf_pos += zsize + 2;
//av_log(avctx, AV_LOG_ERROR, "buf_pos = %d\n", buf_pos);
av_dlog(s->avctx, "buf_pos = %d\n", buf_pos);
} else {
pred_blocks++;
bytestream_put_be16(&ptr, 0);
......@@ -213,7 +203,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
uint8_t *pfptr;
int res;
int I_frame = 0;
int opt_w, opt_h;
int opt_w = 4, opt_h = 4;
*p = *pict;
......@@ -228,42 +218,40 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
}
if (p->linesize[0] < 0)
pfptr = s->previous_frame - ((s->image_height - 1) * p->linesize[0]);
pfptr = s->previous_frame - (s->image_height - 1) * p->linesize[0];
else
pfptr = s->previous_frame;
/* Check the placement of keyframes */
if (avctx->gop_size > 0) {
if (avctx->frame_number >= s->last_key_frame + avctx->gop_size) {
I_frame = 1;
}
if (avctx->gop_size > 0 &&
avctx->frame_number >= s->last_key_frame + avctx->gop_size) {
I_frame = 1;
}
opt_w = 4;
opt_h = 4;
if (buf_size < s->image_width*s->image_height*3) {
if (buf_size < s->image_width * s->image_height * 3) {
//Conservative upper bound check for compressed data
av_log(avctx, AV_LOG_ERROR, "buf_size %d < %d\n",
buf_size, s->image_width * s->image_height * 3);
return -1;
}
res = encode_bitstream(s, p, buf, buf_size, opt_w * 16, opt_h * 16, pfptr, &I_frame);
res = encode_bitstream(s, p, buf, buf_size, opt_w * 16, opt_h * 16,
pfptr, &I_frame);
//save the current frame
if (p->linesize[0] > 0)
memcpy(s->previous_frame, p->data[0], s->image_height * p->linesize[0]);
else
memcpy(s->previous_frame, p->data[0] + p->linesize[0] * (s->image_height - 1),
memcpy(s->previous_frame,
p->data[0] + p->linesize[0] * (s->image_height - 1),
s->image_height * FFABS(p->linesize[0]));
//mark the frame type so the muxer can mux it correctly
if (I_frame) {
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
s->last_key_frame = avctx->frame_number;
av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n", avctx->frame_number);
av_dlog(avctx, "Inserting keyframe at frame %d\n", avctx->frame_number);
} else {
p->pict_type = AV_PICTURE_TYPE_P;
p->key_frame = 0;
......@@ -278,7 +266,7 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx)
{
FlashSVContext *s = avctx->priv_data;
deflateEnd(&(s->zstream));
deflateEnd(&s->zstream);
av_free(s->encbuffer);
av_free(s->previous_frame);
......
......@@ -62,7 +62,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
LibOpenJPEGContext *ctx = avctx->priv_data;
AVFrame *picture = &ctx->image, *output = data;
......
......@@ -96,7 +96,7 @@ static int libspeex_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
LibSpeexContext *s = avctx->priv_data;
int16_t *output = data, *end;
......
......@@ -1258,29 +1258,6 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
return 0;
}
#if 0
static int valid_marker_list[] =
{
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f */
/* 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 1 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 2 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 3 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 4 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 5 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 6 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 7 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 8 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 9 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* a */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* b */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
}
#endif
/* return the 8 bit start code value and update the search
state. Return -1 if no start code found */
static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)
......
......@@ -315,8 +315,6 @@ static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
int tmp1[32];
int *out;
// print_pow1(samples, 1152);
offset = s->samples_offset[ch];
out = &s->sb_samples[ch][0][0][0];
for(j=0;j<36;j++) {
......@@ -360,8 +358,6 @@ static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
}
}
s->samples_offset[ch] = offset;
// print_pow(s->sb_samples, 1152);
}
static void compute_scale_factors(unsigned char scale_code[SBLIMIT],
......
......@@ -627,16 +627,6 @@ void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size,
// it's faster than -funroll-loops, but using
// -funroll-loops w/ this is bad - 74 cycles again.
// all this is on a 7450, tuning for the 7450
#if 0
for (i = 0; i < h; i++) {
pixelsv1 = vec_ld(0, pixels);
pixelsv2 = vec_ld(16, pixels);
vec_st(vec_perm(pixelsv1, pixelsv2, perm),
0, block);
pixels+=line_size;
block +=line_size;
}
#else
for (i = 0; i < h; i += 4) {
pixelsv1 = vec_ld( 0, pixels);
pixelsv2 = vec_ld(15, pixels);
......@@ -657,7 +647,6 @@ void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size,
pixels+=line_size_4;
block +=line_size_4;
}
#endif
}
/* next one assumes that ((line_size % 16) == 0) */
......
......@@ -48,7 +48,6 @@ static void clear_blocks_dcbz32_ppc(DCTELEM *blocks)
{
register int misal = ((unsigned long)blocks & 0x00000010);
register int i = 0;
#if 1
if (misal) {
((unsigned long*)blocks)[0] = 0L;
((unsigned long*)blocks)[1] = 0L;
......@@ -66,9 +65,6 @@ static void clear_blocks_dcbz32_ppc(DCTELEM *blocks)
((unsigned long*)blocks)[191] = 0L;
i += 16;
}
#else
memset(blocks, 0, sizeof(DCTELEM)*6*64);
#endif
}
/* same as above, when dcbzl clear a whole 128B cache line
......@@ -78,7 +74,6 @@ static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
{
register int misal = ((unsigned long)blocks & 0x0000007f);
register int i = 0;
#if 1
if (misal) {
// we could probably also optimize this case,
// but there's not much point as the machines
......@@ -89,9 +84,6 @@ static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
for ( ; i < sizeof(DCTELEM)*6*64 ; i += 128) {
__asm__ volatile("dcbzl %0,%1" : : "b" (blocks), "r" (i) : "memory");
}
#else
memset(blocks, 0, sizeof(DCTELEM)*6*64);
#endif
}
#else
static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
......
......@@ -265,7 +265,6 @@ void fdct_altivec(int16_t *block)
* conversion to vector float. The following code section takes advantage
* of this.
*/
#if 1
/* fdct rows {{{ */
x0 = ((vector float)vec_add(vs16(b00), vs16(b70)));
x7 = ((vector float)vec_sub(vs16(b00), vs16(b70)));
......@@ -389,29 +388,6 @@ void fdct_altivec(int16_t *block)
b31 = vec_add(b31, x2);
b11 = vec_add(b11, x3);
/* }}} */
#else
/* convert to float {{{ */
#define CTF(n) \
vs32(b##n##1) = vec_unpackl(vs16(b##n##0)); \
vs32(b##n##0) = vec_unpackh(vs16(b##n##0)); \
b##n##1 = vec_ctf(vs32(b##n##1), 0); \
b##n##0 = vec_ctf(vs32(b##n##0), 0); \
CTF(0);
CTF(1);
CTF(2);
CTF(3);
CTF(4);
CTF(5);
CTF(6);
CTF(7);
#undef CTF
/* }}} */
FDCTROW(b00, b10, b20, b30, b40, b50, b60, b70);
FDCTROW(b01, b11, b21, b31, b41, b51, b61, b71);
#endif
/* 8x8 matrix transpose (vector float[8][2]) {{{ */
......
......@@ -515,21 +515,6 @@ static void dct_unquantize_h263_altivec(MpegEncContext *s,
qaddv = vec_splat((vec_s16)vec_lde(0, &qadd8), 0);
nqaddv = vec_sub(vczero, qaddv);
#if 0 // block *is* 16 bytes-aligned, it seems.
// first make sure block[j] is 16 bytes-aligned
for(j = 0; (j <= nCoeffs) && ((((unsigned long)block) + (j << 1)) & 0x0000000F) ; j++) {
level = block[j];
if (level) {
if (level < 0) {
level = level * qmul - qadd;
} else {
level = level * qmul + qadd;
}
block[j] = level;
}
}
#endif
// vectorize all the 16 bytes-aligned blocks
// of 8 elements
for(; (j + 7) <= nCoeffs ; j+=8) {
......@@ -599,9 +584,6 @@ void MPV_common_init_altivec(MpegEncContext *s)
if ((s->avctx->dct_algo == FF_DCT_AUTO) ||
(s->avctx->dct_algo == FF_DCT_ALTIVEC)) {
#if 0 /* seems to cause trouble under some circumstances */
s->dct_quantize = dct_quantize_altivec;
#endif
s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec;
s->dct_unquantize_h263_inter = dct_unquantize_h263_altivec;
}
......
......@@ -256,6 +256,7 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx)
if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){
av_log(avctx, AV_LOG_ERROR, "Insufficient extradata - need at least %d bytes, got %d\n",
6 + r->rpr * 2, avctx->extradata_size);
return EINVAL;
}
r->parse_slice_header = rv30_parse_slice_header;
r->decode_intra_types = rv30_decode_intra_types;
......
......@@ -235,100 +235,4 @@ static const uint8_t sp5x_quant_table[20][64]=
124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124 }
};
#if 0
/* 4NF-M, not ZigZag */
static const uint8_t sp5x_quant_table_orig[18][64] =
{
/* index 0, Q50 */
{ 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55,
14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62,
18, 22, 37, 56, 68,109,103, 77, 24, 35, 55, 64, 81,104,113, 92,
49, 64, 78, 87,103,121,120,101, 72, 92, 95, 98,112,100,103, 99 },
{ 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99,
24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 },
/* index 1, Q70 */
{ 10, 7, 6, 10, 14, 24, 31, 37, 7, 7, 8, 11, 16, 35, 36, 33,
8, 8, 10, 14, 24, 34, 41, 34, 8, 10, 13, 17, 31, 52, 48, 37,
11, 13, 22, 34, 41, 65, 62, 46, 14, 21, 33, 38, 49, 62, 68, 55,
29, 38, 47, 52, 62, 73, 72, 61, 43, 55, 57, 59, 67, 60, 62, 59 },
{ 10, 11, 14, 28, 59, 59, 59, 59, 11, 13, 16, 40, 59, 59, 59, 59,
14, 16, 34, 59, 59, 59, 59, 59, 28, 40, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 },
/* index 2, Q80 */
{ 6, 4, 4, 6, 10, 16, 20, 24, 5, 5, 6, 8, 10, 23, 24, 22,
6, 5, 6, 10, 16, 23, 28, 22, 6, 7, 9, 12, 20, 35, 32, 25,
7, 9, 15, 22, 27, 44, 41, 31, 10, 14, 22, 26, 32, 42, 45, 37,
20, 26, 31, 35, 41, 48, 48, 40, 29, 37, 38, 39, 45, 40, 41, 40 },
{ 7, 7, 10, 19, 40, 40, 40, 40, 7, 8, 10, 26, 40, 40, 40, 40,
10, 10, 22, 40, 40, 40, 40, 40, 19, 26, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 },
/* index 3, Q85 */
{ 5, 3, 3, 5, 7, 12, 15, 18, 4, 4, 4, 6, 8, 17, 18, 17,
4, 4, 5, 7, 12, 17, 21, 17, 4, 5, 7, 9, 15, 26, 24, 19,
5, 7, 11, 17, 20, 33, 31, 23, 7, 11, 17, 19, 24, 31, 34, 28,
15, 19, 23, 26, 31, 36, 36, 30, 22, 28, 29, 29, 34, 30, 31, 30 },
{ 5, 5, 7, 14, 30, 30, 30, 30, 5, 6, 8, 20, 30, 30, 30, 30,
7, 8, 17, 30, 30, 30, 30, 30, 14, 20, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 },
/* index 4, Q90 */
{ 3, 2, 2, 3, 5, 8, 10, 12, 2, 2, 3, 4, 5, 12, 12, 11,
3, 3, 3, 5, 8, 11, 14, 11, 3, 3, 4, 6, 10, 17, 16, 12,
4, 4, 7, 11, 14, 22, 21, 15, 5, 7, 11, 13, 16, 21, 23, 18,
10, 13, 16, 17, 21, 24, 24, 20, 14, 18, 19, 20, 22, 20, 21, 20 },
{ 3, 4, 5, 9, 20, 20, 20, 20, 4, 4, 5, 13, 20, 20, 20, 20,
5, 5, 11, 20, 20, 20, 20, 20, 9, 13, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 },
/* index 5, Q60 */
{ 13, 9, 8, 13, 19, 32, 41, 49, 10, 10, 11, 15, 21, 46, 48, 44,
11, 10, 13, 19, 32, 46, 55, 45, 11, 14, 18, 23, 41, 70, 64, 50,
14, 18, 30, 45, 54, 87, 82, 62, 19, 28, 44, 51, 65, 83, 90, 74,
39, 51, 62, 70, 82, 97, 96, 81, 58, 74, 76, 78, 90, 80, 82, 79 },
{ 14, 14, 19, 38, 79, 79, 79, 79, 14, 17, 21, 53, 79, 79, 79, 79,
19, 21, 45, 79, 79, 79, 79, 79, 38, 53, 79, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 },
/* index 6, Q25 */
{ 32, 22, 20, 32, 48, 80,102,122, 24, 24, 28, 38, 52,116,120,110,
28, 26, 32, 48, 80,114,138,112, 28, 34, 44, 58,102,174,160,124,
36, 44, 74,112,136,218,206,154, 48, 70,110,128,162,208,226,184,
98,128,156,174,206,242,240,202,144,184,190,196,224,200,206,198 },
{ 34, 36, 48, 94,198,198,198,198, 36, 42, 52,132,198,198,198,198,
48, 52,112,198,198,198,198,198, 94,132,198,198,198,198,198,198,
198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198 },
/* index 7, Q95 */
{ 2, 1, 1, 2, 2, 4, 5, 6, 1, 1, 1, 2, 3, 6, 6, 6,
1, 1, 2, 2, 4, 6, 7, 6, 1, 2, 2, 3, 5, 9, 8, 6,
2, 2, 4, 6, 7, 11, 10, 8, 2, 4, 6, 6, 8, 10, 11, 9,
5, 6, 8, 9, 10, 12, 12, 10, 7, 9, 10, 10, 11, 10, 10, 10 },
{ 2, 2, 2, 5, 10, 10, 10, 10, 2, 2, 3, 7, 10, 10, 10, 10,
2, 3, 6, 10, 10, 10, 10, 10, 5, 7, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
/* index 8, Q93 */
{ 2, 2, 1, 2, 3, 6, 7, 9, 2, 2, 2, 3, 4, 8, 8, 8,
2, 2, 2, 3, 6, 8, 10, 8, 2, 2, 3, 4, 7, 12, 11, 9,
3, 3, 5, 8, 10, 15, 14, 11, 3, 5, 8, 9, 11, 15, 16, 13,
7, 9, 11, 12, 14, 17, 17, 14, 10, 13, 13, 14, 16, 14, 14, 14 },
{ 2, 3, 3, 7, 14, 14, 14, 14, 3, 3, 4, 9, 14, 14, 14, 14,
3, 4, 8, 14, 14, 14, 14, 14, 7, 9, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }
};
#endif
#endif /* AVCODEC_SP5X_H */
......@@ -109,14 +109,14 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
MpegEncContext * const s = avctx->priv_data;
VASliceParameterBufferMPEG2 *slice_param;
GetBitContext gb;
uint32_t start_code av_unused, quantiser_scale_code, intra_slice_flag, macroblock_offset;
uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset;
av_dlog(avctx, "vaapi_mpeg2_decode_slice(): buffer %p, size %d\n", buffer, size);
/* Determine macroblock_offset */
init_get_bits(&gb, buffer, 8 * size);
start_code = get_bits(&gb, 32);
assert((start_code & 0xffffff00) == 0x00000100);
if (get_bits_long(&gb, 32) >> 8 != 1) /* start code */
return AVERROR_INVALIDDATA;
quantiser_scale_code = get_bits(&gb, 5);
intra_slice_flag = get_bits1(&gb);
if (intra_slice_flag) {
......
......@@ -187,75 +187,6 @@ const uint8_t ff_vc1_norm6_bits[64] = {
4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6,
};
#if 0
/* Normal-6 imode */
const uint8_t ff_vc1_norm6_spec[64][5] = {
{ 0, 1, 1 },
{ 1, 2, 4 },
{ 2, 3, 4 },
{ 3, 0, 8 },
{ 4, 4, 4 },
{ 5, 1, 8 },
{ 6, 2, 8 },
{ 7, 2, 5, 7, 5 },
{ 8, 5, 4 },
{ 9, 3, 8 },
{10, 4, 8 },
{11, 2, 5, 11, 5 },
{12, 5, 8 },
{13, 2, 5, 13, 5 },
{14, 2, 5, 14, 5 },
{15, 3, 5, 14, 8 },
{16, 6, 4 },
{17, 6, 8 },
{18, 7, 8 },
{19, 2, 5, 19, 5 },
{20, 8, 8 },
{21, 2, 5, 21, 5 },
{22, 2, 5, 22, 5 },
{23, 3, 5, 13, 8 },
{24, 9, 8 },
{25, 2, 5, 25, 5 },
{26, 2, 5, 26, 5 },
{27, 3, 5, 12, 8 },
{28, 2, 5, 28, 5 },
{29, 3, 5, 11, 8 },
{30, 3, 5, 10, 8 },
{31, 3, 5, 7, 4 },
{32, 7, 4 },
{33, 10, 8 },
{34, 11, 8 },
{35, 2, 5, 3, 5 },
{36, 12, 8 },
{37, 2, 5, 5, 5 },
{38, 2, 5, 6, 5 },
{39, 3, 5, 9, 8 },
{40, 13, 8 },
{41, 2, 5, 9, 5 },
{42, 2, 5, 10, 5 },
{43, 3, 5, 8, 8 },
{44, 2, 5, 12, 5 },
{45, 3, 5, 7, 8 },
{46, 3, 5, 6, 8 },
{47, 3, 5, 6, 4 },
{48, 14, 8 },
{49, 2, 5, 17, 5 },
{50, 2, 5, 18, 5 },
{51, 3, 5, 5, 8 },
{52, 2, 5, 20, 5 },
{53, 3, 5, 4, 8 },
{54, 3, 5, 3, 8 },
{55, 3, 5, 5, 4 },
{56, 2, 5, 24, 5 },
{57, 3, 5, 2, 8 },
{58, 3, 5, 1, 8 },
{59, 3, 5, 4, 4 },
{60, 3, 5, 0, 8 },
{61, 3, 5, 3, 4 },
{62, 3, 5, 2, 4 },
{63, 3, 5, 1, 1 },
};
#endif
/* 4MV Block pattern VLC tables */
const uint8_t ff_vc1_4mv_block_pattern_codes[4][16] = {
......@@ -276,7 +207,7 @@ const uint8_t wmv3_dc_scale_table[32]={
};
/* P-Picture CBPCY VLC tables */
#if 1 // Looks like original tables are not conforming to standard at all. Are they used for old WMV?
// Looks like original tables are not conforming to standard at all. Are they used for old WMV?
const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
{
0, 6, 15, 13, 13, 11, 3, 13, 5, 8, 49, 10, 12, 114, 102, 119,
......@@ -330,60 +261,6 @@ const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8
}
};
#else
const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
{
0, 1, 1, 4, 5, 1, 12, 4, 13, 14, 10, 11, 12, 7, 13, 2,
15, 1, 96, 1, 49, 97, 2, 100, 3, 4, 5, 101, 102, 52, 53, 4,
6, 7, 54, 103, 8, 9, 10, 110, 11, 12, 111, 56, 114, 58, 115, 5,
13, 7, 8, 9, 10, 11, 12, 30, 13, 14, 15, 118, 119, 62, 63, 3
},
{
0, 1, 2, 1, 3, 1, 16, 17, 5, 18, 12, 19, 13, 1, 28, 58,
1, 1, 1, 2, 3, 2, 3, 236, 237, 4, 5, 238, 6, 7, 239, 8,
9, 240, 10, 11, 121, 122, 12, 13, 14, 15, 241, 246, 16, 17, 124, 63,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 247, 125
},
{
0, 1, 2, 3, 2, 3, 1, 4, 5, 24, 7, 13, 16, 17, 9, 5,
25, 1, 1, 1, 2, 3, 96, 194, 1, 2, 98, 99, 195, 200, 101, 26,
201, 102, 412, 413, 414, 54, 220, 111, 221, 3, 224, 113, 225, 114, 230, 29,
231, 415, 240, 4, 241, 484, 5, 243, 3, 244, 245, 485, 492, 493, 247, 31
},
{
0, 1, 1, 1, 2, 2, 3, 4, 3, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 28, 29, 30, 31
}
};
const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
{
13, 6, 5, 6, 6, 7, 7, 5, 7, 7, 6, 6, 6, 5, 6, 3,
7, 8, 8, 13, 7, 8, 13, 8, 13, 13, 13, 8, 8, 7, 7, 3,
13, 13, 7, 8, 13, 13, 13, 8, 13, 13, 8, 7, 8, 7, 8, 3,
13, 12, 12, 12, 12, 12, 12, 6, 12, 12, 12, 8, 8, 7, 7, 2
},
{
14, 3, 3, 5, 3, 4, 5, 5, 3, 5, 4, 5, 4, 6, 5, 6,
8, 14, 13, 8, 8, 13, 13, 8, 8, 13, 13, 8, 13, 13, 8, 13,
13, 8, 13, 13, 7, 7, 13, 13, 13, 13, 8, 8, 13, 13, 7, 6,
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 8, 7
},
{
13, 5, 5, 5, 4, 4, 6, 4, 4, 6, 4, 5, 5, 5, 4, 3,
6, 8, 10, 9, 8, 8, 7, 8, 13, 13, 7, 7, 8, 8, 7, 5,
8, 7, 9, 9, 9, 6, 8, 7, 8, 13, 8, 7, 8, 7, 8, 5,
8, 9, 8, 13, 8, 9, 13, 8, 12, 8, 8, 9, 9, 9, 8, 5
},
{
9, 2, 3, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8
}
};
#endif
/* MacroBlock Transform Type: 7.1.3.11, p89
* 8x8:B
......
......@@ -847,19 +847,13 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
if (!buffer)
return AVERROR(ENOMEM);
*s = av_mallocz(sizeof(AVIOContext));
if(!*s) {
*s = avio_alloc_context(buffer, buffer_size, h->flags & AVIO_FLAG_WRITE, h,
ffurl_read, ffurl_write, ffurl_seek);
if (!*s) {
av_free(buffer);
return AVERROR(ENOMEM);
}
if (ffio_init_context(*s, buffer, buffer_size,
h->flags & AVIO_FLAG_WRITE, h,
(void*)ffurl_read, (void*)ffurl_write, (void*)ffurl_seek) < 0) {
av_free(buffer);
av_freep(s);
return AVERROR(EIO);
}
#if FF_API_OLD_AVIO
(*s)->is_streamed = h->is_streamed;
#endif
......
......@@ -80,7 +80,7 @@ const char *avformat_license(void)
* @param num must be >= 0
* @param den must be >= 1
*/
static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
static void frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
{
num += (den >> 1);
if (num >= den) {
......@@ -98,7 +98,7 @@ static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
* @param f fractional number
* @param incr increment, can be positive or negative
*/
static void av_frac_add(AVFrac *f, int64_t incr)
static void frac_add(AVFrac *f, int64_t incr)
{
int64_t num, den;
......@@ -1116,7 +1116,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
}
static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st;
int len, ret, i;
......@@ -1247,7 +1247,7 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
}
}
if(s->debug & FF_FDEBUG_TS)
av_log(s, AV_LOG_DEBUG, "av_read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
av_log(s, AV_LOG_DEBUG, "read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
pkt->stream_index,
pkt->pts,
pkt->dts,
......@@ -1293,7 +1293,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
}
}
if(genpts){
int ret= av_read_frame_internal(s, pkt);
int ret= read_frame_internal(s, pkt);
if(ret<0){
if(pktl && ret != AVERROR(EAGAIN)){
eof=1;
......@@ -1307,7 +1307,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
return AVERROR(ENOMEM);
}else{
assert(!s->packet_buffer);
return av_read_frame_internal(s, pkt);
return read_frame_internal(s, pkt);
}
}
}
......@@ -1679,7 +1679,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
return pos;
}
static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
static int seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
int64_t pos_min, pos_max;
#if 0
AVStream *st;
......@@ -1704,7 +1704,7 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos,
return 0;
}
static int av_seek_frame_generic(AVFormatContext *s,
static int seek_frame_generic(AVFormatContext *s,
int stream_index, int64_t timestamp, int flags)
{
int index;
......@@ -1772,7 +1772,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f
ff_read_frame_flush(s);
if(flags & AVSEEK_FLAG_BYTE)
return av_seek_frame_byte(s, stream_index, timestamp, flags);
return seek_frame_byte(s, stream_index, timestamp, flags);
if(stream_index < 0){
stream_index= av_find_default_stream_index(s);
......@@ -1796,7 +1796,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f
if(s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH))
return av_seek_frame_binary(s, stream_index, timestamp, flags);
else if (!(s->iformat->flags & AVFMT_NOGENSEARCH))
return av_seek_frame_generic(s, stream_index, timestamp, flags);
return seek_frame_generic(s, stream_index, timestamp, flags);
else
return -1;
}
......@@ -1820,7 +1820,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int
if(s->iformat->read_seek || 1)
return av_seek_frame(s, stream_index, ts, flags | (ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0));
// try some generic seek like av_seek_frame_generic() but with new ts semantics
// try some generic seek like seek_frame_generic() but with new ts semantics
}
/*******************************************************/
......@@ -1830,7 +1830,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int
*
* @return TRUE if the stream has accurate duration for at least one component.
*/
static int av_has_duration(AVFormatContext *ic)
static int has_duration(AVFormatContext *ic)
{
int i;
AVStream *st;
......@@ -1848,7 +1848,7 @@ static int av_has_duration(AVFormatContext *ic)
*
* Also computes the global bitrate if possible.
*/
static void av_update_stream_timings(AVFormatContext *ic)
static void update_stream_timings(AVFormatContext *ic)
{
int64_t start_time, start_time1, start_time_text, end_time, end_time1;
int64_t duration, duration1;
......@@ -1906,7 +1906,7 @@ static void fill_all_stream_timings(AVFormatContext *ic)
int i;
AVStream *st;
av_update_stream_timings(ic);
update_stream_timings(ic);
for(i = 0;i < ic->nb_streams; i++) {
st = ic->streams[i];
if (st->start_time == AV_NOPTS_VALUE) {
......@@ -1918,7 +1918,7 @@ static void fill_all_stream_timings(AVFormatContext *ic)
}
}
static void av_estimate_timings_from_bit_rate(AVFormatContext *ic)
static void estimate_timings_from_bit_rate(AVFormatContext *ic)
{
int64_t filesize, duration;
int bit_rate, i;
......@@ -1955,7 +1955,7 @@ static void av_estimate_timings_from_bit_rate(AVFormatContext *ic)
#define DURATION_MAX_RETRY 3
/* only usable for MPEG-PS streams */
static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
{
AVPacket pkt1, *pkt = &pkt1;
AVStream *st;
......@@ -1972,7 +1972,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset
for (i=0; i<ic->nb_streams; i++) {
st = ic->streams[i];
if (st->start_time == AV_NOPTS_VALUE && st->first_dts == AV_NOPTS_VALUE)
av_log(st->codec, AV_LOG_WARNING, "start time is not set in av_estimate_timings_from_pts\n");
av_log(st->codec, AV_LOG_WARNING, "start time is not set in estimate_timings_from_pts\n");
if (st->parser) {
av_parser_close(st->parser);
......@@ -2034,7 +2034,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset
}
}
static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
{
int64_t file_size;
......@@ -2052,17 +2052,17 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
!strcmp(ic->iformat->name, "mpegts")) &&
file_size && ic->pb->seekable) {
/* get accurate estimate from the PTSes */
av_estimate_timings_from_pts(ic, old_offset);
} else if (av_has_duration(ic)) {
estimate_timings_from_pts(ic, old_offset);
} else if (has_duration(ic)) {
/* at least one component has timings - we use them for all
the components */
fill_all_stream_timings(ic);
} else {
av_log(ic, AV_LOG_WARNING, "Estimating duration from bitrate, this may be inaccurate\n");
/* less precise: use bitrate info */
av_estimate_timings_from_bit_rate(ic);
estimate_timings_from_bit_rate(ic);
}
av_update_stream_timings(ic);
update_stream_timings(ic);
#if 0
{
......@@ -2359,7 +2359,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
/* NOTE: a new stream can be added there if no header in file
(AVFMTCTX_NOHEADER) */
ret = av_read_frame_internal(ic, &pkt1);
ret = read_frame_internal(ic, &pkt1);
if (ret == AVERROR(EAGAIN))
continue;
......@@ -2519,7 +2519,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
}
av_estimate_timings(ic, old_offset);
estimate_timings(ic, old_offset);
compute_chapters_end(ic);
......@@ -3039,7 +3039,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
ret = AVERROR_INVALIDDATA;
goto fail;
}
av_frac_init(&st->pts, 0, 0, den);
frac_init(&st->pts, 0, 0, den);
}
}
......@@ -3117,11 +3117,11 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
likely equal to the encoder delay, but it would be better if we
had the real timestamps from the encoder */
if (frame_size >= 0 && (pkt->size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
av_frac_add(&st->pts, (int64_t)st->time_base.den * frame_size);
frac_add(&st->pts, (int64_t)st->time_base.den * frame_size);
}
break;
case AVMEDIA_TYPE_VIDEO:
av_frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num);
frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num);
break;
default:
break;
......@@ -3230,7 +3230,7 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pk
* @return 1 if a packet was output, 0 if no packet could be output,
* < 0 if an error occurred
*/
static int av_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush){
static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush){
if(s->oformat->interleave_packet)
return s->oformat->interleave_packet(s, out, in, flush);
else
......@@ -3255,7 +3255,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
for(;;){
AVPacket opkt;
int ret= av_interleave_packet(s, &opkt, pkt, 0);
int ret= interleave_packet(s, &opkt, pkt, 0);
if(ret<=0) //FIXME cleanup needed for ret<0 ?
return ret;
......@@ -3279,7 +3279,7 @@ int av_write_trailer(AVFormatContext *s)
for(;;){
AVPacket pkt;
ret= av_interleave_packet(s, &pkt, NULL, 1);
ret= interleave_packet(s, &pkt, NULL, 1);
if(ret<0) //FIXME cleanup needed for ret<0 ?
goto fail;
if(!ret)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment