* 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: Michael Niedermayer <michaelni@gmx.at>
| ... | ... |
@@ -813,14 +813,17 @@ static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2 |
| 813 | 813 |
const float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB; |
| 814 | 814 |
|
| 815 | 815 |
//Remapping |
| 816 |
- memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0])); |
|
| 817 |
- memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0])); |
|
| 818 |
- memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0])); |
|
| 819 |
- memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0])); |
|
| 820 |
- memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0])); |
|
| 821 |
- memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0])); |
|
| 822 |
- memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0])); |
|
| 823 |
- memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0])); |
|
| 816 |
+ if (ps->num_env_old) {
|
|
| 817 |
+ memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0])); |
|
| 818 |
+ memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0])); |
|
| 819 |
+ memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0])); |
|
| 820 |
+ memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0])); |
|
| 821 |
+ memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0])); |
|
| 822 |
+ memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0])); |
|
| 823 |
+ memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0])); |
|
| 824 |
+ memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0])); |
|
| 825 |
+ } |
|
| 826 |
+ |
|
| 824 | 827 |
if (is34) {
|
| 825 | 828 |
remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1); |
| 826 | 829 |
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, |
| 284 | 284 |
buffer_out[i+1] = val; |
| 285 | 285 |
} |
| 286 | 286 |
|
| 287 |
-#if 0 |
|
| 288 | 287 |
/* 4 and 8 are very common cases (the only ones i've seen). these |
| 289 | 288 |
* should be unrolled and optimized |
| 290 | 289 |
*/ |
| 291 |
- if (predictor_coef_num == 4) {
|
|
| 292 |
- /* FIXME: optimized general case */ |
|
| 293 |
- return; |
|
| 294 |
- } |
|
| 295 |
- |
|
| 296 |
- if (predictor_coef_table == 8) {
|
|
| 297 |
- /* FIXME: optimized general case */ |
|
| 298 |
- return; |
|
| 299 |
- } |
|
| 300 |
-#endif |
|
| 301 | 290 |
|
| 302 | 291 |
/* general case */ |
| 303 | 292 |
if (predictor_coef_num > 0) {
|
| ... | ... |
@@ -93,29 +93,9 @@ static void dct_unquantize_h263_intra_iwmmxt(MpegEncContext *s, |
| 93 | 93 |
block_orig[0] = level; |
| 94 | 94 |
} |
| 95 | 95 |
|
| 96 |
-#if 0 |
|
| 97 |
-static void dct_unquantize_h263_inter_iwmmxt(MpegEncContext *s, |
|
| 98 |
- DCTELEM *block, int n, int qscale) |
|
| 99 |
-{
|
|
| 100 |
- int nCoeffs; |
|
| 101 |
- |
|
| 102 |
- assert(s->block_last_index[n]>=0); |
|
| 103 |
- |
|
| 104 |
- if(s->ac_pred) |
|
| 105 |
- nCoeffs=63; |
|
| 106 |
- else |
|
| 107 |
- nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; |
|
| 108 |
- |
|
| 109 |
- ippiQuantInvInter_Compact_H263_16s_I(block, nCoeffs+1, qscale); |
|
| 110 |
-} |
|
| 111 |
-#endif |
|
| 112 |
- |
|
| 113 | 96 |
void MPV_common_init_iwmmxt(MpegEncContext *s) |
| 114 | 97 |
{
|
| 115 | 98 |
if (!(mm_flags & AV_CPU_FLAG_IWMMXT)) return; |
| 116 | 99 |
|
| 117 | 100 |
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt; |
| 118 |
-#if 0 |
|
| 119 |
- s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_iwmmxt; |
|
| 120 |
-#endif |
|
| 121 | 101 |
} |
| ... | ... |
@@ -75,18 +75,7 @@ static const uint8_t lps_state[64]= {
|
| 75 | 75 |
33,33,34,34,35,35,35,36, |
| 76 | 76 |
36,36,37,37,37,38,38,63, |
| 77 | 77 |
}; |
| 78 |
-#if 0 |
|
| 79 |
-const uint8_t ff_h264_norm_shift_old[128]= {
|
|
| 80 |
- 7,6,5,5,4,4,4,4,3,3,3,3,3,3,3,3, |
|
| 81 |
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, |
|
| 82 |
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
|
| 83 |
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
|
| 84 |
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
| 85 |
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
| 86 |
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
| 87 |
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
|
| 88 |
-}; |
|
| 89 |
-#endif |
|
| 78 |
+ |
|
| 90 | 79 |
const uint8_t ff_h264_norm_shift[512]= {
|
| 91 | 80 |
9,8,7,7,6,6,6,6,5,5,5,5,5,5,5,5, |
| 92 | 81 |
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) |
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
|
| 74 |
+static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt, |
|
| 75 |
+ GetBitContext *gb, int block_size, |
|
| 76 |
+ int width, int height, int x_pos, int y_pos) |
|
| 77 |
+{
|
|
| 78 |
+ struct FlashSVContext *s = avctx->priv_data; |
|
| 79 |
+ uint8_t *line = s->tmpblock; |
|
| 80 |
+ int k; |
|
| 81 |
+ int ret = inflateReset(&s->zstream); |
|
| 82 |
+ if (ret != Z_OK) {
|
|
| 83 |
+ //return -1; |
|
| 84 |
+ } |
|
| 85 |
+ s->zstream.next_in = avpkt->data + get_bits_count(gb) / 8; |
|
| 86 |
+ s->zstream.avail_in = block_size; |
|
| 87 |
+ s->zstream.next_out = s->tmpblock; |
|
| 88 |
+ s->zstream.avail_out = s->block_size * 3; |
|
| 89 |
+ ret = inflate(&s->zstream, Z_FINISH); |
|
| 90 |
+ if (ret == Z_DATA_ERROR) {
|
|
| 91 |
+ av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n"); |
|
| 92 |
+ inflateSync(&s->zstream); |
|
| 93 |
+ ret = inflate(&s->zstream, Z_FINISH); |
|
| 94 |
+ } |
|
| 95 |
+ |
|
| 96 |
+ if (ret != Z_OK && ret != Z_STREAM_END) {
|
|
| 97 |
+ //return -1; |
|
| 98 |
+ } |
|
| 99 |
+ /* Flash Screen Video stores the image upside down, so copy |
|
| 100 |
+ * lines to destination in reverse order. */ |
|
| 101 |
+ for (k = 1; k <= height; k++) {
|
|
| 102 |
+ memcpy(s->frame.data[0] + x_pos * 3 + |
|
| 103 |
+ (s->image_height - y_pos - k) * s->frame.linesize[0], |
|
| 104 |
+ line, width * 3); |
|
| 105 |
+ /* advance source pointer to next line */ |
|
| 106 |
+ line += width * 3; |
|
| 107 |
+ } |
|
| 108 |
+ skip_bits_long(gb, 8 * block_size); /* skip the consumed bits */ |
|
| 109 |
+ return 0; |
|
| 110 |
+} |
|
| 111 |
+ |
|
| 112 |
+ |
|
| 74 | 113 |
static int flashsv_decode_frame(AVCodecContext *avctx, void *data, |
| 75 | 114 |
int *data_size, AVPacket *avpkt) |
| 76 | 115 |
{
|
| ... | ... |
@@ -159,41 +198,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, |
| 159 | 159 |
|
| 160 | 160 |
/* skip unchanged blocks, which have size 0 */ |
| 161 | 161 |
if (size) {
|
| 162 |
- /* decompress block */ |
|
| 163 |
- uint8_t *line = s->tmpblock; |
|
| 164 |
- int k; |
|
| 165 |
- int ret = inflateReset(&s->zstream); |
|
| 166 |
- if (ret != Z_OK) {
|
|
| 167 |
- av_log(avctx, AV_LOG_ERROR, |
|
| 168 |
- "error in decompression (reset) of block %dx%d\n", i, j); |
|
| 169 |
- /* return -1; */ |
|
| 170 |
- } |
|
| 171 |
- s->zstream.next_in = avpkt->data + get_bits_count(&gb) / 8; |
|
| 172 |
- s->zstream.avail_in = size; |
|
| 173 |
- s->zstream.next_out = s->tmpblock; |
|
| 174 |
- s->zstream.avail_out = s->block_size * 3; |
|
| 175 |
- ret = inflate(&s->zstream, Z_FINISH); |
|
| 176 |
- if (ret == Z_DATA_ERROR) {
|
|
| 177 |
- av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n"); |
|
| 178 |
- inflateSync(&s->zstream); |
|
| 179 |
- ret = inflate(&s->zstream, Z_FINISH); |
|
| 180 |
- } |
|
| 181 |
- |
|
| 182 |
- if (ret != Z_OK && ret != Z_STREAM_END) {
|
|
| 162 |
+ if (flashsv_decode_block(avctx, avpkt, &gb, size, |
|
| 163 |
+ cur_blk_width, cur_blk_height, |
|
| 164 |
+ x_pos, y_pos)) |
|
| 183 | 165 |
av_log(avctx, AV_LOG_ERROR, |
| 184 |
- "error in decompression of block %dx%d: %d\n", i, j, ret); |
|
| 185 |
- /* return -1; */ |
|
| 186 |
- } |
|
| 187 |
- /* Flash Screen Video stores the image upside down, so copy |
|
| 188 |
- * lines to destination in reverse order. */ |
|
| 189 |
- for (k = 1; k <= cur_blk_height; k++) {
|
|
| 190 |
- memcpy(s->frame.data[0] + x_pos * 3 + |
|
| 191 |
- (s->image_height - y_pos - k) * s->frame.linesize[0], |
|
| 192 |
- line, cur_blk_width * 3); |
|
| 193 |
- /* advance source pointer to next line */ |
|
| 194 |
- line += cur_blk_width * 3; |
|
| 195 |
- } |
|
| 196 |
- skip_bits_long(&gb, 8 * size); /* skip the consumed bits */ |
|
| 166 |
+ "error in decompression of block %dx%d\n", i, j); |
|
| 197 | 167 |
} |
| 198 | 168 |
} |
| 199 | 169 |
} |
| ... | ... |
@@ -27,31 +27,21 @@ |
| 27 | 27 |
* Flash Screen Video encoder |
| 28 | 28 |
* @author Alex Beregszaszi |
| 29 | 29 |
* @author Benjamin Larsson |
| 30 |
+ * |
|
| 31 |
+ * A description of the bitstream format for Flash Screen Video version 1/2 |
|
| 32 |
+ * is part of the SWF File Format Specification (version 10), which can be |
|
| 33 |
+ * downloaded from http://www.adobe.com/devnet/swf.html. |
|
| 30 | 34 |
*/ |
| 31 | 35 |
|
| 32 |
-/* Bitstream description |
|
| 33 |
- * The picture is divided into blocks that are zlib-compressed. |
|
| 34 |
- * |
|
| 35 |
- * The decoder is fed complete frames, the frameheader contains: |
|
| 36 |
- * 4bits of block width |
|
| 37 |
- * 12bits of frame width |
|
| 38 |
- * 4bits of block height |
|
| 39 |
- * 12bits of frame height |
|
| 40 |
- * |
|
| 41 |
- * Directly after the header are the compressed blocks. The blocks |
|
| 42 |
- * have their compressed size represented with 16bits in the beginig. |
|
| 43 |
- * If the size = 0 then the block is unchanged from the previous frame. |
|
| 44 |
- * All blocks are decompressed until the buffer is consumed. |
|
| 45 |
- * |
|
| 46 |
- * Encoding ideas, a basic encoder would just use a fixed block size. |
|
| 47 |
- * Block sizes can be multipels of 16, from 16 to 256. The blocks don't |
|
| 36 |
+/* |
|
| 37 |
+ * Encoding ideas: A basic encoder would just use a fixed block size. |
|
| 38 |
+ * Block sizes can be multiples of 16, from 16 to 256. The blocks don't |
|
| 48 | 39 |
* have to be quadratic. A brute force search with a set of different |
| 49 | 40 |
* block sizes should give a better result than to just use a fixed size. |
| 50 |
- */ |
|
| 51 |
- |
|
| 52 |
-/* TODO: |
|
| 53 |
- * Don't reencode the frame in brute force mode if the frame is a dupe. Speed up. |
|
| 54 |
- * Make the difference check faster. |
|
| 41 |
+ * |
|
| 42 |
+ * TODO: |
|
| 43 |
+ * Don't reencode the frame in brute force mode if the frame is a dupe. |
|
| 44 |
+ * Speed up. Make the difference check faster. |
|
| 55 | 45 |
*/ |
| 56 | 46 |
|
| 57 | 47 |
#include <stdio.h> |
| ... | ... |
@@ -85,8 +75,8 @@ static int copy_region_enc(uint8_t *sptr, uint8_t *dptr, int dx, int dy, |
| 85 | 85 |
int diff = 0; |
| 86 | 86 |
|
| 87 | 87 |
for (i = dx + h; i > dx; i--) {
|
| 88 |
- nsptr = sptr + (i * stride) + dy * 3; |
|
| 89 |
- npfptr = pfptr + (i * stride) + dy * 3; |
|
| 88 |
+ nsptr = sptr + i * stride + dy * 3; |
|
| 89 |
+ npfptr = pfptr + i * stride + dy * 3; |
|
| 90 | 90 |
for (j = 0; j < w * 3; j++) {
|
| 91 | 91 |
diff |= npfptr[j] ^ nsptr[j]; |
| 92 | 92 |
dptr[j] = nsptr[j]; |
| ... | ... |
@@ -104,13 +94,14 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx) |
| 104 | 104 |
|
| 105 | 105 |
s->avctx = avctx; |
| 106 | 106 |
|
| 107 |
- if ((avctx->width > 4095) || (avctx->height > 4095)) {
|
|
| 108 |
- av_log(avctx, AV_LOG_ERROR, "Input dimensions too large, input must be max 4096x4096 !\n"); |
|
| 107 |
+ if (avctx->width > 4095 || avctx->height > 4095) {
|
|
| 108 |
+ av_log(avctx, AV_LOG_ERROR, |
|
| 109 |
+ "Input dimensions too large, input must be max 4096x4096 !\n"); |
|
| 109 | 110 |
return AVERROR_INVALIDDATA; |
| 110 | 111 |
} |
| 111 | 112 |
|
| 112 | 113 |
// Needed if zlib unused or init aborted before deflateInit |
| 113 |
- memset(&(s->zstream), 0, sizeof(z_stream)); |
|
| 114 |
+ memset(&s->zstream, 0, sizeof(z_stream)); |
|
| 114 | 115 |
|
| 115 | 116 |
s->last_key_frame = 0; |
| 116 | 117 |
|
| ... | ... |
@@ -141,9 +132,9 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf, |
| 141 | 141 |
|
| 142 | 142 |
init_put_bits(&pb, buf, buf_size * 8); |
| 143 | 143 |
|
| 144 |
- put_bits(&pb, 4, (block_width / 16) - 1); |
|
| 144 |
+ put_bits(&pb, 4, block_width / 16 - 1); |
|
| 145 | 145 |
put_bits(&pb, 12, s->image_width); |
| 146 |
- put_bits(&pb, 4, (block_height / 16) - 1); |
|
| 146 |
+ put_bits(&pb, 4, block_height / 16 - 1); |
|
| 147 | 147 |
put_bits(&pb, 12, s->image_height); |
| 148 | 148 |
flush_put_bits(&pb); |
| 149 | 149 |
buf_pos = 4; |
| ... | ... |
@@ -156,37 +147,36 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf, |
| 156 | 156 |
/* loop over all block columns */ |
| 157 | 157 |
for (j = 0; j < v_blocks + (v_part ? 1 : 0); j++) {
|
| 158 | 158 |
|
| 159 |
- int hp = j * block_height; // horiz position in frame |
|
| 160 |
- int hs = (j < v_blocks) ? block_height : v_part; // size of block |
|
| 159 |
+ int y_pos = j * block_height; // vertical position in frame |
|
| 160 |
+ int cur_blk_height = (j < v_blocks) ? block_height : v_part; |
|
| 161 | 161 |
|
| 162 | 162 |
/* loop over all block rows */ |
| 163 | 163 |
for (i = 0; i < h_blocks + (h_part ? 1 : 0); i++) {
|
| 164 |
- int wp = i * block_width; // vert position in frame |
|
| 165 |
- int ws = (i < h_blocks) ? block_width : h_part; // size of block |
|
| 164 |
+ int x_pos = i * block_width; // horizontal position in frame |
|
| 165 |
+ int cur_blk_width = (i < h_blocks) ? block_width : h_part; |
|
| 166 | 166 |
int ret = Z_OK; |
| 167 |
- uint8_t *ptr; |
|
| 168 |
- |
|
| 169 |
- ptr = buf + buf_pos; |
|
| 167 |
+ uint8_t *ptr = buf + buf_pos; |
|
| 170 | 168 |
|
| 171 | 169 |
/* copy the block to the temp buffer before compression |
| 172 | 170 |
* (if it differs from the previous frame's block) */ |
| 173 | 171 |
res = copy_region_enc(p->data[0], s->tmpblock, |
| 174 |
- s->image_height - (hp + hs + 1), |
|
| 175 |
- wp, hs, ws, p->linesize[0], previous_frame); |
|
| 172 |
+ s->image_height - (y_pos + cur_blk_height + 1), |
|
| 173 |
+ x_pos, cur_blk_height, cur_blk_width, |
|
| 174 |
+ p->linesize[0], previous_frame); |
|
| 176 | 175 |
|
| 177 | 176 |
if (res || *I_frame) {
|
| 178 |
- unsigned long zsize; |
|
| 179 |
- zsize = 3 * block_width * block_height; |
|
| 180 |
- ret = compress2(ptr + 2, &zsize, s->tmpblock, 3 * ws * hs, 9); |
|
| 181 |
- |
|
| 177 |
+ unsigned long zsize = 3 * block_width * block_height; |
|
| 178 |
+ ret = compress2(ptr + 2, &zsize, s->tmpblock, |
|
| 179 |
+ 3 * cur_blk_width * cur_blk_height, 9); |
|
| 182 | 180 |
|
| 183 |
- //ret = deflateReset(&(s->zstream)); |
|
| 181 |
+ //ret = deflateReset(&s->zstream); |
|
| 184 | 182 |
if (ret != Z_OK) |
| 185 |
- av_log(s->avctx, AV_LOG_ERROR, "error while compressing block %dx%d\n", i, j); |
|
| 183 |
+ av_log(s->avctx, AV_LOG_ERROR, |
|
| 184 |
+ "error while compressing block %dx%d\n", i, j); |
|
| 186 | 185 |
|
| 187 |
- bytestream_put_be16(&ptr, (unsigned int) zsize); |
|
| 186 |
+ bytestream_put_be16(&ptr, zsize); |
|
| 188 | 187 |
buf_pos += zsize + 2; |
| 189 |
- //av_log(avctx, AV_LOG_ERROR, "buf_pos = %d\n", buf_pos); |
|
| 188 |
+ av_dlog(s->avctx, "buf_pos = %d\n", buf_pos); |
|
| 190 | 189 |
} else {
|
| 191 | 190 |
pred_blocks++; |
| 192 | 191 |
bytestream_put_be16(&ptr, 0); |
| ... | ... |
@@ -213,7 +203,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf, |
| 213 | 213 |
uint8_t *pfptr; |
| 214 | 214 |
int res; |
| 215 | 215 |
int I_frame = 0; |
| 216 |
- int opt_w, opt_h; |
|
| 216 |
+ int opt_w = 4, opt_h = 4; |
|
| 217 | 217 |
|
| 218 | 218 |
*p = *pict; |
| 219 | 219 |
|
| ... | ... |
@@ -228,42 +218,40 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf, |
| 228 | 228 |
} |
| 229 | 229 |
|
| 230 | 230 |
if (p->linesize[0] < 0) |
| 231 |
- pfptr = s->previous_frame - ((s->image_height - 1) * p->linesize[0]); |
|
| 231 |
+ pfptr = s->previous_frame - (s->image_height - 1) * p->linesize[0]; |
|
| 232 | 232 |
else |
| 233 | 233 |
pfptr = s->previous_frame; |
| 234 | 234 |
|
| 235 | 235 |
/* Check the placement of keyframes */ |
| 236 |
- if (avctx->gop_size > 0) {
|
|
| 237 |
- if (avctx->frame_number >= s->last_key_frame + avctx->gop_size) {
|
|
| 238 |
- I_frame = 1; |
|
| 239 |
- } |
|
| 236 |
+ if (avctx->gop_size > 0 && |
|
| 237 |
+ avctx->frame_number >= s->last_key_frame + avctx->gop_size) {
|
|
| 238 |
+ I_frame = 1; |
|
| 240 | 239 |
} |
| 241 | 240 |
|
| 242 |
- opt_w = 4; |
|
| 243 |
- opt_h = 4; |
|
| 244 |
- |
|
| 245 |
- if (buf_size < s->image_width*s->image_height*3) {
|
|
| 241 |
+ if (buf_size < s->image_width * s->image_height * 3) {
|
|
| 246 | 242 |
//Conservative upper bound check for compressed data |
| 247 | 243 |
av_log(avctx, AV_LOG_ERROR, "buf_size %d < %d\n", |
| 248 | 244 |
buf_size, s->image_width * s->image_height * 3); |
| 249 | 245 |
return -1; |
| 250 | 246 |
} |
| 251 | 247 |
|
| 252 |
- res = encode_bitstream(s, p, buf, buf_size, opt_w * 16, opt_h * 16, pfptr, &I_frame); |
|
| 248 |
+ res = encode_bitstream(s, p, buf, buf_size, opt_w * 16, opt_h * 16, |
|
| 249 |
+ pfptr, &I_frame); |
|
| 253 | 250 |
|
| 254 | 251 |
//save the current frame |
| 255 | 252 |
if (p->linesize[0] > 0) |
| 256 | 253 |
memcpy(s->previous_frame, p->data[0], s->image_height * p->linesize[0]); |
| 257 | 254 |
else |
| 258 |
- memcpy(s->previous_frame, p->data[0] + p->linesize[0] * (s->image_height - 1), |
|
| 255 |
+ memcpy(s->previous_frame, |
|
| 256 |
+ p->data[0] + p->linesize[0] * (s->image_height - 1), |
|
| 259 | 257 |
s->image_height * FFABS(p->linesize[0])); |
| 260 | 258 |
|
| 261 | 259 |
//mark the frame type so the muxer can mux it correctly |
| 262 | 260 |
if (I_frame) {
|
| 263 |
- p->pict_type = AV_PICTURE_TYPE_I; |
|
| 264 |
- p->key_frame = 1; |
|
| 261 |
+ p->pict_type = AV_PICTURE_TYPE_I; |
|
| 262 |
+ p->key_frame = 1; |
|
| 265 | 263 |
s->last_key_frame = avctx->frame_number; |
| 266 |
- av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n", avctx->frame_number); |
|
| 264 |
+ av_dlog(avctx, "Inserting keyframe at frame %d\n", avctx->frame_number); |
|
| 267 | 265 |
} else {
|
| 268 | 266 |
p->pict_type = AV_PICTURE_TYPE_P; |
| 269 | 267 |
p->key_frame = 0; |
| ... | ... |
@@ -278,7 +266,7 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx) |
| 278 | 278 |
{
|
| 279 | 279 |
FlashSVContext *s = avctx->priv_data; |
| 280 | 280 |
|
| 281 |
- deflateEnd(&(s->zstream)); |
|
| 281 |
+ deflateEnd(&s->zstream); |
|
| 282 | 282 |
|
| 283 | 283 |
av_free(s->encbuffer); |
| 284 | 284 |
av_free(s->previous_frame); |
| ... | ... |
@@ -62,7 +62,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, |
| 62 | 62 |
void *data, int *data_size, |
| 63 | 63 |
AVPacket *avpkt) |
| 64 | 64 |
{
|
| 65 |
- const uint8_t *buf = avpkt->data; |
|
| 65 |
+ uint8_t *buf = avpkt->data; |
|
| 66 | 66 |
int buf_size = avpkt->size; |
| 67 | 67 |
LibOpenJPEGContext *ctx = avctx->priv_data; |
| 68 | 68 |
AVFrame *picture = &ctx->image, *output = data; |
| ... | ... |
@@ -96,7 +96,7 @@ static int libspeex_decode_frame(AVCodecContext *avctx, |
| 96 | 96 |
void *data, int *data_size, |
| 97 | 97 |
AVPacket *avpkt) |
| 98 | 98 |
{
|
| 99 |
- const uint8_t *buf = avpkt->data; |
|
| 99 |
+ uint8_t *buf = avpkt->data; |
|
| 100 | 100 |
int buf_size = avpkt->size; |
| 101 | 101 |
LibSpeexContext *s = avctx->priv_data; |
| 102 | 102 |
int16_t *output = data, *end; |
| ... | ... |
@@ -1258,29 +1258,6 @@ static int mjpeg_decode_com(MJpegDecodeContext *s) |
| 1258 | 1258 |
return 0; |
| 1259 | 1259 |
} |
| 1260 | 1260 |
|
| 1261 |
-#if 0 |
|
| 1262 |
-static int valid_marker_list[] = |
|
| 1263 |
-{
|
|
| 1264 |
- /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f */ |
|
| 1265 |
-/* 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1266 |
-/* 1 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1267 |
-/* 2 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1268 |
-/* 3 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1269 |
-/* 4 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1270 |
-/* 5 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1271 |
-/* 6 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1272 |
-/* 7 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1273 |
-/* 8 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1274 |
-/* 9 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1275 |
-/* a */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1276 |
-/* b */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
| 1277 |
-/* c */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
|
| 1278 |
-/* d */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
|
| 1279 |
-/* e */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
|
| 1280 |
-/* f */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, |
|
| 1281 |
-} |
|
| 1282 |
-#endif |
|
| 1283 |
- |
|
| 1284 | 1261 |
/* return the 8 bit start code value and update the search |
| 1285 | 1262 |
state. Return -1 if no start code found */ |
| 1286 | 1263 |
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) |
| 315 | 315 |
int tmp1[32]; |
| 316 | 316 |
int *out; |
| 317 | 317 |
|
| 318 |
- // print_pow1(samples, 1152); |
|
| 319 |
- |
|
| 320 | 318 |
offset = s->samples_offset[ch]; |
| 321 | 319 |
out = &s->sb_samples[ch][0][0][0]; |
| 322 | 320 |
for(j=0;j<36;j++) {
|
| ... | ... |
@@ -360,8 +358,6 @@ static void filter(MpegAudioContext *s, int ch, const short *samples, int incr) |
| 360 | 360 |
} |
| 361 | 361 |
} |
| 362 | 362 |
s->samples_offset[ch] = offset; |
| 363 |
- |
|
| 364 |
- // print_pow(s->sb_samples, 1152); |
|
| 365 | 363 |
} |
| 366 | 364 |
|
| 367 | 365 |
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, |
| 627 | 627 |
// it's faster than -funroll-loops, but using |
| 628 | 628 |
// -funroll-loops w/ this is bad - 74 cycles again. |
| 629 | 629 |
// all this is on a 7450, tuning for the 7450 |
| 630 |
-#if 0 |
|
| 631 |
- for (i = 0; i < h; i++) {
|
|
| 632 |
- pixelsv1 = vec_ld(0, pixels); |
|
| 633 |
- pixelsv2 = vec_ld(16, pixels); |
|
| 634 |
- vec_st(vec_perm(pixelsv1, pixelsv2, perm), |
|
| 635 |
- 0, block); |
|
| 636 |
- pixels+=line_size; |
|
| 637 |
- block +=line_size; |
|
| 638 |
- } |
|
| 639 |
-#else |
|
| 640 | 630 |
for (i = 0; i < h; i += 4) {
|
| 641 | 631 |
pixelsv1 = vec_ld( 0, pixels); |
| 642 | 632 |
pixelsv2 = vec_ld(15, pixels); |
| ... | ... |
@@ -657,7 +647,6 @@ void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, |
| 657 | 657 |
pixels+=line_size_4; |
| 658 | 658 |
block +=line_size_4; |
| 659 | 659 |
} |
| 660 |
-#endif |
|
| 661 | 660 |
} |
| 662 | 661 |
|
| 663 | 662 |
/* next one assumes that ((line_size % 16) == 0) */ |
| ... | ... |
@@ -48,7 +48,6 @@ static void clear_blocks_dcbz32_ppc(DCTELEM *blocks) |
| 48 | 48 |
{
|
| 49 | 49 |
register int misal = ((unsigned long)blocks & 0x00000010); |
| 50 | 50 |
register int i = 0; |
| 51 |
-#if 1 |
|
| 52 | 51 |
if (misal) {
|
| 53 | 52 |
((unsigned long*)blocks)[0] = 0L; |
| 54 | 53 |
((unsigned long*)blocks)[1] = 0L; |
| ... | ... |
@@ -66,9 +65,6 @@ static void clear_blocks_dcbz32_ppc(DCTELEM *blocks) |
| 66 | 66 |
((unsigned long*)blocks)[191] = 0L; |
| 67 | 67 |
i += 16; |
| 68 | 68 |
} |
| 69 |
-#else |
|
| 70 |
- memset(blocks, 0, sizeof(DCTELEM)*6*64); |
|
| 71 |
-#endif |
|
| 72 | 69 |
} |
| 73 | 70 |
|
| 74 | 71 |
/* same as above, when dcbzl clear a whole 128B cache line |
| ... | ... |
@@ -78,7 +74,6 @@ static void clear_blocks_dcbz128_ppc(DCTELEM *blocks) |
| 78 | 78 |
{
|
| 79 | 79 |
register int misal = ((unsigned long)blocks & 0x0000007f); |
| 80 | 80 |
register int i = 0; |
| 81 |
-#if 1 |
|
| 82 | 81 |
if (misal) {
|
| 83 | 82 |
// we could probably also optimize this case, |
| 84 | 83 |
// but there's not much point as the machines |
| ... | ... |
@@ -89,9 +84,6 @@ static void clear_blocks_dcbz128_ppc(DCTELEM *blocks) |
| 89 | 89 |
for ( ; i < sizeof(DCTELEM)*6*64 ; i += 128) {
|
| 90 | 90 |
__asm__ volatile("dcbzl %0,%1" : : "b" (blocks), "r" (i) : "memory");
|
| 91 | 91 |
} |
| 92 |
-#else |
|
| 93 |
- memset(blocks, 0, sizeof(DCTELEM)*6*64); |
|
| 94 |
-#endif |
|
| 95 | 92 |
} |
| 96 | 93 |
#else |
| 97 | 94 |
static void clear_blocks_dcbz128_ppc(DCTELEM *blocks) |
| ... | ... |
@@ -265,7 +265,6 @@ void fdct_altivec(int16_t *block) |
| 265 | 265 |
* conversion to vector float. The following code section takes advantage |
| 266 | 266 |
* of this. |
| 267 | 267 |
*/ |
| 268 |
-#if 1 |
|
| 269 | 268 |
/* fdct rows {{{ */
|
| 270 | 269 |
x0 = ((vector float)vec_add(vs16(b00), vs16(b70))); |
| 271 | 270 |
x7 = ((vector float)vec_sub(vs16(b00), vs16(b70))); |
| ... | ... |
@@ -389,29 +388,6 @@ void fdct_altivec(int16_t *block) |
| 389 | 389 |
b31 = vec_add(b31, x2); |
| 390 | 390 |
b11 = vec_add(b11, x3); |
| 391 | 391 |
/* }}} */ |
| 392 |
-#else |
|
| 393 |
- /* convert to float {{{ */
|
|
| 394 |
-#define CTF(n) \ |
|
| 395 |
- vs32(b##n##1) = vec_unpackl(vs16(b##n##0)); \ |
|
| 396 |
- vs32(b##n##0) = vec_unpackh(vs16(b##n##0)); \ |
|
| 397 |
- b##n##1 = vec_ctf(vs32(b##n##1), 0); \ |
|
| 398 |
- b##n##0 = vec_ctf(vs32(b##n##0), 0); \ |
|
| 399 |
- |
|
| 400 |
- CTF(0); |
|
| 401 |
- CTF(1); |
|
| 402 |
- CTF(2); |
|
| 403 |
- CTF(3); |
|
| 404 |
- CTF(4); |
|
| 405 |
- CTF(5); |
|
| 406 |
- CTF(6); |
|
| 407 |
- CTF(7); |
|
| 408 |
- |
|
| 409 |
-#undef CTF |
|
| 410 |
- /* }}} */ |
|
| 411 |
- |
|
| 412 |
- FDCTROW(b00, b10, b20, b30, b40, b50, b60, b70); |
|
| 413 |
- FDCTROW(b01, b11, b21, b31, b41, b51, b61, b71); |
|
| 414 |
-#endif |
|
| 415 | 392 |
|
| 416 | 393 |
|
| 417 | 394 |
/* 8x8 matrix transpose (vector float[8][2]) {{{ */
|
| ... | ... |
@@ -515,21 +515,6 @@ static void dct_unquantize_h263_altivec(MpegEncContext *s, |
| 515 | 515 |
qaddv = vec_splat((vec_s16)vec_lde(0, &qadd8), 0); |
| 516 | 516 |
nqaddv = vec_sub(vczero, qaddv); |
| 517 | 517 |
|
| 518 |
-#if 0 // block *is* 16 bytes-aligned, it seems. |
|
| 519 |
- // first make sure block[j] is 16 bytes-aligned |
|
| 520 |
- for(j = 0; (j <= nCoeffs) && ((((unsigned long)block) + (j << 1)) & 0x0000000F) ; j++) {
|
|
| 521 |
- level = block[j]; |
|
| 522 |
- if (level) {
|
|
| 523 |
- if (level < 0) {
|
|
| 524 |
- level = level * qmul - qadd; |
|
| 525 |
- } else {
|
|
| 526 |
- level = level * qmul + qadd; |
|
| 527 |
- } |
|
| 528 |
- block[j] = level; |
|
| 529 |
- } |
|
| 530 |
- } |
|
| 531 |
-#endif |
|
| 532 |
- |
|
| 533 | 518 |
// vectorize all the 16 bytes-aligned blocks |
| 534 | 519 |
// of 8 elements |
| 535 | 520 |
for(; (j + 7) <= nCoeffs ; j+=8) {
|
| ... | ... |
@@ -599,9 +584,6 @@ void MPV_common_init_altivec(MpegEncContext *s) |
| 599 | 599 |
|
| 600 | 600 |
if ((s->avctx->dct_algo == FF_DCT_AUTO) || |
| 601 | 601 |
(s->avctx->dct_algo == FF_DCT_ALTIVEC)) {
|
| 602 |
-#if 0 /* seems to cause trouble under some circumstances */ |
|
| 603 |
- s->dct_quantize = dct_quantize_altivec; |
|
| 604 |
-#endif |
|
| 605 | 602 |
s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec; |
| 606 | 603 |
s->dct_unquantize_h263_inter = dct_unquantize_h263_altivec; |
| 607 | 604 |
} |
| ... | ... |
@@ -256,6 +256,7 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx) |
| 256 | 256 |
if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){
|
| 257 | 257 |
av_log(avctx, AV_LOG_ERROR, "Insufficient extradata - need at least %d bytes, got %d\n", |
| 258 | 258 |
6 + r->rpr * 2, avctx->extradata_size); |
| 259 |
+ return EINVAL; |
|
| 259 | 260 |
} |
| 260 | 261 |
r->parse_slice_header = rv30_parse_slice_header; |
| 261 | 262 |
r->decode_intra_types = rv30_decode_intra_types; |
| ... | ... |
@@ -235,100 +235,4 @@ static const uint8_t sp5x_quant_table[20][64]= |
| 235 | 235 |
124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124 } |
| 236 | 236 |
}; |
| 237 | 237 |
|
| 238 |
-#if 0 |
|
| 239 |
-/* 4NF-M, not ZigZag */ |
|
| 240 |
-static const uint8_t sp5x_quant_table_orig[18][64] = |
|
| 241 |
-{
|
|
| 242 |
- /* index 0, Q50 */ |
|
| 243 |
- { 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55,
|
|
| 244 |
- 14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, |
|
| 245 |
- 18, 22, 37, 56, 68,109,103, 77, 24, 35, 55, 64, 81,104,113, 92, |
|
| 246 |
- 49, 64, 78, 87,103,121,120,101, 72, 92, 95, 98,112,100,103, 99 }, |
|
| 247 |
- { 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99,
|
|
| 248 |
- 24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99, |
|
| 249 |
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, |
|
| 250 |
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, |
|
| 251 |
- |
|
| 252 |
- /* index 1, Q70 */ |
|
| 253 |
- { 10, 7, 6, 10, 14, 24, 31, 37, 7, 7, 8, 11, 16, 35, 36, 33,
|
|
| 254 |
- 8, 8, 10, 14, 24, 34, 41, 34, 8, 10, 13, 17, 31, 52, 48, 37, |
|
| 255 |
- 11, 13, 22, 34, 41, 65, 62, 46, 14, 21, 33, 38, 49, 62, 68, 55, |
|
| 256 |
- 29, 38, 47, 52, 62, 73, 72, 61, 43, 55, 57, 59, 67, 60, 62, 59 }, |
|
| 257 |
- { 10, 11, 14, 28, 59, 59, 59, 59, 11, 13, 16, 40, 59, 59, 59, 59,
|
|
| 258 |
- 14, 16, 34, 59, 59, 59, 59, 59, 28, 40, 59, 59, 59, 59, 59, 59, |
|
| 259 |
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, |
|
| 260 |
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 }, |
|
| 261 |
- |
|
| 262 |
- /* index 2, Q80 */ |
|
| 263 |
- { 6, 4, 4, 6, 10, 16, 20, 24, 5, 5, 6, 8, 10, 23, 24, 22,
|
|
| 264 |
- 6, 5, 6, 10, 16, 23, 28, 22, 6, 7, 9, 12, 20, 35, 32, 25, |
|
| 265 |
- 7, 9, 15, 22, 27, 44, 41, 31, 10, 14, 22, 26, 32, 42, 45, 37, |
|
| 266 |
- 20, 26, 31, 35, 41, 48, 48, 40, 29, 37, 38, 39, 45, 40, 41, 40 }, |
|
| 267 |
- { 7, 7, 10, 19, 40, 40, 40, 40, 7, 8, 10, 26, 40, 40, 40, 40,
|
|
| 268 |
- 10, 10, 22, 40, 40, 40, 40, 40, 19, 26, 40, 40, 40, 40, 40, 40, |
|
| 269 |
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, |
|
| 270 |
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 }, |
|
| 271 |
- |
|
| 272 |
- /* index 3, Q85 */ |
|
| 273 |
- { 5, 3, 3, 5, 7, 12, 15, 18, 4, 4, 4, 6, 8, 17, 18, 17,
|
|
| 274 |
- 4, 4, 5, 7, 12, 17, 21, 17, 4, 5, 7, 9, 15, 26, 24, 19, |
|
| 275 |
- 5, 7, 11, 17, 20, 33, 31, 23, 7, 11, 17, 19, 24, 31, 34, 28, |
|
| 276 |
- 15, 19, 23, 26, 31, 36, 36, 30, 22, 28, 29, 29, 34, 30, 31, 30 }, |
|
| 277 |
- { 5, 5, 7, 14, 30, 30, 30, 30, 5, 6, 8, 20, 30, 30, 30, 30,
|
|
| 278 |
- 7, 8, 17, 30, 30, 30, 30, 30, 14, 20, 30, 30, 30, 30, 30, 30, |
|
| 279 |
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
|
| 280 |
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 }, |
|
| 281 |
- |
|
| 282 |
- /* index 4, Q90 */ |
|
| 283 |
- { 3, 2, 2, 3, 5, 8, 10, 12, 2, 2, 3, 4, 5, 12, 12, 11,
|
|
| 284 |
- 3, 3, 3, 5, 8, 11, 14, 11, 3, 3, 4, 6, 10, 17, 16, 12, |
|
| 285 |
- 4, 4, 7, 11, 14, 22, 21, 15, 5, 7, 11, 13, 16, 21, 23, 18, |
|
| 286 |
- 10, 13, 16, 17, 21, 24, 24, 20, 14, 18, 19, 20, 22, 20, 21, 20 }, |
|
| 287 |
- { 3, 4, 5, 9, 20, 20, 20, 20, 4, 4, 5, 13, 20, 20, 20, 20,
|
|
| 288 |
- 5, 5, 11, 20, 20, 20, 20, 20, 9, 13, 20, 20, 20, 20, 20, 20, |
|
| 289 |
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, |
|
| 290 |
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }, |
|
| 291 |
- |
|
| 292 |
- /* index 5, Q60 */ |
|
| 293 |
- { 13, 9, 8, 13, 19, 32, 41, 49, 10, 10, 11, 15, 21, 46, 48, 44,
|
|
| 294 |
- 11, 10, 13, 19, 32, 46, 55, 45, 11, 14, 18, 23, 41, 70, 64, 50, |
|
| 295 |
- 14, 18, 30, 45, 54, 87, 82, 62, 19, 28, 44, 51, 65, 83, 90, 74, |
|
| 296 |
- 39, 51, 62, 70, 82, 97, 96, 81, 58, 74, 76, 78, 90, 80, 82, 79 }, |
|
| 297 |
- { 14, 14, 19, 38, 79, 79, 79, 79, 14, 17, 21, 53, 79, 79, 79, 79,
|
|
| 298 |
- 19, 21, 45, 79, 79, 79, 79, 79, 38, 53, 79, 79, 79, 79, 79, 79, |
|
| 299 |
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, |
|
| 300 |
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 }, |
|
| 301 |
- |
|
| 302 |
- /* index 6, Q25 */ |
|
| 303 |
- { 32, 22, 20, 32, 48, 80,102,122, 24, 24, 28, 38, 52,116,120,110,
|
|
| 304 |
- 28, 26, 32, 48, 80,114,138,112, 28, 34, 44, 58,102,174,160,124, |
|
| 305 |
- 36, 44, 74,112,136,218,206,154, 48, 70,110,128,162,208,226,184, |
|
| 306 |
- 98,128,156,174,206,242,240,202,144,184,190,196,224,200,206,198 }, |
|
| 307 |
- { 34, 36, 48, 94,198,198,198,198, 36, 42, 52,132,198,198,198,198,
|
|
| 308 |
- 48, 52,112,198,198,198,198,198, 94,132,198,198,198,198,198,198, |
|
| 309 |
- 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198, |
|
| 310 |
- 198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198 }, |
|
| 311 |
- |
|
| 312 |
- /* index 7, Q95 */ |
|
| 313 |
- { 2, 1, 1, 2, 2, 4, 5, 6, 1, 1, 1, 2, 3, 6, 6, 6,
|
|
| 314 |
- 1, 1, 2, 2, 4, 6, 7, 6, 1, 2, 2, 3, 5, 9, 8, 6, |
|
| 315 |
- 2, 2, 4, 6, 7, 11, 10, 8, 2, 4, 6, 6, 8, 10, 11, 9, |
|
| 316 |
- 5, 6, 8, 9, 10, 12, 12, 10, 7, 9, 10, 10, 11, 10, 10, 10 }, |
|
| 317 |
- { 2, 2, 2, 5, 10, 10, 10, 10, 2, 2, 3, 7, 10, 10, 10, 10,
|
|
| 318 |
- 2, 3, 6, 10, 10, 10, 10, 10, 5, 7, 10, 10, 10, 10, 10, 10, |
|
| 319 |
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, |
|
| 320 |
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 }, |
|
| 321 |
- |
|
| 322 |
- /* index 8, Q93 */ |
|
| 323 |
- { 2, 2, 1, 2, 3, 6, 7, 9, 2, 2, 2, 3, 4, 8, 8, 8,
|
|
| 324 |
- 2, 2, 2, 3, 6, 8, 10, 8, 2, 2, 3, 4, 7, 12, 11, 9, |
|
| 325 |
- 3, 3, 5, 8, 10, 15, 14, 11, 3, 5, 8, 9, 11, 15, 16, 13, |
|
| 326 |
- 7, 9, 11, 12, 14, 17, 17, 14, 10, 13, 13, 14, 16, 14, 14, 14 }, |
|
| 327 |
- { 2, 3, 3, 7, 14, 14, 14, 14, 3, 3, 4, 9, 14, 14, 14, 14,
|
|
| 328 |
- 3, 4, 8, 14, 14, 14, 14, 14, 7, 9, 14, 14, 14, 14, 14, 14, |
|
| 329 |
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, |
|
| 330 |
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 } |
|
| 331 |
-}; |
|
| 332 |
-#endif |
|
| 333 |
- |
|
| 334 | 238 |
#endif /* AVCODEC_SP5X_H */ |
| ... | ... |
@@ -109,14 +109,14 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer |
| 109 | 109 |
MpegEncContext * const s = avctx->priv_data; |
| 110 | 110 |
VASliceParameterBufferMPEG2 *slice_param; |
| 111 | 111 |
GetBitContext gb; |
| 112 |
- uint32_t start_code av_unused, quantiser_scale_code, intra_slice_flag, macroblock_offset; |
|
| 112 |
+ uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset; |
|
| 113 | 113 |
|
| 114 | 114 |
av_dlog(avctx, "vaapi_mpeg2_decode_slice(): buffer %p, size %d\n", buffer, size); |
| 115 | 115 |
|
| 116 | 116 |
/* Determine macroblock_offset */ |
| 117 | 117 |
init_get_bits(&gb, buffer, 8 * size); |
| 118 |
- start_code = get_bits(&gb, 32); |
|
| 119 |
- assert((start_code & 0xffffff00) == 0x00000100); |
|
| 118 |
+ if (get_bits_long(&gb, 32) >> 8 != 1) /* start code */ |
|
| 119 |
+ return AVERROR_INVALIDDATA; |
|
| 120 | 120 |
quantiser_scale_code = get_bits(&gb, 5); |
| 121 | 121 |
intra_slice_flag = get_bits1(&gb); |
| 122 | 122 |
if (intra_slice_flag) {
|
| ... | ... |
@@ -187,75 +187,6 @@ const uint8_t ff_vc1_norm6_bits[64] = {
|
| 187 | 187 |
4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9, |
| 188 | 188 |
8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6, |
| 189 | 189 |
}; |
| 190 |
-#if 0 |
|
| 191 |
-/* Normal-6 imode */ |
|
| 192 |
-const uint8_t ff_vc1_norm6_spec[64][5] = {
|
|
| 193 |
-{ 0, 1, 1 },
|
|
| 194 |
-{ 1, 2, 4 },
|
|
| 195 |
-{ 2, 3, 4 },
|
|
| 196 |
-{ 3, 0, 8 },
|
|
| 197 |
-{ 4, 4, 4 },
|
|
| 198 |
-{ 5, 1, 8 },
|
|
| 199 |
-{ 6, 2, 8 },
|
|
| 200 |
-{ 7, 2, 5, 7, 5 },
|
|
| 201 |
-{ 8, 5, 4 },
|
|
| 202 |
-{ 9, 3, 8 },
|
|
| 203 |
-{10, 4, 8 },
|
|
| 204 |
-{11, 2, 5, 11, 5 },
|
|
| 205 |
-{12, 5, 8 },
|
|
| 206 |
-{13, 2, 5, 13, 5 },
|
|
| 207 |
-{14, 2, 5, 14, 5 },
|
|
| 208 |
-{15, 3, 5, 14, 8 },
|
|
| 209 |
-{16, 6, 4 },
|
|
| 210 |
-{17, 6, 8 },
|
|
| 211 |
-{18, 7, 8 },
|
|
| 212 |
-{19, 2, 5, 19, 5 },
|
|
| 213 |
-{20, 8, 8 },
|
|
| 214 |
-{21, 2, 5, 21, 5 },
|
|
| 215 |
-{22, 2, 5, 22, 5 },
|
|
| 216 |
-{23, 3, 5, 13, 8 },
|
|
| 217 |
-{24, 9, 8 },
|
|
| 218 |
-{25, 2, 5, 25, 5 },
|
|
| 219 |
-{26, 2, 5, 26, 5 },
|
|
| 220 |
-{27, 3, 5, 12, 8 },
|
|
| 221 |
-{28, 2, 5, 28, 5 },
|
|
| 222 |
-{29, 3, 5, 11, 8 },
|
|
| 223 |
-{30, 3, 5, 10, 8 },
|
|
| 224 |
-{31, 3, 5, 7, 4 },
|
|
| 225 |
-{32, 7, 4 },
|
|
| 226 |
-{33, 10, 8 },
|
|
| 227 |
-{34, 11, 8 },
|
|
| 228 |
-{35, 2, 5, 3, 5 },
|
|
| 229 |
-{36, 12, 8 },
|
|
| 230 |
-{37, 2, 5, 5, 5 },
|
|
| 231 |
-{38, 2, 5, 6, 5 },
|
|
| 232 |
-{39, 3, 5, 9, 8 },
|
|
| 233 |
-{40, 13, 8 },
|
|
| 234 |
-{41, 2, 5, 9, 5 },
|
|
| 235 |
-{42, 2, 5, 10, 5 },
|
|
| 236 |
-{43, 3, 5, 8, 8 },
|
|
| 237 |
-{44, 2, 5, 12, 5 },
|
|
| 238 |
-{45, 3, 5, 7, 8 },
|
|
| 239 |
-{46, 3, 5, 6, 8 },
|
|
| 240 |
-{47, 3, 5, 6, 4 },
|
|
| 241 |
-{48, 14, 8 },
|
|
| 242 |
-{49, 2, 5, 17, 5 },
|
|
| 243 |
-{50, 2, 5, 18, 5 },
|
|
| 244 |
-{51, 3, 5, 5, 8 },
|
|
| 245 |
-{52, 2, 5, 20, 5 },
|
|
| 246 |
-{53, 3, 5, 4, 8 },
|
|
| 247 |
-{54, 3, 5, 3, 8 },
|
|
| 248 |
-{55, 3, 5, 5, 4 },
|
|
| 249 |
-{56, 2, 5, 24, 5 },
|
|
| 250 |
-{57, 3, 5, 2, 8 },
|
|
| 251 |
-{58, 3, 5, 1, 8 },
|
|
| 252 |
-{59, 3, 5, 4, 4 },
|
|
| 253 |
-{60, 3, 5, 0, 8 },
|
|
| 254 |
-{61, 3, 5, 3, 4 },
|
|
| 255 |
-{62, 3, 5, 2, 4 },
|
|
| 256 |
-{63, 3, 5, 1, 1 },
|
|
| 257 |
-}; |
|
| 258 |
-#endif |
|
| 259 | 190 |
|
| 260 | 191 |
/* 4MV Block pattern VLC tables */ |
| 261 | 192 |
const uint8_t ff_vc1_4mv_block_pattern_codes[4][16] = {
|
| ... | ... |
@@ -276,7 +207,7 @@ const uint8_t wmv3_dc_scale_table[32]={
|
| 276 | 276 |
}; |
| 277 | 277 |
|
| 278 | 278 |
/* P-Picture CBPCY VLC tables */ |
| 279 |
-#if 1 // Looks like original tables are not conforming to standard at all. Are they used for old WMV? |
|
| 279 |
+// Looks like original tables are not conforming to standard at all. Are they used for old WMV? |
|
| 280 | 280 |
const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
|
| 281 | 281 |
{
|
| 282 | 282 |
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] = {
|
| 330 | 330 |
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8 |
| 331 | 331 |
} |
| 332 | 332 |
}; |
| 333 |
-#else |
|
| 334 |
-const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
|
|
| 335 |
- {
|
|
| 336 |
- 0, 1, 1, 4, 5, 1, 12, 4, 13, 14, 10, 11, 12, 7, 13, 2, |
|
| 337 |
- 15, 1, 96, 1, 49, 97, 2, 100, 3, 4, 5, 101, 102, 52, 53, 4, |
|
| 338 |
- 6, 7, 54, 103, 8, 9, 10, 110, 11, 12, 111, 56, 114, 58, 115, 5, |
|
| 339 |
- 13, 7, 8, 9, 10, 11, 12, 30, 13, 14, 15, 118, 119, 62, 63, 3 |
|
| 340 |
- }, |
|
| 341 |
- {
|
|
| 342 |
- 0, 1, 2, 1, 3, 1, 16, 17, 5, 18, 12, 19, 13, 1, 28, 58, |
|
| 343 |
- 1, 1, 1, 2, 3, 2, 3, 236, 237, 4, 5, 238, 6, 7, 239, 8, |
|
| 344 |
- 9, 240, 10, 11, 121, 122, 12, 13, 14, 15, 241, 246, 16, 17, 124, 63, |
|
| 345 |
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 247, 125 |
|
| 346 |
- }, |
|
| 347 |
- {
|
|
| 348 |
- 0, 1, 2, 3, 2, 3, 1, 4, 5, 24, 7, 13, 16, 17, 9, 5, |
|
| 349 |
- 25, 1, 1, 1, 2, 3, 96, 194, 1, 2, 98, 99, 195, 200, 101, 26, |
|
| 350 |
- 201, 102, 412, 413, 414, 54, 220, 111, 221, 3, 224, 113, 225, 114, 230, 29, |
|
| 351 |
- 231, 415, 240, 4, 241, 484, 5, 243, 3, 244, 245, 485, 492, 493, 247, 31 |
|
| 352 |
- }, |
|
| 353 |
- {
|
|
| 354 |
- 0, 1, 1, 1, 2, 2, 3, 4, 3, 5, 6, 7, 8, 9, 10, 11, |
|
| 355 |
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, |
|
| 356 |
- 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, |
|
| 357 |
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 28, 29, 30, 31 |
|
| 358 |
- } |
|
| 359 |
-}; |
|
| 360 |
-const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
|
|
| 361 |
- {
|
|
| 362 |
- 13, 6, 5, 6, 6, 7, 7, 5, 7, 7, 6, 6, 6, 5, 6, 3, |
|
| 363 |
- 7, 8, 8, 13, 7, 8, 13, 8, 13, 13, 13, 8, 8, 7, 7, 3, |
|
| 364 |
- 13, 13, 7, 8, 13, 13, 13, 8, 13, 13, 8, 7, 8, 7, 8, 3, |
|
| 365 |
- 13, 12, 12, 12, 12, 12, 12, 6, 12, 12, 12, 8, 8, 7, 7, 2 |
|
| 366 |
- }, |
|
| 367 |
- {
|
|
| 368 |
- 14, 3, 3, 5, 3, 4, 5, 5, 3, 5, 4, 5, 4, 6, 5, 6, |
|
| 369 |
- 8, 14, 13, 8, 8, 13, 13, 8, 8, 13, 13, 8, 13, 13, 8, 13, |
|
| 370 |
- 13, 8, 13, 13, 7, 7, 13, 13, 13, 13, 8, 8, 13, 13, 7, 6, |
|
| 371 |
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 8, 7 |
|
| 372 |
- }, |
|
| 373 |
- {
|
|
| 374 |
- 13, 5, 5, 5, 4, 4, 6, 4, 4, 6, 4, 5, 5, 5, 4, 3, |
|
| 375 |
- 6, 8, 10, 9, 8, 8, 7, 8, 13, 13, 7, 7, 8, 8, 7, 5, |
|
| 376 |
- 8, 7, 9, 9, 9, 6, 8, 7, 8, 13, 8, 7, 8, 7, 8, 5, |
|
| 377 |
- 8, 9, 8, 13, 8, 9, 13, 8, 12, 8, 8, 9, 9, 9, 8, 5 |
|
| 378 |
- }, |
|
| 379 |
- {
|
|
| 380 |
- 9, 2, 3, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9, |
|
| 381 |
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, |
|
| 382 |
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, |
|
| 383 |
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8 |
|
| 384 |
- } |
|
| 385 |
-}; |
|
| 386 |
-#endif |
|
| 387 | 333 |
|
| 388 | 334 |
/* MacroBlock Transform Type: 7.1.3.11, p89 |
| 389 | 335 |
* 8x8:B |
| ... | ... |
@@ -847,19 +847,13 @@ int ffio_fdopen(AVIOContext **s, URLContext *h) |
| 847 | 847 |
if (!buffer) |
| 848 | 848 |
return AVERROR(ENOMEM); |
| 849 | 849 |
|
| 850 |
- *s = av_mallocz(sizeof(AVIOContext)); |
|
| 851 |
- if(!*s) {
|
|
| 850 |
+ *s = avio_alloc_context(buffer, buffer_size, h->flags & AVIO_FLAG_WRITE, h, |
|
| 851 |
+ ffurl_read, ffurl_write, ffurl_seek); |
|
| 852 |
+ if (!*s) {
|
|
| 852 | 853 |
av_free(buffer); |
| 853 | 854 |
return AVERROR(ENOMEM); |
| 854 | 855 |
} |
| 855 | 856 |
|
| 856 |
- if (ffio_init_context(*s, buffer, buffer_size, |
|
| 857 |
- h->flags & AVIO_FLAG_WRITE, h, |
|
| 858 |
- (void*)ffurl_read, (void*)ffurl_write, (void*)ffurl_seek) < 0) {
|
|
| 859 |
- av_free(buffer); |
|
| 860 |
- av_freep(s); |
|
| 861 |
- return AVERROR(EIO); |
|
| 862 |
- } |
|
| 863 | 857 |
#if FF_API_OLD_AVIO |
| 864 | 858 |
(*s)->is_streamed = h->is_streamed; |
| 865 | 859 |
#endif |
| ... | ... |
@@ -80,7 +80,7 @@ const char *avformat_license(void) |
| 80 | 80 |
* @param num must be >= 0 |
| 81 | 81 |
* @param den must be >= 1 |
| 82 | 82 |
*/ |
| 83 |
-static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den) |
|
| 83 |
+static void frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den) |
|
| 84 | 84 |
{
|
| 85 | 85 |
num += (den >> 1); |
| 86 | 86 |
if (num >= den) {
|
| ... | ... |
@@ -98,7 +98,7 @@ static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den) |
| 98 | 98 |
* @param f fractional number |
| 99 | 99 |
* @param incr increment, can be positive or negative |
| 100 | 100 |
*/ |
| 101 |
-static void av_frac_add(AVFrac *f, int64_t incr) |
|
| 101 |
+static void frac_add(AVFrac *f, int64_t incr) |
|
| 102 | 102 |
{
|
| 103 | 103 |
int64_t num, den; |
| 104 | 104 |
|
| ... | ... |
@@ -1116,7 +1116,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, |
| 1116 | 1116 |
} |
| 1117 | 1117 |
|
| 1118 | 1118 |
|
| 1119 |
-static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt) |
|
| 1119 |
+static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) |
|
| 1120 | 1120 |
{
|
| 1121 | 1121 |
AVStream *st; |
| 1122 | 1122 |
int len, ret, i; |
| ... | ... |
@@ -1247,7 +1247,7 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt) |
| 1247 | 1247 |
} |
| 1248 | 1248 |
} |
| 1249 | 1249 |
if(s->debug & FF_FDEBUG_TS) |
| 1250 |
- av_log(s, AV_LOG_DEBUG, "av_read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n", |
|
| 1250 |
+ av_log(s, AV_LOG_DEBUG, "read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n", |
|
| 1251 | 1251 |
pkt->stream_index, |
| 1252 | 1252 |
pkt->pts, |
| 1253 | 1253 |
pkt->dts, |
| ... | ... |
@@ -1293,7 +1293,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) |
| 1293 | 1293 |
} |
| 1294 | 1294 |
} |
| 1295 | 1295 |
if(genpts){
|
| 1296 |
- int ret= av_read_frame_internal(s, pkt); |
|
| 1296 |
+ int ret= read_frame_internal(s, pkt); |
|
| 1297 | 1297 |
if(ret<0){
|
| 1298 | 1298 |
if(pktl && ret != AVERROR(EAGAIN)){
|
| 1299 | 1299 |
eof=1; |
| ... | ... |
@@ -1307,7 +1307,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) |
| 1307 | 1307 |
return AVERROR(ENOMEM); |
| 1308 | 1308 |
}else{
|
| 1309 | 1309 |
assert(!s->packet_buffer); |
| 1310 |
- return av_read_frame_internal(s, pkt); |
|
| 1310 |
+ return read_frame_internal(s, pkt); |
|
| 1311 | 1311 |
} |
| 1312 | 1312 |
} |
| 1313 | 1313 |
} |
| ... | ... |
@@ -1679,7 +1679,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i |
| 1679 | 1679 |
return pos; |
| 1680 | 1680 |
} |
| 1681 | 1681 |
|
| 1682 |
-static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
|
|
| 1682 |
+static int seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
|
|
| 1683 | 1683 |
int64_t pos_min, pos_max; |
| 1684 | 1684 |
#if 0 |
| 1685 | 1685 |
AVStream *st; |
| ... | ... |
@@ -1704,7 +1704,7 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, |
| 1704 | 1704 |
return 0; |
| 1705 | 1705 |
} |
| 1706 | 1706 |
|
| 1707 |
-static int av_seek_frame_generic(AVFormatContext *s, |
|
| 1707 |
+static int seek_frame_generic(AVFormatContext *s, |
|
| 1708 | 1708 |
int stream_index, int64_t timestamp, int flags) |
| 1709 | 1709 |
{
|
| 1710 | 1710 |
int index; |
| ... | ... |
@@ -1772,7 +1772,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f |
| 1772 | 1772 |
ff_read_frame_flush(s); |
| 1773 | 1773 |
|
| 1774 | 1774 |
if(flags & AVSEEK_FLAG_BYTE) |
| 1775 |
- return av_seek_frame_byte(s, stream_index, timestamp, flags); |
|
| 1775 |
+ return seek_frame_byte(s, stream_index, timestamp, flags); |
|
| 1776 | 1776 |
|
| 1777 | 1777 |
if(stream_index < 0){
|
| 1778 | 1778 |
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 |
| 1796 | 1796 |
if(s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH)) |
| 1797 | 1797 |
return av_seek_frame_binary(s, stream_index, timestamp, flags); |
| 1798 | 1798 |
else if (!(s->iformat->flags & AVFMT_NOGENSEARCH)) |
| 1799 |
- return av_seek_frame_generic(s, stream_index, timestamp, flags); |
|
| 1799 |
+ return seek_frame_generic(s, stream_index, timestamp, flags); |
|
| 1800 | 1800 |
else |
| 1801 | 1801 |
return -1; |
| 1802 | 1802 |
} |
| ... | ... |
@@ -1820,7 +1820,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int |
| 1820 | 1820 |
if(s->iformat->read_seek || 1) |
| 1821 | 1821 |
return av_seek_frame(s, stream_index, ts, flags | (ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0)); |
| 1822 | 1822 |
|
| 1823 |
- // try some generic seek like av_seek_frame_generic() but with new ts semantics |
|
| 1823 |
+ // try some generic seek like seek_frame_generic() but with new ts semantics |
|
| 1824 | 1824 |
} |
| 1825 | 1825 |
|
| 1826 | 1826 |
/*******************************************************/ |
| ... | ... |
@@ -1830,7 +1830,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int |
| 1830 | 1830 |
* |
| 1831 | 1831 |
* @return TRUE if the stream has accurate duration for at least one component. |
| 1832 | 1832 |
*/ |
| 1833 |
-static int av_has_duration(AVFormatContext *ic) |
|
| 1833 |
+static int has_duration(AVFormatContext *ic) |
|
| 1834 | 1834 |
{
|
| 1835 | 1835 |
int i; |
| 1836 | 1836 |
AVStream *st; |
| ... | ... |
@@ -1848,7 +1848,7 @@ static int av_has_duration(AVFormatContext *ic) |
| 1848 | 1848 |
* |
| 1849 | 1849 |
* Also computes the global bitrate if possible. |
| 1850 | 1850 |
*/ |
| 1851 |
-static void av_update_stream_timings(AVFormatContext *ic) |
|
| 1851 |
+static void update_stream_timings(AVFormatContext *ic) |
|
| 1852 | 1852 |
{
|
| 1853 | 1853 |
int64_t start_time, start_time1, start_time_text, end_time, end_time1; |
| 1854 | 1854 |
int64_t duration, duration1; |
| ... | ... |
@@ -1906,7 +1906,7 @@ static void fill_all_stream_timings(AVFormatContext *ic) |
| 1906 | 1906 |
int i; |
| 1907 | 1907 |
AVStream *st; |
| 1908 | 1908 |
|
| 1909 |
- av_update_stream_timings(ic); |
|
| 1909 |
+ update_stream_timings(ic); |
|
| 1910 | 1910 |
for(i = 0;i < ic->nb_streams; i++) {
|
| 1911 | 1911 |
st = ic->streams[i]; |
| 1912 | 1912 |
if (st->start_time == AV_NOPTS_VALUE) {
|
| ... | ... |
@@ -1918,7 +1918,7 @@ static void fill_all_stream_timings(AVFormatContext *ic) |
| 1918 | 1918 |
} |
| 1919 | 1919 |
} |
| 1920 | 1920 |
|
| 1921 |
-static void av_estimate_timings_from_bit_rate(AVFormatContext *ic) |
|
| 1921 |
+static void estimate_timings_from_bit_rate(AVFormatContext *ic) |
|
| 1922 | 1922 |
{
|
| 1923 | 1923 |
int64_t filesize, duration; |
| 1924 | 1924 |
int bit_rate, i; |
| ... | ... |
@@ -1955,7 +1955,7 @@ static void av_estimate_timings_from_bit_rate(AVFormatContext *ic) |
| 1955 | 1955 |
#define DURATION_MAX_RETRY 3 |
| 1956 | 1956 |
|
| 1957 | 1957 |
/* only usable for MPEG-PS streams */ |
| 1958 |
-static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) |
|
| 1958 |
+static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) |
|
| 1959 | 1959 |
{
|
| 1960 | 1960 |
AVPacket pkt1, *pkt = &pkt1; |
| 1961 | 1961 |
AVStream *st; |
| ... | ... |
@@ -1972,7 +1972,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset |
| 1972 | 1972 |
for (i=0; i<ic->nb_streams; i++) {
|
| 1973 | 1973 |
st = ic->streams[i]; |
| 1974 | 1974 |
if (st->start_time == AV_NOPTS_VALUE && st->first_dts == AV_NOPTS_VALUE) |
| 1975 |
- av_log(st->codec, AV_LOG_WARNING, "start time is not set in av_estimate_timings_from_pts\n"); |
|
| 1975 |
+ av_log(st->codec, AV_LOG_WARNING, "start time is not set in estimate_timings_from_pts\n"); |
|
| 1976 | 1976 |
|
| 1977 | 1977 |
if (st->parser) {
|
| 1978 | 1978 |
av_parser_close(st->parser); |
| ... | ... |
@@ -2034,7 +2034,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset |
| 2034 | 2034 |
} |
| 2035 | 2035 |
} |
| 2036 | 2036 |
|
| 2037 |
-static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset) |
|
| 2037 |
+static void estimate_timings(AVFormatContext *ic, int64_t old_offset) |
|
| 2038 | 2038 |
{
|
| 2039 | 2039 |
int64_t file_size; |
| 2040 | 2040 |
|
| ... | ... |
@@ -2052,17 +2052,17 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset) |
| 2052 | 2052 |
!strcmp(ic->iformat->name, "mpegts")) && |
| 2053 | 2053 |
file_size && ic->pb->seekable) {
|
| 2054 | 2054 |
/* get accurate estimate from the PTSes */ |
| 2055 |
- av_estimate_timings_from_pts(ic, old_offset); |
|
| 2056 |
- } else if (av_has_duration(ic)) {
|
|
| 2055 |
+ estimate_timings_from_pts(ic, old_offset); |
|
| 2056 |
+ } else if (has_duration(ic)) {
|
|
| 2057 | 2057 |
/* at least one component has timings - we use them for all |
| 2058 | 2058 |
the components */ |
| 2059 | 2059 |
fill_all_stream_timings(ic); |
| 2060 | 2060 |
} else {
|
| 2061 | 2061 |
av_log(ic, AV_LOG_WARNING, "Estimating duration from bitrate, this may be inaccurate\n"); |
| 2062 | 2062 |
/* less precise: use bitrate info */ |
| 2063 |
- av_estimate_timings_from_bit_rate(ic); |
|
| 2063 |
+ estimate_timings_from_bit_rate(ic); |
|
| 2064 | 2064 |
} |
| 2065 |
- av_update_stream_timings(ic); |
|
| 2065 |
+ update_stream_timings(ic); |
|
| 2066 | 2066 |
|
| 2067 | 2067 |
#if 0 |
| 2068 | 2068 |
{
|
| ... | ... |
@@ -2359,7 +2359,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) |
| 2359 | 2359 |
|
| 2360 | 2360 |
/* NOTE: a new stream can be added there if no header in file |
| 2361 | 2361 |
(AVFMTCTX_NOHEADER) */ |
| 2362 |
- ret = av_read_frame_internal(ic, &pkt1); |
|
| 2362 |
+ ret = read_frame_internal(ic, &pkt1); |
|
| 2363 | 2363 |
if (ret == AVERROR(EAGAIN)) |
| 2364 | 2364 |
continue; |
| 2365 | 2365 |
|
| ... | ... |
@@ -2519,7 +2519,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) |
| 2519 | 2519 |
} |
| 2520 | 2520 |
} |
| 2521 | 2521 |
|
| 2522 |
- av_estimate_timings(ic, old_offset); |
|
| 2522 |
+ estimate_timings(ic, old_offset); |
|
| 2523 | 2523 |
|
| 2524 | 2524 |
compute_chapters_end(ic); |
| 2525 | 2525 |
|
| ... | ... |
@@ -3039,7 +3039,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options) |
| 3039 | 3039 |
ret = AVERROR_INVALIDDATA; |
| 3040 | 3040 |
goto fail; |
| 3041 | 3041 |
} |
| 3042 |
- av_frac_init(&st->pts, 0, 0, den); |
|
| 3042 |
+ frac_init(&st->pts, 0, 0, den); |
|
| 3043 | 3043 |
} |
| 3044 | 3044 |
} |
| 3045 | 3045 |
|
| ... | ... |
@@ -3117,11 +3117,11 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
|
| 3117 | 3117 |
likely equal to the encoder delay, but it would be better if we |
| 3118 | 3118 |
had the real timestamps from the encoder */ |
| 3119 | 3119 |
if (frame_size >= 0 && (pkt->size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
|
| 3120 |
- av_frac_add(&st->pts, (int64_t)st->time_base.den * frame_size); |
|
| 3120 |
+ frac_add(&st->pts, (int64_t)st->time_base.den * frame_size); |
|
| 3121 | 3121 |
} |
| 3122 | 3122 |
break; |
| 3123 | 3123 |
case AVMEDIA_TYPE_VIDEO: |
| 3124 |
- av_frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num); |
|
| 3124 |
+ frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num); |
|
| 3125 | 3125 |
break; |
| 3126 | 3126 |
default: |
| 3127 | 3127 |
break; |
| ... | ... |
@@ -3230,7 +3230,7 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pk |
| 3230 | 3230 |
* @return 1 if a packet was output, 0 if no packet could be output, |
| 3231 | 3231 |
* < 0 if an error occurred |
| 3232 | 3232 |
*/ |
| 3233 |
-static int av_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush){
|
|
| 3233 |
+static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush){
|
|
| 3234 | 3234 |
if(s->oformat->interleave_packet) |
| 3235 | 3235 |
return s->oformat->interleave_packet(s, out, in, flush); |
| 3236 | 3236 |
else |
| ... | ... |
@@ -3255,7 +3255,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
|
| 3255 | 3255 |
|
| 3256 | 3256 |
for(;;){
|
| 3257 | 3257 |
AVPacket opkt; |
| 3258 |
- int ret= av_interleave_packet(s, &opkt, pkt, 0); |
|
| 3258 |
+ int ret= interleave_packet(s, &opkt, pkt, 0); |
|
| 3259 | 3259 |
if(ret<=0) //FIXME cleanup needed for ret<0 ? |
| 3260 | 3260 |
return ret; |
| 3261 | 3261 |
|
| ... | ... |
@@ -3279,7 +3279,7 @@ int av_write_trailer(AVFormatContext *s) |
| 3279 | 3279 |
|
| 3280 | 3280 |
for(;;){
|
| 3281 | 3281 |
AVPacket pkt; |
| 3282 |
- ret= av_interleave_packet(s, &pkt, NULL, 1); |
|
| 3282 |
+ ret= interleave_packet(s, &pkt, NULL, 1); |
|
| 3283 | 3283 |
if(ret<0) //FIXME cleanup needed for ret<0 ? |
| 3284 | 3284 |
goto fail; |
| 3285 | 3285 |
if(!ret) |