mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
Merge remote-tracking branch 'qatar/master'
* qatar/master: avcodec: Convert some commented-out printf/av_log instances to av_dlog avcodec: Drop silly and/or broken printf debug output avcodec: Drop some silly commented-out av_log() invocations avformat: Convert some commented-out printf/av_log instances to av_dlog avformat: Remove non-compiling and/or silly commented-out printf/av_log statements Remove some silly disabled code. ac3dec: ensure get_buffer() gets a buffer for the correct number of channels Conflicts: libavcodec/dnxhddec.c libavcodec/ffv1.c libavcodec/h264.c libavcodec/h264_parser.c libavcodec/mjpegdec.c libavcodec/motion_est_template.c libavcodec/mpegaudiodec.c libavcodec/mpegvideo_enc.c libavcodec/put_bits.h libavcodec/ratecontrol.c libavcodec/wmaenc.c libavdevice/timefilter.c libavformat/asfdec.c libavformat/avidec.c libavformat/avienc.c libavformat/flvenc.c libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
31ab1575e5
@ -2689,8 +2689,6 @@ static int http_receive_data(HTTPContext *c)
|
|||||||
/* a packet has been received : write it in the store, except
|
/* a packet has been received : write it in the store, except
|
||||||
if header */
|
if header */
|
||||||
if (c->data_count > FFM_PACKET_SIZE) {
|
if (c->data_count > FFM_PACKET_SIZE) {
|
||||||
|
|
||||||
// printf("writing pos=0x%"PRIx64" size=0x%"PRIx64"\n", feed->feed_write_index, feed->feed_size);
|
|
||||||
/* XXX: use llseek or url_seek */
|
/* XXX: use llseek or url_seek */
|
||||||
lseek(c->feed_fd, feed->feed_write_index, SEEK_SET);
|
lseek(c->feed_fd, feed->feed_write_index, SEEK_SET);
|
||||||
if (write(c->feed_fd, c->buffer, FFM_PACKET_SIZE) < 0) {
|
if (write(c->feed_fd, c->buffer, FFM_PACKET_SIZE) < 0) {
|
||||||
|
@ -585,7 +585,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
|
|||||||
q0 = coef2minsf(q0f);
|
q0 = coef2minsf(q0f);
|
||||||
//maximum scalefactor index is when maximum coefficient after quantizing is still not zero
|
//maximum scalefactor index is when maximum coefficient after quantizing is still not zero
|
||||||
q1 = coef2maxsf(q1f);
|
q1 = coef2maxsf(q1f);
|
||||||
//av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1);
|
|
||||||
if (q1 - q0 > 60) {
|
if (q1 - q0 > 60) {
|
||||||
int q0low = q0;
|
int q0low = q0;
|
||||||
int q1high = q1;
|
int q1high = q1;
|
||||||
@ -593,7 +592,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
|
|||||||
int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512);
|
int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512);
|
||||||
q1 = qnrg + 30;
|
q1 = qnrg + 30;
|
||||||
q0 = qnrg - 30;
|
q0 = qnrg - 30;
|
||||||
//av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1);
|
|
||||||
if (q0 < q0low) {
|
if (q0 < q0low) {
|
||||||
q1 += q0low - q0;
|
q1 += q0low - q0;
|
||||||
q0 = q0low;
|
q0 = q0low;
|
||||||
@ -602,7 +600,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
|
|||||||
q1 = q1high;
|
q1 = q1high;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1);
|
|
||||||
|
|
||||||
for (i = 0; i < TRELLIS_STATES; i++) {
|
for (i = 0; i < TRELLIS_STATES; i++) {
|
||||||
paths[0][i].cost = 0.0f;
|
paths[0][i].cost = 0.0f;
|
||||||
|
@ -1377,6 +1377,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
|||||||
avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
|
avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
|
||||||
|
|
||||||
/* get output buffer */
|
/* get output buffer */
|
||||||
|
avctx->channels = s->out_channels;
|
||||||
s->frame.nb_samples = s->num_blocks * 256;
|
s->frame.nb_samples = s->num_blocks * 256;
|
||||||
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
|
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||||
|
@ -353,7 +353,6 @@ static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_
|
|||||||
|
|
||||||
//read bits & initial values
|
//read bits & initial values
|
||||||
nb_bits = get_bits(&gb, 2)+2;
|
nb_bits = get_bits(&gb, 2)+2;
|
||||||
//av_log(NULL,AV_LOG_INFO,"nb_bits: %d\n", nb_bits);
|
|
||||||
table = swf_index_tables[nb_bits-2];
|
table = swf_index_tables[nb_bits-2];
|
||||||
k0 = 1 << (nb_bits-2);
|
k0 = 1 << (nb_bits-2);
|
||||||
signmask = 1 << (nb_bits-1);
|
signmask = 1 << (nb_bits-1);
|
||||||
|
@ -420,11 +420,9 @@ static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_
|
|||||||
|
|
||||||
bits_left = p->bits_per_subpacket - get_bits_count(&q->gb);
|
bits_left = p->bits_per_subpacket - get_bits_count(&q->gb);
|
||||||
|
|
||||||
if (bits_left > q->samples_per_channel) {
|
if (bits_left > q->samples_per_channel)
|
||||||
bits_left = q->samples_per_channel +
|
bits_left = q->samples_per_channel +
|
||||||
((bits_left - q->samples_per_channel) * 5) / 8;
|
((bits_left - q->samples_per_channel) * 5) / 8;
|
||||||
//av_log(q->avctx, AV_LOG_ERROR, "bits_left = %d\n",bits_left);
|
|
||||||
}
|
|
||||||
|
|
||||||
bias = -32;
|
bias = -32;
|
||||||
|
|
||||||
@ -936,10 +934,7 @@ static int decode_subpacket(COOKContext *q, COOKSubpacket *p,
|
|||||||
{
|
{
|
||||||
int sub_packet_size = p->size;
|
int sub_packet_size = p->size;
|
||||||
int res;
|
int res;
|
||||||
/* packet dump */
|
|
||||||
// for (i = 0; i < sub_packet_size ; i++)
|
|
||||||
// av_log(q->avctx, AV_LOG_ERROR, "%02x", inbuffer[i]);
|
|
||||||
// av_log(q->avctx, AV_LOG_ERROR, "\n");
|
|
||||||
memset(q->decode_buffer_1, 0, sizeof(q->decode_buffer_1));
|
memset(q->decode_buffer_1, 0, sizeof(q->decode_buffer_1));
|
||||||
decode_bytes_and_gain(q, p, inbuffer, &p->gains1);
|
decode_bytes_and_gain(q, p, inbuffer, &p->gains1);
|
||||||
|
|
||||||
|
@ -861,8 +861,8 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s->bitalloc[j][k] > 26) {
|
if (s->bitalloc[j][k] > 26) {
|
||||||
// av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index [%i][%i] too big (%i)\n",
|
av_dlog(s->avctx, "bitalloc index [%i][%i] too big (%i)\n",
|
||||||
// j, k, s->bitalloc[j][k]);
|
j, k, s->bitalloc[j][k]);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,6 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
|
|||||||
ctx->last_dc[component] += level;
|
ctx->last_dc[component] += level;
|
||||||
}
|
}
|
||||||
block[0] = ctx->last_dc[component];
|
block[0] = ctx->last_dc[component];
|
||||||
//av_log(ctx->avctx, AV_LOG_DEBUG, "dc %d\n", block[0]);
|
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
@ -256,14 +255,11 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
j = ctx->scantable.permutated[i];
|
j = ctx->scantable.permutated[i];
|
||||||
//av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j);
|
|
||||||
//av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weight %d\n", level, weight_matrix[i]);
|
|
||||||
level *= scale[i];
|
level *= scale[i];
|
||||||
if (level_bias < 32 || weight_matrix[i] != level_bias)
|
if (level_bias < 32 || weight_matrix[i] != level_bias)
|
||||||
level += level_bias;
|
level += level_bias;
|
||||||
level >>= level_shift;
|
level >>= level_shift;
|
||||||
|
|
||||||
//av_log(NULL, AV_LOG_DEBUG, "i %d, j %d, end level %d\n", i, j, level);
|
|
||||||
block[j] = (level^sign) - sign;
|
block[j] = (level^sign) - sign;
|
||||||
|
|
||||||
UPDATE_CACHE(bs, &ctx->gb);
|
UPDATE_CACHE(bs, &ctx->gb);
|
||||||
@ -297,7 +293,6 @@ static int dnxhd_decode_macroblock(DNXHDContext *ctx, int x, int y)
|
|||||||
|
|
||||||
qscale = get_bits(&ctx->gb, 11);
|
qscale = get_bits(&ctx->gb, 11);
|
||||||
skip_bits1(&ctx->gb);
|
skip_bits1(&ctx->gb);
|
||||||
//av_log(ctx->avctx, AV_LOG_DEBUG, "qscale %d\n", qscale);
|
|
||||||
|
|
||||||
if (qscale != ctx->last_qscale) {
|
if (qscale != ctx->last_qscale) {
|
||||||
for (i = 0; i < 64; i++) {
|
for (i = 0; i < 64; i++) {
|
||||||
|
@ -724,8 +724,6 @@ skip_last_mv:
|
|||||||
fixed[mb_xy] = MV_UNCHANGED;
|
fixed[mb_xy] = MV_UNCHANGED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf(".%d/%d", changed, score_sum); fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (none_left)
|
if (none_left)
|
||||||
@ -736,7 +734,6 @@ skip_last_mv:
|
|||||||
if (fixed[mb_xy])
|
if (fixed[mb_xy])
|
||||||
fixed[mb_xy] = MV_FROZEN;
|
fixed[mb_xy] = MV_FROZEN;
|
||||||
}
|
}
|
||||||
// printf(":"); fflush(stdout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,7 +405,6 @@ static inline void update_vlc_state(VlcState * const state, const int v){
|
|||||||
|
|
||||||
static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int v, int bits){
|
static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int v, int bits){
|
||||||
int i, k, code;
|
int i, k, code;
|
||||||
//printf("final: %d ", v);
|
|
||||||
v = fold(v - state->bias, bits);
|
v = fold(v - state->bias, bits);
|
||||||
|
|
||||||
i= state->count;
|
i= state->count;
|
||||||
@ -424,7 +423,8 @@ static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int
|
|||||||
code= v ^ ((2*state->drift + state->count)>>31);
|
code= v ^ ((2*state->drift + state->count)>>31);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//printf("v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code, state->bias, state->error_sum, state->drift, state->count, k);
|
av_dlog(NULL, "v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code,
|
||||||
|
state->bias, state->error_sum, state->drift, state->count, k);
|
||||||
set_sr_golomb(pb, code, k, 12, bits);
|
set_sr_golomb(pb, code, k, 12, bits);
|
||||||
|
|
||||||
update_vlc_state(state, v);
|
update_vlc_state(state, v);
|
||||||
@ -443,7 +443,8 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int
|
|||||||
assert(k<=8);
|
assert(k<=8);
|
||||||
|
|
||||||
v= get_sr_golomb(gb, k, 12, bits);
|
v= get_sr_golomb(gb, k, 12, bits);
|
||||||
//printf("v:%d bias:%d error:%d drift:%d count:%d k:%d", v, state->bias, state->error_sum, state->drift, state->count, k);
|
av_dlog(NULL, "v:%d bias:%d error:%d drift:%d count:%d k:%d",
|
||||||
|
v, state->bias, state->error_sum, state->drift, state->count, k);
|
||||||
|
|
||||||
#if 0 // JPEG LS
|
#if 0 // JPEG LS
|
||||||
if(k==0 && 2*state->drift <= - state->count) v ^= (-1);
|
if(k==0 && 2*state->drift <= - state->count) v ^= (-1);
|
||||||
@ -454,7 +455,7 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int
|
|||||||
ret= fold(v + state->bias, bits);
|
ret= fold(v + state->bias, bits);
|
||||||
|
|
||||||
update_vlc_state(state, v);
|
update_vlc_state(state, v);
|
||||||
//printf("final: %d\n", ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,7 +524,9 @@ static av_always_inline int encode_line(FFV1Context *s, int w,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, (int)put_bits_count(&s->pb));
|
av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n",
|
||||||
|
run_count, run_index, run_mode, x,
|
||||||
|
(int)put_bits_count(&s->pb));
|
||||||
|
|
||||||
if(run_mode == 0)
|
if(run_mode == 0)
|
||||||
put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits);
|
put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits);
|
||||||
@ -1488,7 +1491,8 @@ static av_always_inline void decode_line(FFV1Context *s, int w,
|
|||||||
}else
|
}else
|
||||||
diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits);
|
diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits);
|
||||||
|
|
||||||
// printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, get_bits_count(&s->gb));
|
av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n",
|
||||||
|
run_count, run_index, run_mode, x, get_bits_count(&s->gb));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sign) diff= -diff;
|
if(sign) diff= -diff;
|
||||||
@ -1734,8 +1738,6 @@ static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){
|
|||||||
while(len--){
|
while(len--){
|
||||||
quant_table[i] = scale*v;
|
quant_table[i] = scale*v;
|
||||||
i++;
|
i++;
|
||||||
//printf("%2d ",v);
|
|
||||||
//if(i%16==0) printf("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1945,7 +1947,8 @@ static int read_header(FFV1Context *f){
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("%d %d %d\n", f->chroma_h_shift, f->chroma_v_shift,f->avctx->pix_fmt);
|
av_dlog(f->avctx, "%d %d %d\n",
|
||||||
|
f->chroma_h_shift, f->chroma_v_shift, f->avctx->pix_fmt);
|
||||||
if(f->version < 2){
|
if(f->version < 2){
|
||||||
context_count= read_quant_tables(c, f->quant_table);
|
context_count= read_quant_tables(c, f->quant_table);
|
||||||
if(context_count < 0){
|
if(context_count < 0){
|
||||||
|
@ -539,7 +539,9 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
|
|||||||
/* For some reason, it seems that non-palettized flics do
|
/* For some reason, it seems that non-palettized flics do
|
||||||
* include one of these chunks in their first frame.
|
* include one of these chunks in their first frame.
|
||||||
* Why I do not know, it seems rather extraneous. */
|
* Why I do not know, it seems rather extraneous. */
|
||||||
/* av_log(avctx, AV_LOG_ERROR, "Unexpected Palette chunk %d in non-paletised FLC\n",chunk_type);*/
|
av_dlog(avctx,
|
||||||
|
"Unexpected Palette chunk %d in non-palettized FLC\n",
|
||||||
|
chunk_type);
|
||||||
bytestream2_skip(&g2, chunk_size - 6);
|
bytestream2_skip(&g2, chunk_size - 6);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -465,8 +465,6 @@ static inline void set_te_golomb(PutBitContext *pb, int i, int range){
|
|||||||
* write signed exp golomb code. 16 bits at most.
|
* write signed exp golomb code. 16 bits at most.
|
||||||
*/
|
*/
|
||||||
static inline void set_se_golomb(PutBitContext *pb, int i){
|
static inline void set_se_golomb(PutBitContext *pb, int i){
|
||||||
// if (i>32767 || i<-32767)
|
|
||||||
// av_log(NULL,AV_LOG_ERROR,"value out of range %d\n", i);
|
|
||||||
#if 0
|
#if 0
|
||||||
if(i<=0) i= -2*i;
|
if(i<=0) i= -2*i;
|
||||||
else i= 2*i-1;
|
else i= 2*i-1;
|
||||||
|
@ -221,7 +221,8 @@ static int decode_slice(MpegEncContext *s){
|
|||||||
s->mv_dir = MV_DIR_FORWARD;
|
s->mv_dir = MV_DIR_FORWARD;
|
||||||
s->mv_type = MV_TYPE_16X16;
|
s->mv_type = MV_TYPE_16X16;
|
||||||
// s->mb_skipped = 0;
|
// s->mb_skipped = 0;
|
||||||
//printf("%d %d %06X\n", ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
|
av_dlog(s, "%d %d %06X\n",
|
||||||
|
ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
|
||||||
ret= s->decode_mb(s, s->block);
|
ret= s->decode_mb(s, s->block);
|
||||||
|
|
||||||
if (s->pict_type!=AV_PICTURE_TYPE_B)
|
if (s->pict_type!=AV_PICTURE_TYPE_B)
|
||||||
@ -234,7 +235,6 @@ static int decode_slice(MpegEncContext *s){
|
|||||||
if(s->loop_filter)
|
if(s->loop_filter)
|
||||||
ff_h263_loop_filter(s);
|
ff_h263_loop_filter(s);
|
||||||
|
|
||||||
//printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24));
|
|
||||||
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask);
|
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask);
|
||||||
|
|
||||||
s->padding_bug_score--;
|
s->padding_bug_score--;
|
||||||
@ -538,7 +538,6 @@ retry:
|
|||||||
|
|
||||||
if(s->divx_version>=0)
|
if(s->divx_version>=0)
|
||||||
s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE;
|
s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE;
|
||||||
//printf("padding_bug_score: %d\n", s->padding_bug_score);
|
|
||||||
if(s->divx_version==501 && s->divx_build==20020416)
|
if(s->divx_version==501 && s->divx_build==20020416)
|
||||||
s->padding_bug_score= 256*256*256*64;
|
s->padding_bug_score= 256*256*256*64;
|
||||||
|
|
||||||
|
@ -254,7 +254,6 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("decoding esc\n");
|
|
||||||
memcpy(dst, src, i);
|
memcpy(dst, src, i);
|
||||||
si = di = i;
|
si = di = i;
|
||||||
while (si + 2 < length) {
|
while (si + 2 < length) {
|
||||||
@ -2135,7 +2134,6 @@ static int init_poc(H264Context *h)
|
|||||||
h->poc_msb = h->prev_poc_msb - max_poc_lsb;
|
h->poc_msb = h->prev_poc_msb - max_poc_lsb;
|
||||||
else
|
else
|
||||||
h->poc_msb = h->prev_poc_msb;
|
h->poc_msb = h->prev_poc_msb;
|
||||||
// printf("poc: %d %d\n", h->poc_msb, h->poc_lsb);
|
|
||||||
field_poc[0] =
|
field_poc[0] =
|
||||||
field_poc[1] = h->poc_msb + h->poc_lsb;
|
field_poc[1] = h->poc_msb + h->poc_lsb;
|
||||||
if (s->picture_structure == PICT_FRAME)
|
if (s->picture_structure == PICT_FRAME)
|
||||||
@ -4149,7 +4147,6 @@ not_extra:
|
|||||||
|
|
||||||
assert(pict->data[0] || !*data_size);
|
assert(pict->data[0] || !*data_size);
|
||||||
ff_print_debug_info(s, pict);
|
ff_print_debug_info(s, pict);
|
||||||
// printf("out %d\n", (int)pict->data[0]);
|
|
||||||
|
|
||||||
return get_consumed_bytes(s, buf_index, buf_size);
|
return get_consumed_bytes(s, buf_index, buf_size);
|
||||||
}
|
}
|
||||||
|
@ -1814,7 +1814,6 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u
|
|||||||
MpegEncContext * const s = &h->s;
|
MpegEncContext * const s = &h->s;
|
||||||
int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1];
|
int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1];
|
||||||
if( IS_INTRA16x16( mb_type ) ) {
|
if( IS_INTRA16x16( mb_type ) ) {
|
||||||
//av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 DC\n" );
|
|
||||||
AV_ZERO128(h->mb_luma_dc[p]+0);
|
AV_ZERO128(h->mb_luma_dc[p]+0);
|
||||||
AV_ZERO128(h->mb_luma_dc[p]+8);
|
AV_ZERO128(h->mb_luma_dc[p]+8);
|
||||||
AV_ZERO128(h->mb_luma_dc[p]+16);
|
AV_ZERO128(h->mb_luma_dc[p]+16);
|
||||||
@ -1825,7 +1824,6 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u
|
|||||||
qmul = h->dequant4_coeff[p][qscale];
|
qmul = h->dequant4_coeff[p][qscale];
|
||||||
for( i4x4 = 0; i4x4 < 16; i4x4++ ) {
|
for( i4x4 = 0; i4x4 < 16; i4x4++ ) {
|
||||||
const int index = 16*p + i4x4;
|
const int index = 16*p + i4x4;
|
||||||
//av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", index );
|
|
||||||
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15);
|
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1843,7 +1841,6 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u
|
|||||||
qmul = h->dequant4_coeff[cqm][qscale];
|
qmul = h->dequant4_coeff[cqm][qscale];
|
||||||
for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
|
for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
|
||||||
const int index = 16*p + 4*i8x8 + i4x4;
|
const int index = 16*p + 4*i8x8 + i4x4;
|
||||||
//av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index );
|
|
||||||
//START_TIMER
|
//START_TIMER
|
||||||
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16);
|
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16);
|
||||||
//STOP_TIMER("decode_residual")
|
//STOP_TIMER("decode_residual")
|
||||||
@ -2029,7 +2026,8 @@ decode_intra_mb:
|
|||||||
int pred = pred_intra_mode( h, i );
|
int pred = pred_intra_mode( h, i );
|
||||||
h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred );
|
h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred );
|
||||||
|
|
||||||
//av_log( s->avctx, AV_LOG_ERROR, "i4x4 pred=%d mode=%d\n", pred, h->intra4x4_pred_mode_cache[ scan8[i] ] );
|
av_dlog(s->avctx, "i4x4 pred=%d mode=%d\n", pred,
|
||||||
|
h->intra4x4_pred_mode_cache[scan8[i]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write_back_intra_pred_mode(h);
|
write_back_intra_pred_mode(h);
|
||||||
@ -2350,12 +2348,10 @@ decode_intra_mb:
|
|||||||
} else if (CHROMA422) {
|
} else if (CHROMA422) {
|
||||||
if( cbp&0x30 ){
|
if( cbp&0x30 ){
|
||||||
int c;
|
int c;
|
||||||
for( c = 0; c < 2; c++ ) {
|
for (c = 0; c < 2; c++)
|
||||||
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
|
|
||||||
decode_cabac_residual_dc_422(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3,
|
decode_cabac_residual_dc_422(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3,
|
||||||
CHROMA_DC_BLOCK_INDEX + c,
|
CHROMA_DC_BLOCK_INDEX + c,
|
||||||
chroma422_dc_scan, 8);
|
chroma422_dc_scan, 8);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbp&0x20 ) {
|
if( cbp&0x20 ) {
|
||||||
@ -2366,7 +2362,6 @@ decode_intra_mb:
|
|||||||
for (i8x8 = 0; i8x8 < 2; i8x8++) {
|
for (i8x8 = 0; i8x8 < 2; i8x8++) {
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
const int index = 16 + 16 * c + 8*i8x8 + i;
|
const int index = 16 + 16 * c + 8*i8x8 + i;
|
||||||
//av_log(s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16);
|
|
||||||
decode_cabac_residual_nondc(h, mb, 4, index, scan + 1, qmul, 15);
|
decode_cabac_residual_nondc(h, mb, 4, index, scan + 1, qmul, 15);
|
||||||
mb += 16<<pixel_shift;
|
mb += 16<<pixel_shift;
|
||||||
}
|
}
|
||||||
@ -2379,10 +2374,8 @@ decode_intra_mb:
|
|||||||
} else /* yuv420 */ {
|
} else /* yuv420 */ {
|
||||||
if( cbp&0x30 ){
|
if( cbp&0x30 ){
|
||||||
int c;
|
int c;
|
||||||
for( c = 0; c < 2; c++ ) {
|
for (c = 0; c < 2; c++)
|
||||||
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
|
|
||||||
decode_cabac_residual_dc(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
|
decode_cabac_residual_dc(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbp&0x20 ) {
|
if( cbp&0x20 ) {
|
||||||
@ -2391,7 +2384,6 @@ decode_intra_mb:
|
|||||||
qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
|
qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
|
||||||
for( i = 0; i < 4; i++ ) {
|
for( i = 0; i < 4; i++ ) {
|
||||||
const int index = 16 + 16 * c + i;
|
const int index = 16 + 16 * c + i;
|
||||||
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 );
|
|
||||||
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15);
|
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_si
|
|||||||
ParseContext *pc = &(h->s.parse_context);
|
ParseContext *pc = &(h->s.parse_context);
|
||||||
int next_avc= h->is_avc ? 0 : buf_size;
|
int next_avc= h->is_avc ? 0 : buf_size;
|
||||||
|
|
||||||
//printf("first %02X%02X%02X%02X\n", buf[0], buf[1],buf[2],buf[3]);
|
|
||||||
// mb_addr= pc->mb_addr - 1;
|
// mb_addr= pc->mb_addr - 1;
|
||||||
state= pc->state;
|
state= pc->state;
|
||||||
if(state>13)
|
if(state>13)
|
||||||
|
@ -743,7 +743,7 @@ static int imc_get_coeffs(IMCContext *q, IMCChannel *chctx)
|
|||||||
cw = 0;
|
cw = 0;
|
||||||
|
|
||||||
if (get_bits_count(&q->gb) + cw_len > 512) {
|
if (get_bits_count(&q->gb) + cw_len > 512) {
|
||||||
// av_log(NULL, 0, "Band %i coeff %i cw_len %i\n", i, j, cw_len);
|
av_dlog(NULL, "Band %i coeff %i cw_len %i\n", i, j, cw_len);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,8 +782,6 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
|
|||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
|
|
||||||
// av_log(avctx, AV_LOG_DEBUG, "stream_format_code = %d\n", stream_format_code);
|
|
||||||
|
|
||||||
if (stream_format_code & 0x04)
|
if (stream_format_code & 0x04)
|
||||||
chctx->decoder_reset = 1;
|
chctx->decoder_reset = 1;
|
||||||
|
|
||||||
|
@ -83,5 +83,5 @@ void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(s->reset==0 || reset_all) s->reset= 64;
|
if(s->reset==0 || reset_all) s->reset= 64;
|
||||||
// av_log(NULL, AV_LOG_DEBUG, "[JPEG-LS RESET] T=%i,%i,%i\n", s->T1, s->T2, s->T3);
|
av_dlog(NULL, "[JPEG-LS RESET] T=%i,%i,%i\n", s->T1, s->T2, s->T3);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
|
|||||||
av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id);
|
av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// av_log(s->avctx, AV_LOG_DEBUG, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3);
|
av_dlog(s->avctx, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -285,8 +285,12 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
|
|||||||
else
|
else
|
||||||
shift = point_transform + (16 - s->bits);
|
shift = point_transform + (16 - s->bits);
|
||||||
|
|
||||||
// av_log(s->avctx, AV_LOG_DEBUG, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",s->width,s->height,state->near,state->maxval,state->T1,state->T2,state->T3,state->reset,state->limit,state->qbpp, state->range);
|
av_dlog(s->avctx, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
|
||||||
// av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n", ilv, point_transform, s->bits, s->cur_scan);
|
s->width, s->height, state->near, state->maxval,
|
||||||
|
state->T1, state->T2, state->T3,
|
||||||
|
state->reset, state->limit, state->qbpp, state->range);
|
||||||
|
av_dlog(s->avctx, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
|
||||||
|
ilv, point_transform, s->bits, s->cur_scan);
|
||||||
if(ilv == 0) { /* separate planes */
|
if(ilv == 0) { /* separate planes */
|
||||||
stride = (s->nb_components > 1) ? 3 : 1;
|
stride = (s->nb_components > 1) ? 3 : 1;
|
||||||
off = av_clip(s->cur_scan - 1, 0, stride);
|
off = av_clip(s->cur_scan - 1, 0, stride);
|
||||||
|
@ -180,7 +180,6 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
int pred;
|
int pred;
|
||||||
|
|
||||||
ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
|
ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
|
||||||
//printf("%d %d %d %d %8X\n", mb_x, mb_y, x, y, ptr);
|
|
||||||
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
|
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
|
||||||
|
|
||||||
if(i==0)
|
if(i==0)
|
||||||
|
@ -436,9 +436,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
s->linesize[i] = s->picture_ptr->linesize[i] << s->interlaced;
|
s->linesize[i] = s->picture_ptr->linesize[i] << s->interlaced;
|
||||||
|
|
||||||
// printf("%d %d %d %d %d %d\n",
|
av_dlog(s->avctx, "%d %d %d %d %d %d\n",
|
||||||
// s->width, s->height, s->linesize[0], s->linesize[1],
|
s->width, s->height, s->linesize[0], s->linesize[1],
|
||||||
// s->interlaced, s->avctx->height);
|
s->interlaced, s->avctx->height);
|
||||||
|
|
||||||
if (len != (8 + (3 * nb_components)))
|
if (len != (8 + (3 * nb_components)))
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
|
av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
|
||||||
@ -1047,11 +1047,10 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// av_log(s->avctx, AV_LOG_DEBUG, "mb: %d %d processed\n",
|
av_dlog(s->avctx, "mb: %d %d processed\n", mb_y, mb_x);
|
||||||
// mb_y, mb_x);
|
av_dlog(s->avctx, "%d %d %d %d %d %d %d %d \n",
|
||||||
// av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n",
|
mb_x, mb_y, x, y, c, s->bottom_field,
|
||||||
// mb_x, mb_y, x, y, c, s->bottom_field,
|
(v * mb_y + y) * 8, (h * mb_x + x) * 8);
|
||||||
// (v * mb_y + y) * 8, (h * mb_x + x) * 8);
|
|
||||||
if (++x == h) {
|
if (++x == h) {
|
||||||
x = 0;
|
x = 0;
|
||||||
y++;
|
y++;
|
||||||
@ -1331,8 +1330,6 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
|||||||
4bytes field_size_less_padding
|
4bytes field_size_less_padding
|
||||||
*/
|
*/
|
||||||
s->buggy_avid = 1;
|
s->buggy_avid = 1;
|
||||||
// if (s->first_picture)
|
|
||||||
// printf("mjpeg: workarounding buggy AVID\n");
|
|
||||||
i = get_bits(&s->gb, 8); len--;
|
i = get_bits(&s->gb, 8); len--;
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "polarity %d\n", i);
|
av_log(s->avctx, AV_LOG_DEBUG, "polarity %d\n", i);
|
||||||
#if 0
|
#if 0
|
||||||
@ -1341,8 +1338,6 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
|||||||
skip_bits(&s->gb, 32);
|
skip_bits(&s->gb, 32);
|
||||||
len -= 10;
|
len -= 10;
|
||||||
#endif
|
#endif
|
||||||
// if (s->interlace_polarity)
|
|
||||||
// printf("mjpeg: interlace polarity: %d\n", s->interlace_polarity);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1464,8 +1459,6 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
|
|||||||
/* buggy avid, it puts EOI only at every 10th frame */
|
/* buggy avid, it puts EOI only at every 10th frame */
|
||||||
if (!strcmp(cbuf, "AVID")) {
|
if (!strcmp(cbuf, "AVID")) {
|
||||||
s->buggy_avid = 1;
|
s->buggy_avid = 1;
|
||||||
// if (s->first_picture)
|
|
||||||
// printf("mjpeg: workarounding buggy AVID\n");
|
|
||||||
} else if (!strcmp(cbuf, "CS=ITU601"))
|
} else if (!strcmp(cbuf, "CS=ITU601"))
|
||||||
s->cs_itu601 = 1;
|
s->cs_itu601 = 1;
|
||||||
else if ((len > 31 && !strncmp(cbuf, "Intel(R) JPEG Library, version 1", 32)) ||
|
else if ((len > 31 && !strncmp(cbuf, "Intel(R) JPEG Library, version 1", 32)) ||
|
||||||
@ -1741,9 +1734,6 @@ eoi_parser:
|
|||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"mjpeg: unsupported coding type (%x)\n", start_code);
|
"mjpeg: unsupported coding type (%x)\n", start_code);
|
||||||
break;
|
break;
|
||||||
// default:
|
|
||||||
// printf("mjpeg: unsupported marker (%x)\n", start_code);
|
|
||||||
// break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eof process start code */
|
/* eof process start code */
|
||||||
|
@ -339,7 +339,6 @@ static void escape_FF(MpegEncContext *s, int start)
|
|||||||
int v= buf[i];
|
int v= buf[i];
|
||||||
|
|
||||||
if(v==0xFF){
|
if(v==0xFF){
|
||||||
//printf("%d %d\n", i, ff_count);
|
|
||||||
buf[i+ff_count]= 0;
|
buf[i+ff_count]= 0;
|
||||||
ff_count--;
|
ff_count--;
|
||||||
}
|
}
|
||||||
|
@ -395,12 +395,10 @@ static int sad_hpel_motion_search(MpegEncContext * s,
|
|||||||
assert(flags == 0);
|
assert(flags == 0);
|
||||||
|
|
||||||
if(c->skip){
|
if(c->skip){
|
||||||
// printf("S");
|
|
||||||
*mx_ptr = 0;
|
*mx_ptr = 0;
|
||||||
*my_ptr = 0;
|
*my_ptr = 0;
|
||||||
return dmin;
|
return dmin;
|
||||||
}
|
}
|
||||||
// printf("N");
|
|
||||||
|
|
||||||
pix = c->src[src_index][0];
|
pix = c->src[src_index][0];
|
||||||
|
|
||||||
@ -1325,7 +1323,6 @@ static int ff_estimate_motion_b(MpegEncContext * s,
|
|||||||
if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
|
if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
|
||||||
dmin= get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1);
|
dmin= get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1);
|
||||||
|
|
||||||
//printf("%d %d %d %d//", s->mb_x, s->mb_y, mx, my);
|
|
||||||
// s->mb_type[mb_y*s->mb_width + mb_x]= mb_type;
|
// s->mb_type[mb_y*s->mb_width + mb_x]= mb_type;
|
||||||
mv_table[mot_xy][0]= mx;
|
mv_table[mot_xy][0]= mx;
|
||||||
mv_table[mot_xy][1]= my;
|
mv_table[mot_xy][1]= my;
|
||||||
@ -1734,11 +1731,11 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
|
|||||||
|
|
||||||
c->skip=0;
|
c->skip=0;
|
||||||
bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor;
|
bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor;
|
||||||
//printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]);
|
av_dlog(s, " %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]);
|
||||||
|
|
||||||
c->skip=0;
|
c->skip=0;
|
||||||
fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor;
|
fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor;
|
||||||
//printf("%d %d %d %d\n", dmin, fmin, bmin, fbmin);
|
av_dlog(s, "%d %d %d %d\n", dmin, fmin, bmin, fbmin);
|
||||||
|
|
||||||
if(s->flags & CODEC_FLAG_INTERLACED_ME){
|
if(s->flags & CODEC_FLAG_INTERLACED_ME){
|
||||||
//FIXME mb type penalty
|
//FIXME mb type penalty
|
||||||
@ -1848,15 +1845,9 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
|
|||||||
best_score= score[i];
|
best_score= score[i];
|
||||||
best_fcode= i;
|
best_fcode= i;
|
||||||
}
|
}
|
||||||
// printf("%d %d\n", i, score[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("fcode: %d type: %d\n", i, s->pict_type);
|
|
||||||
return best_fcode;
|
return best_fcode;
|
||||||
/* for(i=0; i<=MAX_FCODE; i++){
|
|
||||||
printf("%d ", mv_num[i]);
|
|
||||||
}
|
|
||||||
printf("\n");*/
|
|
||||||
}else{
|
}else{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1876,7 +1867,6 @@ void ff_fix_long_p_mvs(MpegEncContext * s)
|
|||||||
|
|
||||||
if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range;
|
if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range;
|
||||||
|
|
||||||
//printf("%d no:%d %d//\n", clip, noclip, f_code);
|
|
||||||
if(s->flags&CODEC_FLAG_4MV){
|
if(s->flags&CODEC_FLAG_4MV){
|
||||||
const int wrap= s->b8_stride;
|
const int wrap= s->b8_stride;
|
||||||
|
|
||||||
|
@ -363,13 +363,11 @@ static int qpel_motion_search(MpegEncContext * s,
|
|||||||
av_assert2((x) <= xmax);\
|
av_assert2((x) <= xmax);\
|
||||||
av_assert2((y) >= ymin);\
|
av_assert2((y) >= ymin);\
|
||||||
av_assert2((y) <= ymax);\
|
av_assert2((y) <= ymax);\
|
||||||
/*printf("check_mv %d %d\n", x, y);*/\
|
|
||||||
if(map[index]!=key){\
|
if(map[index]!=key){\
|
||||||
d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
|
d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
|
||||||
map[index]= key;\
|
map[index]= key;\
|
||||||
score_map[index]= d;\
|
score_map[index]= d;\
|
||||||
d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\
|
d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\
|
||||||
/*printf("score:%d\n", d);*/\
|
|
||||||
COPY3_IF_LT(dmin, d, best[0], x, best[1], y)\
|
COPY3_IF_LT(dmin, d, best[0], x, best[1], y)\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
@ -387,13 +385,11 @@ static int qpel_motion_search(MpegEncContext * s,
|
|||||||
{\
|
{\
|
||||||
const unsigned key = ((y)<<ME_MAP_MV_BITS) + (x) + map_generation;\
|
const unsigned key = ((y)<<ME_MAP_MV_BITS) + (x) + map_generation;\
|
||||||
const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\
|
const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\
|
||||||
/*printf("check_mv_dir %d %d %d\n", x, y, new_dir);*/\
|
|
||||||
if(map[index]!=key){\
|
if(map[index]!=key){\
|
||||||
d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
|
d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
|
||||||
map[index]= key;\
|
map[index]= key;\
|
||||||
score_map[index]= d;\
|
score_map[index]= d;\
|
||||||
d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\
|
d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\
|
||||||
/*printf("score:%d\n", d);*/\
|
|
||||||
if(d<dmin){\
|
if(d<dmin){\
|
||||||
best[0]=x;\
|
best[0]=x;\
|
||||||
best[1]=y;\
|
best[1]=y;\
|
||||||
@ -444,7 +440,6 @@ static av_always_inline int small_diamond_search(MpegEncContext * s, int *best,
|
|||||||
const int y= best[1];
|
const int y= best[1];
|
||||||
next_dir=-1;
|
next_dir=-1;
|
||||||
|
|
||||||
//printf("%d", dir);
|
|
||||||
if(dir!=2 && x>xmin) CHECK_MV_DIR(x-1, y , 0)
|
if(dir!=2 && x>xmin) CHECK_MV_DIR(x-1, y , 0)
|
||||||
if(dir!=3 && y>ymin) CHECK_MV_DIR(x , y-1, 1)
|
if(dir!=3 && y>ymin) CHECK_MV_DIR(x , y-1, 1)
|
||||||
if(dir!=0 && x<xmax) CHECK_MV_DIR(x+1, y , 2)
|
if(dir!=0 && x<xmax) CHECK_MV_DIR(x+1, y , 2)
|
||||||
@ -656,13 +651,11 @@ static int full_search(MpegEncContext * s, int *best, int dmin,
|
|||||||
{\
|
{\
|
||||||
const unsigned key = ((ay)<<ME_MAP_MV_BITS) + (ax) + map_generation;\
|
const unsigned key = ((ay)<<ME_MAP_MV_BITS) + (ax) + map_generation;\
|
||||||
const int index= (((ay)<<ME_MAP_SHIFT) + (ax))&(ME_MAP_SIZE-1);\
|
const int index= (((ay)<<ME_MAP_SHIFT) + (ax))&(ME_MAP_SIZE-1);\
|
||||||
/*printf("sab check %d %d\n", ax, ay);*/\
|
|
||||||
if(map[index]!=key){\
|
if(map[index]!=key){\
|
||||||
d= cmp(s, ax, ay, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
|
d= cmp(s, ax, ay, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
|
||||||
map[index]= key;\
|
map[index]= key;\
|
||||||
score_map[index]= d;\
|
score_map[index]= d;\
|
||||||
d += (mv_penalty[((ax)<<shift)-pred_x] + mv_penalty[((ay)<<shift)-pred_y])*penalty_factor;\
|
d += (mv_penalty[((ax)<<shift)-pred_x] + mv_penalty[((ay)<<shift)-pred_y])*penalty_factor;\
|
||||||
/*printf("score: %d\n", d);*/\
|
|
||||||
if(d < minima[minima_count-1].height){\
|
if(d < minima[minima_count-1].height){\
|
||||||
int j=0;\
|
int j=0;\
|
||||||
\
|
\
|
||||||
@ -970,7 +963,6 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int
|
|||||||
*mx_ptr= best[0];
|
*mx_ptr= best[0];
|
||||||
*my_ptr= best[1];
|
*my_ptr= best[1];
|
||||||
|
|
||||||
// printf("%d %d %d \n", best[0], best[1], dmin);
|
|
||||||
return dmin;
|
return dmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1016,7 +1008,7 @@ static int epzs_motion_search4(MpegEncContext * s,
|
|||||||
map_generation= update_map_generation(c);
|
map_generation= update_map_generation(c);
|
||||||
|
|
||||||
dmin = 1000000;
|
dmin = 1000000;
|
||||||
//printf("%d %d %d %d //",xmin, ymin, xmax, ymax);
|
|
||||||
/* first line */
|
/* first line */
|
||||||
if (s->first_slice_line) {
|
if (s->first_slice_line) {
|
||||||
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
|
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
|
||||||
@ -1046,7 +1038,6 @@ static int epzs_motion_search4(MpegEncContext * s,
|
|||||||
*mx_ptr= best[0];
|
*mx_ptr= best[0];
|
||||||
*my_ptr= best[1];
|
*my_ptr= best[1];
|
||||||
|
|
||||||
// printf("%d %d %d \n", best[0], best[1], dmin);
|
|
||||||
return dmin;
|
return dmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1076,7 +1067,7 @@ static int epzs_motion_search2(MpegEncContext * s,
|
|||||||
map_generation= update_map_generation(c);
|
map_generation= update_map_generation(c);
|
||||||
|
|
||||||
dmin = 1000000;
|
dmin = 1000000;
|
||||||
//printf("%d %d %d %d //",xmin, ymin, xmax, ymax);
|
|
||||||
/* first line */
|
/* first line */
|
||||||
if (s->first_slice_line) {
|
if (s->first_slice_line) {
|
||||||
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
|
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
|
||||||
@ -1106,6 +1097,5 @@ static int epzs_motion_search2(MpegEncContext * s,
|
|||||||
*mx_ptr= best[0];
|
*mx_ptr= best[0];
|
||||||
*my_ptr= best[1];
|
*my_ptr= best[1];
|
||||||
|
|
||||||
// printf("%d %d %d \n", best[0], best[1], dmin);
|
|
||||||
return dmin;
|
return dmin;
|
||||||
}
|
}
|
||||||
|
@ -1326,8 +1326,10 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
|
|||||||
//res_change_ffmpeg_aspect.ts 4/3 225/44 ->4/3
|
//res_change_ffmpeg_aspect.ts 4/3 225/44 ->4/3
|
||||||
//widescreen-issue562.mpg 4/3 16/9 -> 16/9
|
//widescreen-issue562.mpg 4/3 16/9 -> 16/9
|
||||||
// s->avctx->sample_aspect_ratio = av_mul_q(s->avctx->sample_aspect_ratio, (AVRational) {s->width, s->height});
|
// s->avctx->sample_aspect_ratio = av_mul_q(s->avctx->sample_aspect_ratio, (AVRational) {s->width, s->height});
|
||||||
//av_log(NULL, AV_LOG_ERROR, "A %d/%d\n", ff_mpeg2_aspect[s->aspect_ratio_info].num, ff_mpeg2_aspect[s->aspect_ratio_info].den);
|
av_dlog(avctx, "A %d/%d\n",
|
||||||
//av_log(NULL, AV_LOG_ERROR, "B %d/%d\n", s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den);
|
ff_mpeg2_aspect[s->aspect_ratio_info].num, ff_mpeg2_aspect[s->aspect_ratio_info].den);
|
||||||
|
av_dlog(avctx, "B %d/%d\n", s->avctx->sample_aspect_ratio.num,
|
||||||
|
s->avctx->sample_aspect_ratio.den);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s->avctx->sample_aspect_ratio =
|
s->avctx->sample_aspect_ratio =
|
||||||
@ -1881,7 +1883,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
|
|||||||
}
|
}
|
||||||
eos: // end of slice
|
eos: // end of slice
|
||||||
*buf += (get_bits_count(&s->gb)-1)/8;
|
*buf += (get_bits_count(&s->gb)-1)/8;
|
||||||
//printf("y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y);
|
av_dlog(s, "y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1900,8 +1902,9 @@ static int slice_decode_thread(AVCodecContext *c, void *arg)
|
|||||||
|
|
||||||
ret = mpeg_decode_slice(s, mb_y, &buf, s->gb.buffer_end - buf);
|
ret = mpeg_decode_slice(s, mb_y, &buf, s->gb.buffer_end - buf);
|
||||||
emms_c();
|
emms_c();
|
||||||
//av_log(c, AV_LOG_DEBUG, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
|
av_dlog(c, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
|
||||||
//ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, s->start_mb_y, s->end_mb_y, s->error_count);
|
ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y,
|
||||||
|
s->start_mb_y, s->end_mb_y, s->error_count);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (c->err_recognition & AV_EF_EXPLODE)
|
if (c->err_recognition & AV_EF_EXPLODE)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -892,9 +892,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
|
|||||||
int pos = get_bits_count(&s->gb);
|
int pos = get_bits_count(&s->gb);
|
||||||
|
|
||||||
if (pos >= end_pos){
|
if (pos >= end_pos){
|
||||||
// av_log(NULL, AV_LOG_ERROR, "pos: %d %d %d %d\n", pos, end_pos, end_pos2, s_index);
|
|
||||||
switch_buffer(s, &pos, &end_pos, &end_pos2);
|
switch_buffer(s, &pos, &end_pos, &end_pos2);
|
||||||
// av_log(NULL, AV_LOG_ERROR, "new pos: %d %d\n", pos, end_pos);
|
|
||||||
if (pos >= end_pos)
|
if (pos >= end_pos)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -968,9 +966,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
|
|||||||
s_index=0;
|
s_index=0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// av_log(NULL, AV_LOG_ERROR, "pos2: %d %d %d %d\n", pos, end_pos, end_pos2, s_index);
|
|
||||||
switch_buffer(s, &pos, &end_pos, &end_pos2);
|
switch_buffer(s, &pos, &end_pos, &end_pos2);
|
||||||
// av_log(NULL, AV_LOG_ERROR, "new pos2: %d %d %d\n", pos, end_pos, s_index);
|
|
||||||
if (pos >= end_pos)
|
if (pos >= end_pos)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -993,7 +989,6 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
|
|||||||
}
|
}
|
||||||
/* skip extension bits */
|
/* skip extension bits */
|
||||||
bits_left = end_pos2 - get_bits_count(&s->gb);
|
bits_left = end_pos2 - get_bits_count(&s->gb);
|
||||||
//av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer);
|
|
||||||
if (bits_left < 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_COMPLIANT))) {
|
if (bits_left < 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_COMPLIANT))) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
|
av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
|
||||||
s_index=0;
|
s_index=0;
|
||||||
@ -1406,8 +1401,8 @@ static int mp_decode_layer3(MPADecodeContext *s)
|
|||||||
int extrasize = av_clip(get_bits_left(&s->gb) >> 3, 0, EXTRABYTES);
|
int extrasize = av_clip(get_bits_left(&s->gb) >> 3, 0, EXTRABYTES);
|
||||||
av_assert1((get_bits_count(&s->gb) & 7) == 0);
|
av_assert1((get_bits_count(&s->gb) & 7) == 0);
|
||||||
/* now we get bits from the main_data_begin offset */
|
/* now we get bits from the main_data_begin offset */
|
||||||
av_dlog(s->avctx, "seekback: %d\n", main_data_begin);
|
av_dlog(s->avctx, "seekback:%d, lastbuf:%d\n",
|
||||||
//av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size);
|
main_data_begin, s->last_buf_size);
|
||||||
|
|
||||||
memcpy(s->last_buf + s->last_buf_size, ptr, extrasize);
|
memcpy(s->last_buf + s->last_buf_size, ptr, extrasize);
|
||||||
s->in_gb = s->gb;
|
s->in_gb = s->gb;
|
||||||
|
@ -1383,12 +1383,12 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
|
|||||||
if (!s->dropable)
|
if (!s->dropable)
|
||||||
s->next_picture_ptr = s->current_picture_ptr;
|
s->next_picture_ptr = s->current_picture_ptr;
|
||||||
}
|
}
|
||||||
/* av_log(s->avctx, AV_LOG_DEBUG, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
|
av_dlog(s->avctx, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
|
||||||
s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr,
|
s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr,
|
||||||
s->last_picture_ptr ? s->last_picture_ptr->f.data[0] : NULL,
|
s->last_picture_ptr ? s->last_picture_ptr->f.data[0] : NULL,
|
||||||
s->next_picture_ptr ? s->next_picture_ptr->f.data[0] : NULL,
|
s->next_picture_ptr ? s->next_picture_ptr->f.data[0] : NULL,
|
||||||
s->current_picture_ptr ? s->current_picture_ptr->f.data[0] : NULL,
|
s->current_picture_ptr ? s->current_picture_ptr->f.data[0] : NULL,
|
||||||
s->pict_type, s->dropable); */
|
s->pict_type, s->dropable);
|
||||||
|
|
||||||
if (s->codec_id != AV_CODEC_ID_H264) {
|
if (s->codec_id != AV_CODEC_ID_H264) {
|
||||||
if ((s->last_picture_ptr == NULL ||
|
if ((s->last_picture_ptr == NULL ||
|
||||||
@ -1738,7 +1738,6 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
|
|||||||
else
|
else
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, " ");
|
av_log(s->avctx, AV_LOG_DEBUG, " ");
|
||||||
}
|
}
|
||||||
// av_log(s->avctx, AV_LOG_DEBUG, " ");
|
|
||||||
}
|
}
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "\n");
|
av_log(s->avctx, AV_LOG_DEBUG, "\n");
|
||||||
}
|
}
|
||||||
|
@ -1011,8 +1011,8 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
|
|||||||
if (pic_arg->linesize[2] != s->uvlinesize)
|
if (pic_arg->linesize[2] != s->uvlinesize)
|
||||||
direct = 0;
|
direct = 0;
|
||||||
|
|
||||||
//av_log(AV_LOG_DEBUG, "%d %d %d %d\n",pic_arg->linesize[0],
|
av_dlog(s->avctx, "%d %d %d %d\n", pic_arg->linesize[0],
|
||||||
// pic_arg->linesize[1], s->linesize, s->uvlinesize);
|
pic_arg->linesize[1], s->linesize, s->uvlinesize);
|
||||||
|
|
||||||
if (direct) {
|
if (direct) {
|
||||||
i = ff_find_unused_picture(s, 1);
|
i = ff_find_unused_picture(s, 1);
|
||||||
@ -1291,10 +1291,6 @@ static int select_input_picture(MpegEncContext *s)
|
|||||||
if (s->picture_in_gop_number < s->gop_size &&
|
if (s->picture_in_gop_number < s->gop_size &&
|
||||||
skip_check(s, s->input_picture[0], s->next_picture_ptr)) {
|
skip_check(s, s->input_picture[0], s->next_picture_ptr)) {
|
||||||
// FIXME check that te gop check above is +-1 correct
|
// FIXME check that te gop check above is +-1 correct
|
||||||
//av_log(NULL, AV_LOG_DEBUG, "skip %p %"PRId64"\n",
|
|
||||||
// s->input_picture[0]->f.data[0],
|
|
||||||
// s->input_picture[0]->pts);
|
|
||||||
|
|
||||||
if (s->input_picture[0]->f.type == FF_BUFFER_TYPE_SHARED) {
|
if (s->input_picture[0]->f.type == FF_BUFFER_TYPE_SHARED) {
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
s->input_picture[0]->f.data[i] = NULL;
|
s->input_picture[0]->f.data[i] = NULL;
|
||||||
@ -1366,9 +1362,6 @@ static int select_input_picture(MpegEncContext *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
emms_c();
|
emms_c();
|
||||||
//static int b_count = 0;
|
|
||||||
//b_count += b_frames;
|
|
||||||
//av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count);
|
|
||||||
|
|
||||||
for (i = b_frames - 1; i >= 0; i--) {
|
for (i = b_frames - 1; i >= 0; i--) {
|
||||||
int type = s->input_picture[i]->f.pict_type;
|
int type = s->input_picture[i]->f.pict_type;
|
||||||
@ -1462,7 +1455,6 @@ no_output_pic:
|
|||||||
ff_copy_picture(&s->current_picture, s->current_picture_ptr);
|
ff_copy_picture(&s->current_picture, s->current_picture_ptr);
|
||||||
|
|
||||||
s->picture_number = s->new_picture.f.display_picture_number;
|
s->picture_number = s->new_picture.f.display_picture_number;
|
||||||
//printf("dpn:%d\n", s->picture_number);
|
|
||||||
} else {
|
} else {
|
||||||
memset(&s->new_picture, 0, sizeof(Picture));
|
memset(&s->new_picture, 0, sizeof(Picture));
|
||||||
}
|
}
|
||||||
@ -1508,8 +1500,6 @@ int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
|
|
||||||
s->pict_type = s->new_picture.f.pict_type;
|
s->pict_type = s->new_picture.f.pict_type;
|
||||||
//emms_c();
|
//emms_c();
|
||||||
//printf("qs:%f %f %d\n", s->new_picture.quality,
|
|
||||||
// s->current_picture.quality, s->qscale);
|
|
||||||
ff_MPV_frame_start(s, avctx);
|
ff_MPV_frame_start(s, avctx);
|
||||||
vbv_retry:
|
vbv_retry:
|
||||||
if (encode_picture(s, s->picture_number) < 0)
|
if (encode_picture(s, s->picture_number) < 0)
|
||||||
@ -1558,7 +1548,6 @@ vbv_retry:
|
|||||||
s->time_base = s->last_time_base;
|
s->time_base = s->last_time_base;
|
||||||
s->last_non_b_time = s->time - s->pp_time;
|
s->last_non_b_time = s->time - s->pp_time;
|
||||||
}
|
}
|
||||||
//av_log(NULL, AV_LOG_ERROR, "R:%d ", s->next_lambda);
|
|
||||||
for (i = 0; i < context_count; i++) {
|
for (i = 0; i < context_count; i++) {
|
||||||
PutBitContext *pb = &s->thread_context[i]->pb;
|
PutBitContext *pb = &s->thread_context[i]->pb;
|
||||||
init_put_bits(pb, pb->buf, pb->buf_end - pb->buf);
|
init_put_bits(pb, pb->buf, pb->buf_end - pb->buf);
|
||||||
@ -2463,7 +2452,6 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
|||||||
uint8_t bit_buf2[2][MAX_MB_BYTES];
|
uint8_t bit_buf2[2][MAX_MB_BYTES];
|
||||||
uint8_t bit_buf_tex[2][MAX_MB_BYTES];
|
uint8_t bit_buf_tex[2][MAX_MB_BYTES];
|
||||||
PutBitContext pb[2], pb2[2], tex_pb[2];
|
PutBitContext pb[2], pb2[2], tex_pb[2];
|
||||||
//printf("%d->%d\n", s->resync_mb_y, s->end_mb_y);
|
|
||||||
|
|
||||||
ff_check_alignment();
|
ff_check_alignment();
|
||||||
|
|
||||||
@ -2518,7 +2506,6 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
|||||||
s->first_slice_line = 1;
|
s->first_slice_line = 1;
|
||||||
s->ptr_lastgob = s->pb.buf;
|
s->ptr_lastgob = s->pb.buf;
|
||||||
for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
|
for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
|
||||||
// printf("row %d at %X\n", s->mb_y, (int)s);
|
|
||||||
s->mb_x=0;
|
s->mb_x=0;
|
||||||
s->mb_y= mb_y;
|
s->mb_y= mb_y;
|
||||||
|
|
||||||
@ -2992,7 +2979,6 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
|||||||
s->mb_intra= 0;
|
s->mb_intra= 0;
|
||||||
motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
|
motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
|
||||||
motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
|
motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
|
||||||
// printf(" %d %d ", motion_x, motion_y);
|
|
||||||
break;
|
break;
|
||||||
case CANDIDATE_MB_TYPE_FORWARD_I:
|
case CANDIDATE_MB_TYPE_FORWARD_I:
|
||||||
s->mv_dir = MV_DIR_FORWARD;
|
s->mv_dir = MV_DIR_FORWARD;
|
||||||
@ -3069,7 +3055,8 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
|||||||
if(CONFIG_H263_ENCODER && s->out_format == FMT_H263)
|
if(CONFIG_H263_ENCODER && s->out_format == FMT_H263)
|
||||||
ff_h263_loop_filter(s);
|
ff_h263_loop_filter(s);
|
||||||
}
|
}
|
||||||
//printf("MB %d %d bits\n", s->mb_x+s->mb_y*s->mb_stride, put_bits_count(&s->pb));
|
av_dlog(s->avctx, "MB %d %d bits\n",
|
||||||
|
s->mb_x + s->mb_y * s->mb_stride, put_bits_count(&s->pb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3162,7 +3149,6 @@ static int estimate_qp(MpegEncContext *s, int dry_run){
|
|||||||
//FIXME broken
|
//FIXME broken
|
||||||
}else
|
}else
|
||||||
s->lambda = s->current_picture.f.quality;
|
s->lambda = s->current_picture.f.quality;
|
||||||
//printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality);
|
|
||||||
update_qscale(s);
|
update_qscale(s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3272,8 +3258,10 @@ static int encode_picture(MpegEncContext *s, int picture_number)
|
|||||||
s->pict_type= AV_PICTURE_TYPE_I;
|
s->pict_type= AV_PICTURE_TYPE_I;
|
||||||
for(i=0; i<s->mb_stride*s->mb_height; i++)
|
for(i=0; i<s->mb_stride*s->mb_height; i++)
|
||||||
s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
|
s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
|
||||||
//printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
|
if(s->msmpeg4_version >= 3)
|
||||||
if(s->msmpeg4_version >= 3) s->no_rounding=1;
|
s->no_rounding=1;
|
||||||
|
av_dlog(s, "Scene change detected, encoding as I Frame %d %d\n",
|
||||||
|
s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!s->umvplus){
|
if(!s->umvplus){
|
||||||
|
@ -380,7 +380,7 @@ static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
|
|||||||
int code, val, sign, shift;
|
int code, val, sign, shift;
|
||||||
|
|
||||||
code = get_vlc2(&s->gb, v2_mv_vlc.table, V2_MV_VLC_BITS, 2);
|
code = get_vlc2(&s->gb, v2_mv_vlc.table, V2_MV_VLC_BITS, 2);
|
||||||
// printf("MV code %d at %d %d pred: %d\n", code, s->mb_x,s->mb_y, pred);
|
av_dlog(s, "MV code %d at %d %d pred: %d\n", code, s->mb_x,s->mb_y, pred);
|
||||||
if (code < 0)
|
if (code < 0)
|
||||||
return 0xffff;
|
return 0xffff;
|
||||||
|
|
||||||
@ -547,7 +547,6 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
|
|||||||
|
|
||||||
if (!s->mb_intra) {
|
if (!s->mb_intra) {
|
||||||
int mx, my;
|
int mx, my;
|
||||||
//printf("P at %d %d\n", s->mb_x, s->mb_y);
|
|
||||||
if(s->per_mb_rl_table && cbp){
|
if(s->per_mb_rl_table && cbp){
|
||||||
s->rl_table_index = decode012(&s->gb);
|
s->rl_table_index = decode012(&s->gb);
|
||||||
s->rl_chroma_table_index = s->rl_table_index;
|
s->rl_chroma_table_index = s->rl_table_index;
|
||||||
@ -561,12 +560,15 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
|
|||||||
s->mv[0][0][1] = my;
|
s->mv[0][0][1] = my;
|
||||||
*mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16;
|
*mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16;
|
||||||
} else {
|
} else {
|
||||||
//printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24));
|
av_dlog(s, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
|
||||||
|
((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0),
|
||||||
|
show_bits(&s->gb, 24));
|
||||||
s->ac_pred = get_bits1(&s->gb);
|
s->ac_pred = get_bits1(&s->gb);
|
||||||
*mb_type_ptr = MB_TYPE_INTRA;
|
*mb_type_ptr = MB_TYPE_INTRA;
|
||||||
if(s->inter_intra_pred){
|
if(s->inter_intra_pred){
|
||||||
s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1);
|
s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1);
|
||||||
// printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
|
av_dlog(s, "%d%d %d %d/",
|
||||||
|
s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
|
||||||
}
|
}
|
||||||
if(s->per_mb_rl_table && cbp){
|
if(s->per_mb_rl_table && cbp){
|
||||||
s->rl_table_index = decode012(&s->gb);
|
s->rl_table_index = decode012(&s->gb);
|
||||||
@ -841,7 +843,8 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s)
|
|||||||
s->no_rounding = 0;
|
s->no_rounding = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height);
|
av_dlog(s->avctx, "%d %d %d %d %d\n", s->pict_type, s->bit_rate,
|
||||||
|
s->inter_intra_pred, s->width, s->height);
|
||||||
|
|
||||||
s->esc3_level_length= 0;
|
s->esc3_level_length= 0;
|
||||||
s->esc3_run_length= 0;
|
s->esc3_run_length= 0;
|
||||||
@ -862,8 +865,6 @@ int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
|
|||||||
s->flipflop_rounding= get_bits1(&s->gb);
|
s->flipflop_rounding= get_bits1(&s->gb);
|
||||||
else
|
else
|
||||||
s->flipflop_rounding= 0;
|
s->flipflop_rounding= 0;
|
||||||
|
|
||||||
// printf("fps:%2d bps:%2d roundingType:%1d\n", fps, s->bit_rate/1024, s->flipflop_rounding);
|
|
||||||
}
|
}
|
||||||
else if(left<length+8)
|
else if(left<length+8)
|
||||||
{
|
{
|
||||||
@ -1030,7 +1031,8 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
|
|||||||
last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
|
last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
|
||||||
if(!s->esc3_level_length){
|
if(!s->esc3_level_length){
|
||||||
int ll;
|
int ll;
|
||||||
//printf("ESC-3 %X at %d %d\n", show_bits(&s->gb, 24), s->mb_x, s->mb_y);
|
av_dlog(s->avctx, "ESC-3 %X at %d %d\n",
|
||||||
|
show_bits(&s->gb, 24), s->mb_x, s->mb_y);
|
||||||
if(s->qscale<8){
|
if(s->qscale<8){
|
||||||
ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
|
ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
|
||||||
if(ll==0){
|
if(ll==0){
|
||||||
@ -1047,7 +1049,6 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
|
|||||||
|
|
||||||
s->esc3_level_length= ll;
|
s->esc3_level_length= ll;
|
||||||
s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2);
|
s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2);
|
||||||
//printf("level length:%d, run length: %d\n", ll, s->esc3_run_length);
|
|
||||||
UPDATE_CACHE(re, &s->gb);
|
UPDATE_CACHE(re, &s->gb);
|
||||||
}
|
}
|
||||||
run= SHOW_UBITS(re, &s->gb, s->esc3_run_length);
|
run= SHOW_UBITS(re, &s->gb, s->esc3_run_length);
|
||||||
@ -1060,7 +1061,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
|
|||||||
SKIP_BITS(re, &s->gb, s->esc3_level_length);
|
SKIP_BITS(re, &s->gb, s->esc3_level_length);
|
||||||
if(sign) level= -level;
|
if(sign) level= -level;
|
||||||
}
|
}
|
||||||
//printf("level: %d, run: %d at %d %d\n", level, run, s->mb_x, s->mb_y);
|
|
||||||
#if 0 // waste of time / this will detect very few errors
|
#if 0 // waste of time / this will detect very few errors
|
||||||
{
|
{
|
||||||
const int abs_level= FFABS(level);
|
const int abs_level= FFABS(level);
|
||||||
@ -1186,7 +1187,6 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (code == mv->n) {
|
if (code == mv->n) {
|
||||||
//printf("MV ESC %X at %d %d\n", show_bits(&s->gb, 24), s->mb_x, s->mb_y);
|
|
||||||
mx = get_bits(&s->gb, 6);
|
mx = get_bits(&s->gb, 6);
|
||||||
my = get_bits(&s->gb, 6);
|
my = get_bits(&s->gb, 6);
|
||||||
} else {
|
} else {
|
||||||
|
@ -193,9 +193,6 @@ static void find_best_tables(MpegEncContext * s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("type:%d, best:%d, qp:%d, var:%d, mcvar:%d, size:%d //\n",
|
|
||||||
// s->pict_type, best, s->qscale, s->mb_var_sum, s->mc_mb_var_sum, best_size);
|
|
||||||
|
|
||||||
if(s->pict_type==AV_PICTURE_TYPE_P) chroma_best= best;
|
if(s->pict_type==AV_PICTURE_TYPE_P) chroma_best= best;
|
||||||
|
|
||||||
memset(s->ac_stats, 0, sizeof(int)*(MAX_LEVEL+1)*(MAX_RUN+1)*2*2*2);
|
memset(s->ac_stats, 0, sizeof(int)*(MAX_LEVEL+1)*(MAX_RUN+1)*2*2*2);
|
||||||
@ -233,7 +230,8 @@ void ff_msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
|
|||||||
s->per_mb_rl_table = 0;
|
s->per_mb_rl_table = 0;
|
||||||
if(s->msmpeg4_version==4)
|
if(s->msmpeg4_version==4)
|
||||||
s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==AV_PICTURE_TYPE_P);
|
s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==AV_PICTURE_TYPE_P);
|
||||||
//printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height);
|
av_dlog(s, "%d %d %d %d %d\n", s->pict_type, s->bit_rate,
|
||||||
|
s->inter_intra_pred, s->width, s->height);
|
||||||
|
|
||||||
if (s->pict_type == AV_PICTURE_TYPE_I) {
|
if (s->pict_type == AV_PICTURE_TYPE_I) {
|
||||||
s->slice_height= s->mb_height/1;
|
s->slice_height= s->mb_height/1;
|
||||||
|
@ -150,7 +150,6 @@ int av_parser_parse2(AVCodecParserContext *s,
|
|||||||
|
|
||||||
/* WARNING: the returned index can be negative */
|
/* WARNING: the returned index can be negative */
|
||||||
index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size);
|
index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size);
|
||||||
//av_log(NULL, AV_LOG_DEBUG, "parser: in:%"PRId64", %"PRId64", out:%"PRId64", %"PRId64", in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id);
|
|
||||||
/* update the file pointer */
|
/* update the file pointer */
|
||||||
if (*poutbuf_size) {
|
if (*poutbuf_size) {
|
||||||
/* fill the data for the current frame */
|
/* fill the data for the current frame */
|
||||||
|
@ -131,13 +131,11 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
|
|||||||
unsigned int bit_buf;
|
unsigned int bit_buf;
|
||||||
int bit_left;
|
int bit_left;
|
||||||
|
|
||||||
// printf("put_bits=%d %x\n", n, value);
|
|
||||||
av_assert2(n <= 31 && value < (1U << n));
|
av_assert2(n <= 31 && value < (1U << n));
|
||||||
|
|
||||||
bit_buf = s->bit_buf;
|
bit_buf = s->bit_buf;
|
||||||
bit_left = s->bit_left;
|
bit_left = s->bit_left;
|
||||||
|
|
||||||
// printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);
|
|
||||||
/* XXX: optimize */
|
/* XXX: optimize */
|
||||||
#ifdef BITSTREAM_WRITER_LE
|
#ifdef BITSTREAM_WRITER_LE
|
||||||
bit_buf |= value << (32 - bit_left);
|
bit_buf |= value << (32 - bit_left);
|
||||||
@ -158,7 +156,6 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
|
|||||||
bit_buf |= value >> (n - bit_left);
|
bit_buf |= value >> (n - bit_left);
|
||||||
av_assert2(s->buf_ptr+3<s->buf_end);
|
av_assert2(s->buf_ptr+3<s->buf_end);
|
||||||
AV_WB32(s->buf_ptr, bit_buf);
|
AV_WB32(s->buf_ptr, bit_buf);
|
||||||
//printf("bitbuf = %08x\n", bit_buf);
|
|
||||||
s->buf_ptr+=4;
|
s->buf_ptr+=4;
|
||||||
bit_left+=32 - n;
|
bit_left+=32 - n;
|
||||||
bit_buf = value;
|
bit_buf = value;
|
||||||
|
@ -283,7 +283,8 @@ int ff_vbv_update(MpegEncContext *s, int frame_size){
|
|||||||
const double min_rate= s->avctx->rc_min_rate/fps;
|
const double min_rate= s->avctx->rc_min_rate/fps;
|
||||||
const double max_rate= s->avctx->rc_max_rate/fps;
|
const double max_rate= s->avctx->rc_max_rate/fps;
|
||||||
|
|
||||||
//av_log(0,0, "%d %f %d %f %f\n", buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate);
|
av_dlog(s, "%d %f %d %f %f\n",
|
||||||
|
buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate);
|
||||||
if(buffer_size){
|
if(buffer_size){
|
||||||
int left;
|
int left;
|
||||||
|
|
||||||
@ -457,7 +458,6 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q,
|
|||||||
if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==AV_PICTURE_TYPE_P)
|
if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==AV_PICTURE_TYPE_P)
|
||||||
q*= s->avctx->rc_qmod_amp;
|
q*= s->avctx->rc_qmod_amp;
|
||||||
|
|
||||||
//printf("q:%f\n", q);
|
|
||||||
/* buffer overflow/underflow protection */
|
/* buffer overflow/underflow protection */
|
||||||
if(buffer_size){
|
if(buffer_size){
|
||||||
double expected_size= rcc->buffer_index;
|
double expected_size= rcc->buffer_index;
|
||||||
@ -493,7 +493,9 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("q:%f max:%f min:%f size:%f index:%d bits:%f agr:%f\n", q,max_rate, min_rate, buffer_size, rcc->buffer_index, bits, s->avctx->rc_buffer_aggressivity);
|
av_dlog(s, "q:%f max:%f min:%f size:%f index:%f agr:%f\n",
|
||||||
|
q, max_rate, min_rate, buffer_size, rcc->buffer_index,
|
||||||
|
s->avctx->rc_buffer_aggressivity);
|
||||||
if(s->avctx->rc_qsquish==0.0 || qmin==qmax){
|
if(s->avctx->rc_qsquish==0.0 || qmin==qmax){
|
||||||
if (q<qmin) q=qmin;
|
if (q<qmin) q=qmin;
|
||||||
else if(q>qmax) q=qmax;
|
else if(q>qmax) q=qmax;
|
||||||
@ -636,8 +638,6 @@ static void adaptive_quantization(MpegEncContext *s, double q){
|
|||||||
|
|
||||||
if (intq > qmax) intq= qmax;
|
if (intq > qmax) intq= qmax;
|
||||||
else if(intq < qmin) intq= qmin;
|
else if(intq < qmin) intq= qmin;
|
||||||
//if(i%s->mb_width==0) printf("\n");
|
|
||||||
//printf("%2d%3d ", intq, ff_sqrt(s->mc_mb_var[i]));
|
|
||||||
s->lambda_table[mb_xy]= intq;
|
s->lambda_table[mb_xy]= intq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -682,7 +682,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
|
|||||||
get_qminmax(&qmin, &qmax, s, pict_type);
|
get_qminmax(&qmin, &qmax, s, pict_type);
|
||||||
|
|
||||||
fps= get_fps(s->avctx);
|
fps= get_fps(s->avctx);
|
||||||
//printf("input_pic_num:%d pic_num:%d frame_rate:%d\n", s->input_picture_number, s->picture_number, s->frame_rate);
|
|
||||||
/* update predictors */
|
/* update predictors */
|
||||||
if(picture_number>2 && !dry_run){
|
if(picture_number>2 && !dry_run){
|
||||||
const int last_var= s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum;
|
const int last_var= s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum;
|
||||||
@ -706,9 +705,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
|
|||||||
else
|
else
|
||||||
dts_pic= s->last_picture_ptr;
|
dts_pic= s->last_picture_ptr;
|
||||||
|
|
||||||
//if(dts_pic)
|
|
||||||
// av_log(NULL, AV_LOG_ERROR, "%"PRId64" %"PRId64" %"PRId64" %d\n", s->current_picture_ptr->pts, s->user_specified_pts, dts_pic->pts, picture_number);
|
|
||||||
|
|
||||||
if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE)
|
if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE)
|
||||||
wanted_bits= (uint64_t)(s->bit_rate*(double)picture_number/fps);
|
wanted_bits= (uint64_t)(s->bit_rate*(double)picture_number/fps);
|
||||||
else
|
else
|
||||||
@ -727,7 +723,8 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
|
|||||||
assert(pict_type == rce->new_pict_type);
|
assert(pict_type == rce->new_pict_type);
|
||||||
|
|
||||||
q= rce->new_qscale / br_compensation;
|
q= rce->new_qscale / br_compensation;
|
||||||
//printf("%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, br_compensation, s->frame_bits, var, pict_type);
|
av_dlog(s, "%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale,
|
||||||
|
br_compensation, s->frame_bits, var, pict_type);
|
||||||
}else{
|
}else{
|
||||||
rce->pict_type=
|
rce->pict_type=
|
||||||
rce->new_pict_type= pict_type;
|
rce->new_pict_type= pict_type;
|
||||||
@ -764,9 +761,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
assert(q>0.0);
|
assert(q>0.0);
|
||||||
//printf("%f ", q);
|
|
||||||
q= get_diff_limited_q(s, rce, q);
|
q= get_diff_limited_q(s, rce, q);
|
||||||
//printf("%f ", q);
|
|
||||||
assert(q>0.0);
|
assert(q>0.0);
|
||||||
|
|
||||||
if(pict_type==AV_PICTURE_TYPE_P || s->intra_only){ //FIXME type dependent blur like in 2-pass
|
if(pict_type==AV_PICTURE_TYPE_P || s->intra_only){ //FIXME type dependent blur like in 2-pass
|
||||||
@ -775,9 +770,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
|
|||||||
|
|
||||||
rcc->short_term_qsum+= q;
|
rcc->short_term_qsum+= q;
|
||||||
rcc->short_term_qcount++;
|
rcc->short_term_qcount++;
|
||||||
//printf("%f ", q);
|
|
||||||
q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount;
|
q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount;
|
||||||
//printf("%f ", q);
|
|
||||||
}
|
}
|
||||||
assert(q>0.0);
|
assert(q>0.0);
|
||||||
|
|
||||||
@ -908,18 +901,15 @@ static int init_pass2(MpegEncContext *s)
|
|||||||
double bits;
|
double bits;
|
||||||
rce->new_qscale= modify_qscale(s, rce, blurred_qscale[i], i);
|
rce->new_qscale= modify_qscale(s, rce, blurred_qscale[i], i);
|
||||||
bits= qp2bits(rce, rce->new_qscale) + rce->mv_bits + rce->misc_bits;
|
bits= qp2bits(rce, rce->new_qscale) + rce->mv_bits + rce->misc_bits;
|
||||||
//printf("%d %f\n", rce->new_bits, blurred_qscale[i]);
|
|
||||||
bits += 8*ff_vbv_update(s, bits);
|
bits += 8*ff_vbv_update(s, bits);
|
||||||
|
|
||||||
rce->expected_bits= expected_bits;
|
rce->expected_bits= expected_bits;
|
||||||
expected_bits += bits;
|
expected_bits += bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
av_dlog(s->avctx,
|
||||||
av_log(s->avctx, AV_LOG_INFO,
|
"expected_bits: %f all_available_bits: %d rate_factor: %f\n",
|
||||||
"expected_bits: %f all_available_bits: %d rate_factor: %f\n",
|
expected_bits, (int)all_available_bits, rate_factor);
|
||||||
expected_bits, (int)all_available_bits, rate_factor);
|
|
||||||
*/
|
|
||||||
if(expected_bits > all_available_bits) {
|
if(expected_bits > all_available_bits) {
|
||||||
rate_factor-= step;
|
rate_factor-= step;
|
||||||
++toobig;
|
++toobig;
|
||||||
@ -931,8 +921,10 @@ static int init_pass2(MpegEncContext *s)
|
|||||||
/* check bitrate calculations and print info */
|
/* check bitrate calculations and print info */
|
||||||
qscale_sum = 0.0;
|
qscale_sum = 0.0;
|
||||||
for(i=0; i<rcc->num_entries; i++){
|
for(i=0; i<rcc->num_entries; i++){
|
||||||
/* av_log(s->avctx, AV_LOG_DEBUG, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n",
|
av_dlog(s, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n",
|
||||||
i, rcc->entry[i].new_qscale, rcc->entry[i].new_qscale / FF_QP2LAMBDA); */
|
i,
|
||||||
|
rcc->entry[i].new_qscale,
|
||||||
|
rcc->entry[i].new_qscale / FF_QP2LAMBDA);
|
||||||
qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax);
|
qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax);
|
||||||
}
|
}
|
||||||
assert(toobig <= 40);
|
assert(toobig <= 40);
|
||||||
|
@ -399,7 +399,6 @@ static int rv20_decode_picture_header(RVDecContext *rv)
|
|||||||
|
|
||||||
mb_pos = ff_h263_decode_mba(s);
|
mb_pos = ff_h263_decode_mba(s);
|
||||||
|
|
||||||
//av_log(s->avctx, AV_LOG_DEBUG, "%d\n", seq);
|
|
||||||
seq |= s->time &~0x7FFF;
|
seq |= s->time &~0x7FFF;
|
||||||
if(seq - s->time > 0x4000) seq -= 0x8000;
|
if(seq - s->time > 0x4000) seq -= 0x8000;
|
||||||
if(seq - s->time < -0x4000) seq += 0x8000;
|
if(seq - s->time < -0x4000) seq += 0x8000;
|
||||||
@ -418,11 +417,7 @@ static int rv20_decode_picture_header(RVDecContext *rv)
|
|||||||
ff_mpeg4_init_direct_mv(s);
|
ff_mpeg4_init_direct_mv(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// printf("%d %d %d %d %d\n", seq, (int)s->time, (int)s->last_non_b_time, s->pp_time, s->pb_time);
|
|
||||||
/*for(i=0; i<32; i++){
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
|
|
||||||
}
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "\n");*/
|
|
||||||
s->no_rounding= get_bits1(&s->gb);
|
s->no_rounding= get_bits1(&s->gb);
|
||||||
|
|
||||||
if(RV_GET_MINOR_VER(rv->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B)
|
if(RV_GET_MINOR_VER(rv->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B)
|
||||||
|
@ -521,8 +521,8 @@ static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
|
|||||||
|
|
||||||
csum = ff_svq1_packet_checksum (bitbuf->buffer, bitbuf->size_in_bits>>3, csum);
|
csum = ff_svq1_packet_checksum (bitbuf->buffer, bitbuf->size_in_bits>>3, csum);
|
||||||
|
|
||||||
// av_log(s->avctx, AV_LOG_INFO, "%s checksum (%02x) for packet data\n",
|
av_dlog(s->avctx, "%s checksum (%02x) for packet data\n",
|
||||||
// (csum == 0) ? "correct" : "incorrect", csum);
|
(csum == 0) ? "correct" : "incorrect", csum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((s->f_code ^ 0x10) >= 0x50) {
|
if ((s->f_code ^ 0x10) >= 0x50) {
|
||||||
|
@ -610,7 +610,6 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
|
|||||||
for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
|
for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
|
||||||
pic->data[i] = NULL;
|
pic->data[i] = NULL;
|
||||||
// pic->base[i]=NULL;
|
// pic->base[i]=NULL;
|
||||||
//printf("R%X\n", pic->opaque);
|
|
||||||
|
|
||||||
if (s->debug & FF_DEBUG_BUFFERS)
|
if (s->debug & FF_DEBUG_BUFFERS)
|
||||||
av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d "
|
av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d "
|
||||||
|
@ -395,8 +395,6 @@ int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitCo
|
|||||||
v->res_rtm_flag = get_bits1(gb); //reserved
|
v->res_rtm_flag = get_bits1(gb); //reserved
|
||||||
}
|
}
|
||||||
if (!v->res_rtm_flag) {
|
if (!v->res_rtm_flag) {
|
||||||
// av_log(avctx, AV_LOG_ERROR,
|
|
||||||
// "0 for reserved RES_RTM_FLAG is forbidden\n");
|
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Old WMV3 version detected, some frames may be decoded incorrectly\n");
|
"Old WMV3 version detected, some frames may be decoded incorrectly\n");
|
||||||
//return -1;
|
//return -1;
|
||||||
@ -663,8 +661,9 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
|
|||||||
v->x8_type = get_bits1(gb);
|
v->x8_type = get_bits1(gb);
|
||||||
} else
|
} else
|
||||||
v->x8_type = 0;
|
v->x8_type = 0;
|
||||||
//av_log(v->s.avctx, AV_LOG_INFO, "%c Frame: QP=[%i]%i (+%i/2) %i\n",
|
av_dlog(v->s.avctx, "%c Frame: QP=[%i]%i (+%i/2) %i\n",
|
||||||
// (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'), pqindex, v->pq, v->halfpq, v->rangeredfrm);
|
(v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'),
|
||||||
|
pqindex, v->pq, v->halfpq, v->rangeredfrm);
|
||||||
|
|
||||||
if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P)
|
if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P)
|
||||||
v->use_ic = 0;
|
v->use_ic = 0;
|
||||||
|
@ -5637,7 +5637,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
s->linesize >>= 1;
|
s->linesize >>= 1;
|
||||||
s->uvlinesize >>= 1;
|
s->uvlinesize >>= 1;
|
||||||
}
|
}
|
||||||
//av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits);
|
av_dlog(s->avctx, "Consumed %i/%i bits\n",
|
||||||
|
get_bits_count(&s->gb), s->gb.size_in_bits);
|
||||||
// if (get_bits_count(&s->gb) > buf_size * 8)
|
// if (get_bits_count(&s->gb) > buf_size * 8)
|
||||||
// return -1;
|
// return -1;
|
||||||
if(s->error_occurred && s->pict_type == AV_PICTURE_TYPE_B)
|
if(s->error_occurred && s->pict_type == AV_PICTURE_TYPE_B)
|
||||||
|
@ -66,10 +66,8 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
|
|||||||
|
|
||||||
for (p = 0; (bits[p] == 0) && (p < num); ++p)
|
for (p = 0; (bits[p] == 0) && (p < num); ++p)
|
||||||
;
|
;
|
||||||
if (p == num) {
|
if (p == num)
|
||||||
// av_log(vc->avccontext, AV_LOG_INFO, "An empty codebook. Heh?! \n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
codes[p] = 0;
|
codes[p] = 0;
|
||||||
if (bits[p] > 32)
|
if (bits[p] > 32)
|
||||||
|
@ -2068,7 +2068,8 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
token = get_bits(gb, 5);
|
token = get_bits(gb, 5);
|
||||||
//av_log(avctx, AV_LOG_DEBUG, "hti %d hbits %x token %d entry : %d size %d\n", s->hti, s->hbits, token, s->entries, s->huff_code_size);
|
av_dlog(avctx, "hti %d hbits %x token %d entry : %d size %d\n",
|
||||||
|
s->hti, s->hbits, token, s->entries, s->huff_code_size);
|
||||||
s->huffman_table[s->hti][token][0] = s->hbits;
|
s->huffman_table[s->hti][token][0] = s->hbits;
|
||||||
s->huffman_table[s->hti][token][1] = s->huff_code_size;
|
s->huffman_table[s->hti][token][1] = s->huff_code_size;
|
||||||
s->entries++;
|
s->entries++;
|
||||||
|
@ -95,8 +95,6 @@ static int wma_decode_init(AVCodecContext * avctx)
|
|||||||
} else if (avctx->codec->id == AV_CODEC_ID_WMAV2 && avctx->extradata_size >= 6) {
|
} else if (avctx->codec->id == AV_CODEC_ID_WMAV2 && avctx->extradata_size >= 6) {
|
||||||
flags2 = AV_RL16(extradata+4);
|
flags2 = AV_RL16(extradata+4);
|
||||||
}
|
}
|
||||||
// for(i=0; i<avctx->extradata_size; i++)
|
|
||||||
// av_log(NULL, AV_LOG_ERROR, "%02X ", extradata[i]);
|
|
||||||
|
|
||||||
s->use_exp_vlc = flags2 & 0x0001;
|
s->use_exp_vlc = flags2 & 0x0001;
|
||||||
s->use_bit_reservoir = flags2 & 0x0002;
|
s->use_bit_reservoir = flags2 & 0x0002;
|
||||||
@ -866,7 +864,6 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s->last_superframe_len > 0) {
|
if (s->last_superframe_len > 0) {
|
||||||
// printf("skip=%d\n", s->last_bitoffset);
|
|
||||||
/* add bit_offset bits to last frame */
|
/* add bit_offset bits to last frame */
|
||||||
if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) >
|
if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) >
|
||||||
MAX_CODED_SUPERFRAME_SIZE)
|
MAX_CODED_SUPERFRAME_SIZE)
|
||||||
@ -929,7 +926,9 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
|
|||||||
samples += s->nb_channels * s->frame_len;
|
samples += s->nb_channels * s->frame_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d outbytes:%d eaten:%d\n", s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len, (int8_t *)samples - (int8_t *)data, s->block_align);
|
av_dlog(s->avctx, "%d %d %d %d outbytes:%d eaten:%d\n",
|
||||||
|
s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len,
|
||||||
|
(int8_t *)samples - (int8_t *)data, s->block_align);
|
||||||
|
|
||||||
*got_frame_ptr = 1;
|
*got_frame_ptr = 1;
|
||||||
*(AVFrame *)data = s->frame;
|
*(AVFrame *)data = s->frame;
|
||||||
|
@ -82,7 +82,6 @@ static int encode_init(AVCodecContext * avctx){
|
|||||||
(avctx->sample_rate * 8);
|
(avctx->sample_rate * 8);
|
||||||
s->block_align = FFMIN(s->block_align, MAX_CODED_SUPERFRAME_SIZE);
|
s->block_align = FFMIN(s->block_align, MAX_CODED_SUPERFRAME_SIZE);
|
||||||
avctx->block_align = s->block_align;
|
avctx->block_align = s->block_align;
|
||||||
//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d\n", s->block_align, avctx->bit_rate, s->frame_len, avctx->sample_rate);
|
|
||||||
avctx->frame_size = avctx->delay = s->frame_len;
|
avctx->frame_size = avctx->delay = s->frame_len;
|
||||||
|
|
||||||
#if FF_API_OLD_ENCODE_AUDIO
|
#if FF_API_OLD_ENCODE_AUDIO
|
||||||
|
@ -244,8 +244,6 @@ static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){
|
|||||||
else
|
else
|
||||||
w->hshift= 0;
|
w->hshift= 0;
|
||||||
|
|
||||||
//printf("%d %d ", *mx_ptr, *my_ptr);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +312,6 @@ static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n,
|
|||||||
// const uint8_t *scantable= w->abt_type-1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
|
// const uint8_t *scantable= w->abt_type-1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
|
||||||
|
|
||||||
sub_cbp= sub_cbp_table[ decode012(&s->gb) ];
|
sub_cbp= sub_cbp_table[ decode012(&s->gb) ];
|
||||||
// printf("S%d", sub_cbp);
|
|
||||||
|
|
||||||
if(sub_cbp&1){
|
if(sub_cbp&1){
|
||||||
if (ff_msmpeg4_decode_block(s, block, n, 1, scantable) < 0)
|
if (ff_msmpeg4_decode_block(s, block, n, 1, scantable) < 0)
|
||||||
@ -385,7 +382,6 @@ int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
|
|||||||
|
|
||||||
if (!s->mb_intra) {
|
if (!s->mb_intra) {
|
||||||
int mx, my;
|
int mx, my;
|
||||||
//printf("P at %d %d\n", s->mb_x, s->mb_y);
|
|
||||||
wmv2_pred_motion(w, &mx, &my);
|
wmv2_pred_motion(w, &mx, &my);
|
||||||
|
|
||||||
if(cbp){
|
if(cbp){
|
||||||
@ -419,13 +415,16 @@ int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//if(s->pict_type==AV_PICTURE_TYPE_P)
|
if (s->pict_type==AV_PICTURE_TYPE_P)
|
||||||
// printf("%d%d ", s->inter_intra_pred, cbp);
|
av_dlog(s->avctx, "%d%d ", s->inter_intra_pred, cbp);
|
||||||
//printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24));
|
av_dlog(s->avctx, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
|
||||||
|
((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0),
|
||||||
|
show_bits(&s->gb, 24));
|
||||||
s->ac_pred = get_bits1(&s->gb);
|
s->ac_pred = get_bits1(&s->gb);
|
||||||
if(s->inter_intra_pred){
|
if(s->inter_intra_pred){
|
||||||
s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1);
|
s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1);
|
||||||
// printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
|
av_dlog(s->avctx, "%d%d %d %d/",
|
||||||
|
s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
|
||||||
}
|
}
|
||||||
if(s->per_mb_rl_table && cbp){
|
if(s->per_mb_rl_table && cbp){
|
||||||
s->rl_table_index = decode012(&s->gb);
|
s->rl_table_index = decode012(&s->gb);
|
||||||
|
@ -51,7 +51,7 @@ static void dct_unquantize_h263_intra_mmx(MpegEncContext *s,
|
|||||||
nCoeffs=63;
|
nCoeffs=63;
|
||||||
else
|
else
|
||||||
nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
|
nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
|
||||||
//printf("%d %d ", qmul, qadd);
|
|
||||||
__asm__ volatile(
|
__asm__ volatile(
|
||||||
"movd %1, %%mm6 \n\t" //qmul
|
"movd %1, %%mm6 \n\t" //qmul
|
||||||
"packssdw %%mm6, %%mm6 \n\t"
|
"packssdw %%mm6, %%mm6 \n\t"
|
||||||
@ -114,7 +114,7 @@ static void dct_unquantize_h263_inter_mmx(MpegEncContext *s,
|
|||||||
assert(s->block_last_index[n]>=0 || s->h263_aic);
|
assert(s->block_last_index[n]>=0 || s->h263_aic);
|
||||||
|
|
||||||
nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
|
nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
|
||||||
//printf("%d %d ", qmul, qadd);
|
|
||||||
__asm__ volatile(
|
__asm__ volatile(
|
||||||
"movd %1, %%mm6 \n\t" //qmul
|
"movd %1, %%mm6 \n\t" //qmul
|
||||||
"packssdw %%mm6, %%mm6 \n\t"
|
"packssdw %%mm6, %%mm6 \n\t"
|
||||||
|
@ -103,15 +103,8 @@ int main(void)
|
|||||||
double ideal[SAMPLES];
|
double ideal[SAMPLES];
|
||||||
double samples[SAMPLES];
|
double samples[SAMPLES];
|
||||||
double samplet[SAMPLES];
|
double samplet[SAMPLES];
|
||||||
#if 1
|
|
||||||
for (n0 = 0; n0 < 40; n0 = 2 * n0 + 1) {
|
for (n0 = 0; n0 < 40; n0 = 2 * n0 + 1) {
|
||||||
for (n1 = 0; n1 < 10; n1 = 2 * n1 + 1) {
|
for (n1 = 0; n1 < 10; n1 = 2 * n1 + 1) {
|
||||||
#else
|
|
||||||
{
|
|
||||||
{
|
|
||||||
n0 = 7;
|
|
||||||
n1 = 1;
|
|
||||||
#endif
|
|
||||||
double best_error = 1000000000;
|
double best_error = 1000000000;
|
||||||
double bestpar0 = 1;
|
double bestpar0 = 1;
|
||||||
double bestpar1 = 1;
|
double bestpar1 = 1;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
|
#include "libavutil/attributes.h"
|
||||||
#include "libavutil/bswap.h"
|
#include "libavutil/bswap.h"
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/avstring.h"
|
#include "libavutil/avstring.h"
|
||||||
@ -420,9 +421,6 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
|
|||||||
avio_rl16(pb); //ds_data_size
|
avio_rl16(pb); //ds_data_size
|
||||||
avio_r8(pb); //ds_silence_data
|
avio_r8(pb); //ds_silence_data
|
||||||
}
|
}
|
||||||
//printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n",
|
|
||||||
// asf_st->ds_packet_size, asf_st->ds_chunk_size,
|
|
||||||
// asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data);
|
|
||||||
if (asf_st->ds_span > 1) {
|
if (asf_st->ds_span > 1) {
|
||||||
if (!asf_st->ds_chunk_size
|
if (!asf_st->ds_chunk_size
|
||||||
|| (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)
|
|| (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)
|
||||||
@ -443,7 +441,6 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
|
|||||||
st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */
|
st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */
|
||||||
tag1 = avio_rl32(pb);
|
tag1 = avio_rl32(pb);
|
||||||
avio_skip(pb, 20);
|
avio_skip(pb, 20);
|
||||||
// av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
|
|
||||||
if (sizeX > 40) {
|
if (sizeX > 40) {
|
||||||
st->codec->extradata_size = sizeX - 40;
|
st->codec->extradata_size = sizeX - 40;
|
||||||
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
@ -614,16 +611,18 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size)
|
|||||||
|
|
||||||
for(i=0;i<n;i++) {
|
for(i=0;i<n;i++) {
|
||||||
char name[1024];
|
char name[1024];
|
||||||
|
int av_unused value_type;
|
||||||
|
|
||||||
avio_rl16(pb); //lang_list_index
|
avio_rl16(pb); //lang_list_index
|
||||||
stream_num= avio_rl16(pb);
|
stream_num= avio_rl16(pb);
|
||||||
name_len= avio_rl16(pb);
|
name_len= avio_rl16(pb);
|
||||||
avio_skip(pb, 2); /* value_type */
|
value_type = avio_rl16(pb); /* value_type */
|
||||||
value_len= avio_rl32(pb);
|
value_len= avio_rl32(pb);
|
||||||
|
|
||||||
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
|
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
|
||||||
avio_skip(pb, name_len - ret);
|
avio_skip(pb, name_len - ret);
|
||||||
//av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name);
|
av_dlog(s, "%d %d %d %d %d <%s>\n",
|
||||||
|
i, stream_num, name_len, value_type, value_len, name);
|
||||||
value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
|
value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
|
||||||
avio_skip(pb, value_len - 2);
|
avio_skip(pb, value_len - 2);
|
||||||
|
|
||||||
@ -689,9 +688,7 @@ static int asf_read_header(AVFormatContext *s)
|
|||||||
uint64_t gpos= avio_tell(pb);
|
uint64_t gpos= avio_tell(pb);
|
||||||
ff_get_guid(pb, &g);
|
ff_get_guid(pb, &g);
|
||||||
gsize = avio_rl64(pb);
|
gsize = avio_rl64(pb);
|
||||||
av_dlog(s, "%08"PRIx64": ", gpos);
|
|
||||||
print_guid(&g);
|
print_guid(&g);
|
||||||
av_dlog(s, " size=0x%"PRIx64"\n", gsize);
|
|
||||||
if (!ff_guidcmp(&g, &ff_asf_data_header)) {
|
if (!ff_guidcmp(&g, &ff_asf_data_header)) {
|
||||||
asf->data_object_offset = avio_tell(pb);
|
asf->data_object_offset = avio_tell(pb);
|
||||||
// if not streaming, gsize is not unlimited (how?), and there is enough space in the file..
|
// if not streaming, gsize is not unlimited (how?), and there is enough space in the file..
|
||||||
@ -784,7 +781,9 @@ static int asf_read_header(AVFormatContext *s)
|
|||||||
&st->sample_aspect_ratio.num,
|
&st->sample_aspect_ratio.num,
|
||||||
asf->dar[0].num, asf->dar[0].den, INT_MAX);
|
asf->dar[0].num, asf->dar[0].den, INT_MAX);
|
||||||
|
|
||||||
//av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
|
av_dlog(s, "i=%d, st->codec->codec_type:%d, asf->dar %d:%d sar=%d:%d\n",
|
||||||
|
i, st->codec->codec_type, asf->dar[i].num, asf->dar[i].den,
|
||||||
|
st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
|
||||||
|
|
||||||
// copy and convert language codes to the frontend
|
// copy and convert language codes to the frontend
|
||||||
if (asf->streams[i].stream_language_index < 128) {
|
if (asf->streams[i].stream_language_index < 128) {
|
||||||
@ -926,7 +925,9 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
|
|||||||
DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0);
|
DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0);
|
||||||
DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0);
|
DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0);
|
||||||
DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);
|
DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);
|
||||||
//printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size);
|
av_dlog(asf, "key:%d stream:%d seq:%d offset:%d replic_size:%d\n",
|
||||||
|
asf->packet_key_frame, asf->stream_index, asf->packet_seq,
|
||||||
|
asf->packet_frag_offset, asf->packet_replic_size);
|
||||||
if (rsize+asf->packet_replic_size > asf->packet_size_left) {
|
if (rsize+asf->packet_replic_size > asf->packet_size_left) {
|
||||||
av_log(s, AV_LOG_ERROR, "packet_replic_size %d is invalid\n", asf->packet_replic_size);
|
av_log(s, AV_LOG_ERROR, "packet_replic_size %d is invalid\n", asf->packet_replic_size);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -939,9 +940,6 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
|
|||||||
}
|
}
|
||||||
asf->packet_frag_timestamp = avio_rl32(pb); // timestamp
|
asf->packet_frag_timestamp = avio_rl32(pb); // timestamp
|
||||||
if(asf->packet_replic_size >= 8+38+4){
|
if(asf->packet_replic_size >= 8+38+4){
|
||||||
// for(i=0; i<asf->packet_replic_size-8; i++)
|
|
||||||
// av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb));
|
|
||||||
// av_log(s, AV_LOG_DEBUG, "\n");
|
|
||||||
avio_skip(pb, 10);
|
avio_skip(pb, 10);
|
||||||
ts0= avio_rl64(pb);
|
ts0= avio_rl64(pb);
|
||||||
ts1= avio_rl64(pb);
|
ts1= avio_rl64(pb);
|
||||||
@ -980,10 +978,8 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
|
|||||||
asf->packet_padsize -= diff;
|
asf->packet_padsize -= diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("Fragsize %d\n", asf->packet_frag_size);
|
|
||||||
} else {
|
} else {
|
||||||
asf->packet_frag_size = asf->packet_size_left - rsize;
|
asf->packet_frag_size = asf->packet_size_left - rsize;
|
||||||
//printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize);
|
|
||||||
}
|
}
|
||||||
if (asf->packet_replic_size == 1) {
|
if (asf->packet_replic_size == 1) {
|
||||||
asf->packet_multi_size = asf->packet_frag_size;
|
asf->packet_multi_size = asf->packet_frag_size;
|
||||||
@ -991,7 +987,6 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
asf->packet_size_left -= rsize;
|
asf->packet_size_left -= rsize;
|
||||||
//printf("___objsize____ %d %d rs:%d\n", asf->packet_obj_size, asf->packet_frag_offset, rsize);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1017,7 +1012,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
|
|||||||
|| asf->packet_segments < 1) {
|
|| asf->packet_segments < 1) {
|
||||||
//asf->packet_size_left <= asf->packet_padsize) {
|
//asf->packet_size_left <= asf->packet_padsize) {
|
||||||
int ret = asf->packet_size_left + asf->packet_padsize;
|
int ret = asf->packet_size_left + asf->packet_padsize;
|
||||||
//printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb));
|
|
||||||
assert(ret>=0);
|
assert(ret>=0);
|
||||||
/* fail safe */
|
/* fail safe */
|
||||||
avio_skip(pb, ret);
|
avio_skip(pb, ret);
|
||||||
@ -1064,7 +1058,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
asf->packet_multi_size -= asf->packet_obj_size;
|
asf->packet_multi_size -= asf->packet_obj_size;
|
||||||
//printf("COMPRESS size %d %d %d ms:%d\n", asf->packet_obj_size, asf->packet_frag_timestamp, asf->packet_size_left, asf->packet_multi_size);
|
|
||||||
}
|
}
|
||||||
if( /*asf->packet_frag_size == asf->packet_obj_size*/
|
if( /*asf->packet_frag_size == asf->packet_obj_size*/
|
||||||
asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size
|
asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size
|
||||||
@ -1100,9 +1093,11 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
|
|||||||
asf_st->palette_changed = 0;
|
asf_st->palette_changed = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
|
av_dlog(asf, "new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
|
||||||
//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY,
|
asf->stream_index, asf->packet_key_frame,
|
||||||
//s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size);
|
asf_st->pkt.flags & AV_PKT_FLAG_KEY,
|
||||||
|
s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO,
|
||||||
|
asf->packet_obj_size);
|
||||||
if (s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
if (s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||||
asf->packet_key_frame = 1;
|
asf->packet_key_frame = 1;
|
||||||
if (asf->packet_key_frame)
|
if (asf->packet_key_frame)
|
||||||
@ -1110,9 +1105,9 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* read data */
|
/* read data */
|
||||||
//printf("READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n",
|
av_dlog(asf, "READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n",
|
||||||
// s->packet_size, asf_st->pkt.size, asf->packet_frag_offset,
|
s->packet_size, asf_st->pkt.size, asf->packet_frag_offset,
|
||||||
// asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data);
|
asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data);
|
||||||
asf->packet_size_left -= asf->packet_frag_size;
|
asf->packet_size_left -= asf->packet_frag_size;
|
||||||
if (asf->packet_size_left < 0)
|
if (asf->packet_size_left < 0)
|
||||||
continue;
|
continue;
|
||||||
@ -1174,8 +1169,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
|
|||||||
int row = off / asf_st->ds_span;
|
int row = off / asf_st->ds_span;
|
||||||
int col = off % asf_st->ds_span;
|
int col = off % asf_st->ds_span;
|
||||||
int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size;
|
int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size;
|
||||||
//printf("off:%d row:%d col:%d idx:%d\n", off, row, col, idx);
|
|
||||||
|
|
||||||
assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size);
|
assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size);
|
||||||
assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size);
|
assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size);
|
||||||
memcpy(newdata + offset,
|
memcpy(newdata + offset,
|
||||||
@ -1190,7 +1183,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
|
|||||||
}
|
}
|
||||||
asf_st->frag_offset = 0;
|
asf_st->frag_offset = 0;
|
||||||
*pkt= asf_st->pkt;
|
*pkt= asf_st->pkt;
|
||||||
//printf("packet %d %d\n", asf_st->pkt.size, asf->packet_frag_size);
|
|
||||||
asf_st->pkt.size = 0;
|
asf_st->pkt.size = 0;
|
||||||
asf_st->pkt.data = 0;
|
asf_st->pkt.data = 0;
|
||||||
asf_st->pkt.side_data_elems = 0;
|
asf_st->pkt.side_data_elems = 0;
|
||||||
@ -1280,7 +1272,6 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
|
|||||||
if (avio_seek(s->pb, pos, SEEK_SET) < 0)
|
if (avio_seek(s->pb, pos, SEEK_SET) < 0)
|
||||||
return AV_NOPTS_VALUE;
|
return AV_NOPTS_VALUE;
|
||||||
|
|
||||||
//printf("asf_read_pts\n");
|
|
||||||
asf_reset_header(s);
|
asf_reset_header(s);
|
||||||
for(;;){
|
for(;;){
|
||||||
if (av_read_frame(s, pkt) < 0){
|
if (av_read_frame(s, pkt) < 0){
|
||||||
@ -1308,8 +1299,6 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*ppos= pos;
|
*ppos= pos;
|
||||||
//printf("found keyframe at %"PRId64" stream %d stamp:%"PRId64"\n", *ppos, stream_index, pts);
|
|
||||||
|
|
||||||
return pts;
|
return pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ static int64_t get_pts(const uint8_t *p)
|
|||||||
if(sscanf(p, "%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4)
|
if(sscanf(p, "%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4)
|
||||||
return AV_NOPTS_VALUE;
|
return AV_NOPTS_VALUE;
|
||||||
|
|
||||||
// av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d [%s]\n", i, hour, min, sec, hsec, p);
|
av_dlog(NULL, "%d %d %d %d [%s]\n", hour, min, sec, hsec, p);
|
||||||
|
|
||||||
min+= 60*hour;
|
min+= 60*hour;
|
||||||
sec+= 60*min;
|
sec+= 60*min;
|
||||||
|
@ -545,7 +545,8 @@ static int avi_read_header(AVFormatContext *s)
|
|||||||
}
|
}
|
||||||
ast->sample_size = avio_rl32(pb); /* sample ssize */
|
ast->sample_size = avio_rl32(pb); /* sample ssize */
|
||||||
ast->cum_len *= FFMAX(1, ast->sample_size);
|
ast->cum_len *= FFMAX(1, ast->sample_size);
|
||||||
// av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
|
av_dlog(s, "%"PRIu32" %"PRIu32" %d\n",
|
||||||
|
ast->rate, ast->scale, ast->sample_size);
|
||||||
|
|
||||||
switch(tag1) {
|
switch(tag1) {
|
||||||
case MKTAG('v', 'i', 'd', 's'):
|
case MKTAG('v', 'i', 'd', 's'):
|
||||||
@ -743,7 +744,9 @@ static int avi_read_header(AVFormatContext *s)
|
|||||||
|
|
||||||
if(active_aspect.num && active_aspect.den && active.num && active.den){
|
if(active_aspect.num && active_aspect.den && active.num && active.den){
|
||||||
st->sample_aspect_ratio= av_div_q(active_aspect, active);
|
st->sample_aspect_ratio= av_div_q(active_aspect, active);
|
||||||
//av_log(s, AV_LOG_ERROR, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den);
|
av_dlog(s, "vprp %d/%d %d/%d\n",
|
||||||
|
active_aspect.num, active_aspect.den,
|
||||||
|
active.num, active.den);
|
||||||
}
|
}
|
||||||
size -= 9*4;
|
size -= 9*4;
|
||||||
}
|
}
|
||||||
@ -921,7 +924,8 @@ start_sync:
|
|||||||
size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
|
size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
|
||||||
|
|
||||||
n= get_stream_idx(d+2);
|
n= get_stream_idx(d+2);
|
||||||
//av_log(s, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
|
av_dlog(s, "%X %X %X %X %X %X %X %X %"PRId64" %u %d\n",
|
||||||
|
d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
|
||||||
if(i + (uint64_t)size > avi->fsize || d[0] > 127)
|
if(i + (uint64_t)size > avi->fsize || d[0] > 127)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -931,7 +935,6 @@ start_sync:
|
|||||||
||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
|
||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
|
||||||
||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
|
||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
|
||||||
avio_skip(pb, size);
|
avio_skip(pb, size);
|
||||||
//av_log(s, AV_LOG_DEBUG, "SKIP\n");
|
|
||||||
goto start_sync;
|
goto start_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1010,7 +1013,6 @@ start_sync:
|
|||||||
|
|
||||||
if (exit_early)
|
if (exit_early)
|
||||||
return 0;
|
return 0;
|
||||||
//av_log(s, AV_LOG_DEBUG, "OK\n");
|
|
||||||
if(d[2]*256+d[3] == ast->prefix)
|
if(d[2]*256+d[3] == ast->prefix)
|
||||||
ast->prefix_count++;
|
ast->prefix_count++;
|
||||||
else{
|
else{
|
||||||
@ -1073,7 +1075,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
|
|
||||||
ts = av_rescale_q(ts, st->time_base, (AVRational){FFMAX(1, ast->sample_size), AV_TIME_BASE});
|
ts = av_rescale_q(ts, st->time_base, (AVRational){FFMAX(1, ast->sample_size), AV_TIME_BASE});
|
||||||
|
|
||||||
// av_log(s, AV_LOG_DEBUG, "%"PRId64" %d/%d %"PRId64"\n", ts, st->time_base.num, st->time_base.den, ast->frame_offset);
|
av_dlog(s, "%"PRId64" %d/%d %"PRId64"\n", ts,
|
||||||
|
st->time_base.num, st->time_base.den, ast->frame_offset);
|
||||||
if(ts < best_ts){
|
if(ts < best_ts){
|
||||||
best_ts= ts;
|
best_ts= ts;
|
||||||
best_st= st;
|
best_st= st;
|
||||||
@ -1093,13 +1096,11 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
best_ast->frame_offset= best_st->index_entries[i].timestamp;
|
best_ast->frame_offset= best_st->index_entries[i].timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// av_log(s, AV_LOG_DEBUG, "%d\n", i);
|
|
||||||
if(i>=0){
|
if(i>=0){
|
||||||
int64_t pos= best_st->index_entries[i].pos;
|
int64_t pos= best_st->index_entries[i].pos;
|
||||||
pos += best_ast->packet_size - best_ast->remaining;
|
pos += best_ast->packet_size - best_ast->remaining;
|
||||||
if(avio_seek(s->pb, pos + 8, SEEK_SET) < 0)
|
if(avio_seek(s->pb, pos + 8, SEEK_SET) < 0)
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
// av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
|
|
||||||
|
|
||||||
av_assert0(best_ast->remaining <= best_ast->packet_size);
|
av_assert0(best_ast->remaining <= best_ast->packet_size);
|
||||||
|
|
||||||
@ -1168,7 +1169,9 @@ resync:
|
|||||||
// pkt->dts += ast->start;
|
// pkt->dts += ast->start;
|
||||||
if(ast->sample_size)
|
if(ast->sample_size)
|
||||||
pkt->dts /= ast->sample_size;
|
pkt->dts /= ast->sample_size;
|
||||||
//av_log(s, AV_LOG_DEBUG, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size);
|
av_dlog(s, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n",
|
||||||
|
pkt->dts, ast->frame_offset, ast->scale, ast->rate,
|
||||||
|
ast->sample_size, AV_TIME_BASE, avi->stream_index, size);
|
||||||
pkt->stream_index = avi->stream_index;
|
pkt->stream_index = avi->stream_index;
|
||||||
|
|
||||||
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
|
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||||
@ -1457,7 +1460,8 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
|
|||||||
pos = st->index_entries[index].pos;
|
pos = st->index_entries[index].pos;
|
||||||
timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1);
|
timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1);
|
||||||
|
|
||||||
// av_log(s, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp);
|
av_dlog(s, "XX %"PRId64" %d %"PRId64"\n",
|
||||||
|
timestamp, index, st->index_entries[index].timestamp);
|
||||||
|
|
||||||
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
|
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
|
||||||
/* One and only one real stream for DV in AVI, and it has video */
|
/* One and only one real stream for DV in AVI, and it has video */
|
||||||
|
@ -246,9 +246,6 @@ static void adjust_write_index(AVFormatContext *s)
|
|||||||
ffm->write_index += pos_max;
|
ffm->write_index += pos_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("Adjusted write index from %"PRId64" to %"PRId64": pts=%0.6f\n", orig_write_index, ffm->write_index, pts / 1000000.);
|
|
||||||
//printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. );
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
avio_seek(pb, ptr, SEEK_SET);
|
avio_seek(pb, ptr, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
@ -446,9 +446,6 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
uint8_t *data = NULL;
|
uint8_t *data = NULL;
|
||||||
int flags = -1, flags_size, ret;
|
int flags = -1, flags_size, ret;
|
||||||
|
|
||||||
av_dlog(s, "type:%s pts:%"PRId64" dts:%"PRId64" size:%d\n",
|
|
||||||
av_get_media_type_string(enc->codec_type), pkt->pts, pkt->dts, size);
|
|
||||||
|
|
||||||
if (enc->codec_id == AV_CODEC_ID_VP6 || enc->codec_id == AV_CODEC_ID_VP6F ||
|
if (enc->codec_id == AV_CODEC_ID_VP6 || enc->codec_id == AV_CODEC_ID_VP6F ||
|
||||||
enc->codec_id == AV_CODEC_ID_VP6A || enc->codec_id == AV_CODEC_ID_AAC)
|
enc->codec_id == AV_CODEC_ID_VP6A || enc->codec_id == AV_CODEC_ID_AAC)
|
||||||
flags_size = 2;
|
flags_size = 2;
|
||||||
|
@ -55,8 +55,6 @@ static int h263_probe(AVProbeData *p)
|
|||||||
last_gn= gn;
|
last_gn= gn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//av_log(NULL, AV_LOG_ERROR, "h263_probe: psc:%d invalid:%d res_change:%d\n", valid_psc, invalid_psc, res_change);
|
|
||||||
//h263_probe: psc:3 invalid:0 res_change:0 (1588/recent_ffmpeg_parses_mpg_incorrectly.mpg)
|
|
||||||
if(valid_psc > 2*invalid_psc + 2*res_change + 3){
|
if(valid_psc > 2*invalid_psc + 2*res_change + 3){
|
||||||
return 50;
|
return 50;
|
||||||
}else if(valid_psc > 2*invalid_psc)
|
}else if(valid_psc > 2*invalid_psc)
|
||||||
|
@ -2196,7 +2196,6 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
|
|||||||
|
|
||||||
mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04);
|
mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04);
|
||||||
mov_write_psp_udta_tag(pb, title->value, "eng", 0x01);
|
mov_write_psp_udta_tag(pb, title->value, "eng", 0x01);
|
||||||
// snprintf(dt,32,"%04d/%02d/%02d %02d:%02d:%02d",t_st->tm_year+1900,t_st->tm_mon+1,t_st->tm_mday,t_st->tm_hour,t_st->tm_min,t_st->tm_sec);
|
|
||||||
mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03);
|
mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03);
|
||||||
|
|
||||||
update_size(pb, pos2);
|
update_size(pb, pos2);
|
||||||
|
@ -85,7 +85,6 @@ static int mpegps_probe(AVProbeData *p)
|
|||||||
if(vid+audio > invalid+1) /* invalid VDR files nd short PES streams */
|
if(vid+audio > invalid+1) /* invalid VDR files nd short PES streams */
|
||||||
score= AVPROBE_SCORE_MAX/4;
|
score= AVPROBE_SCORE_MAX/4;
|
||||||
|
|
||||||
//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d %d len:%d\n", sys, priv1, pspack,vid, audio, invalid, p->buf_size);
|
|
||||||
if(sys>invalid && sys*9 <= pspack*10)
|
if(sys>invalid && sys*9 <= pspack*10)
|
||||||
return (audio > 12 || vid > 3 || pspack > 2) ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
|
return (audio > 12 || vid > 3 || pspack > 2) ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
|
||||||
if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9)
|
if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9)
|
||||||
@ -223,7 +222,6 @@ static int mpegps_read_pes_header(AVFormatContext *s,
|
|||||||
size = MAX_SYNC_SIZE;
|
size = MAX_SYNC_SIZE;
|
||||||
startcode = find_next_start_code(s->pb, &size, &m->header_state);
|
startcode = find_next_start_code(s->pb, &size, &m->header_state);
|
||||||
last_sync = avio_tell(s->pb);
|
last_sync = avio_tell(s->pb);
|
||||||
//printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb));
|
|
||||||
if (startcode < 0){
|
if (startcode < 0){
|
||||||
if(url_feof(s->pb))
|
if(url_feof(s->pb))
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
|
@ -1006,7 +1006,10 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(timestamp_packet){
|
if(timestamp_packet){
|
||||||
//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f scr:%f stream:%d\n", timestamp_packet->dts/90000.0, timestamp_packet->pts/90000.0, scr/90000.0, best_i);
|
av_dlog(ctx, "dts:%f pts:%f scr:%f stream:%d\n",
|
||||||
|
timestamp_packet->dts / 90000.0,
|
||||||
|
timestamp_packet->pts / 90000.0,
|
||||||
|
scr / 90000.0, best_i);
|
||||||
es_size= flush_packet(ctx, best_i, timestamp_packet->pts, timestamp_packet->dts, scr, trailer_size);
|
es_size= flush_packet(ctx, best_i, timestamp_packet->pts, timestamp_packet->dts, scr, trailer_size);
|
||||||
}else{
|
}else{
|
||||||
assert(av_fifo_size(stream->fifo) == trailer_size);
|
assert(av_fifo_size(stream->fifo) == trailer_size);
|
||||||
@ -1065,7 +1068,9 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
|
|||||||
dts += 2*preload;
|
dts += 2*preload;
|
||||||
}
|
}
|
||||||
|
|
||||||
//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE);
|
av_dlog(ctx, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n",
|
||||||
|
dts / 90000.0, pts / 90000.0, pkt->flags,
|
||||||
|
pkt->stream_index, pts != AV_NOPTS_VALUE);
|
||||||
if (!stream->premux_packet)
|
if (!stream->premux_packet)
|
||||||
stream->next_packet = &stream->premux_packet;
|
stream->next_packet = &stream->premux_packet;
|
||||||
*stream->next_packet=
|
*stream->next_packet=
|
||||||
|
@ -423,7 +423,8 @@ static int get_packet_size(const uint8_t *buf, int size)
|
|||||||
score = analyze(buf, size, TS_PACKET_SIZE, NULL);
|
score = analyze(buf, size, TS_PACKET_SIZE, NULL);
|
||||||
dvhs_score = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL);
|
dvhs_score = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL);
|
||||||
fec_score= analyze(buf, size, TS_FEC_PACKET_SIZE, NULL);
|
fec_score= analyze(buf, size, TS_FEC_PACKET_SIZE, NULL);
|
||||||
// av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score);
|
av_dlog(NULL, "score: %d, dvhs_score: %d, fec_score: %d \n",
|
||||||
|
score, dvhs_score, fec_score);
|
||||||
|
|
||||||
if (score > fec_score && score > dvhs_score) return TS_PACKET_SIZE;
|
if (score > fec_score && score > dvhs_score) return TS_PACKET_SIZE;
|
||||||
else if(dvhs_score > score && dvhs_score > fec_score) return TS_DVHS_PACKET_SIZE;
|
else if(dvhs_score > score && dvhs_score > fec_score) return TS_DVHS_PACKET_SIZE;
|
||||||
@ -1878,7 +1879,8 @@ static int mpegts_probe(AVProbeData *p)
|
|||||||
score = analyze(p->buf, TS_PACKET_SIZE *check_count, TS_PACKET_SIZE , NULL)*CHECK_COUNT/check_count;
|
score = analyze(p->buf, TS_PACKET_SIZE *check_count, TS_PACKET_SIZE , NULL)*CHECK_COUNT/check_count;
|
||||||
dvhs_score= analyze(p->buf, TS_DVHS_PACKET_SIZE*check_count, TS_DVHS_PACKET_SIZE, NULL)*CHECK_COUNT/check_count;
|
dvhs_score= analyze(p->buf, TS_DVHS_PACKET_SIZE*check_count, TS_DVHS_PACKET_SIZE, NULL)*CHECK_COUNT/check_count;
|
||||||
fec_score = analyze(p->buf, TS_FEC_PACKET_SIZE *check_count, TS_FEC_PACKET_SIZE , NULL)*CHECK_COUNT/check_count;
|
fec_score = analyze(p->buf, TS_FEC_PACKET_SIZE *check_count, TS_FEC_PACKET_SIZE , NULL)*CHECK_COUNT/check_count;
|
||||||
// av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score);
|
av_dlog(NULL, "score: %d, dvhs_score: %d, fec_score: %d \n",
|
||||||
|
score, dvhs_score, fec_score);
|
||||||
|
|
||||||
// we need a clear definition for the returned score otherwise things will become messy sooner or later
|
// we need a clear definition for the returned score otherwise things will become messy sooner or later
|
||||||
if (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score - CHECK_COUNT;
|
if (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score - CHECK_COUNT;
|
||||||
|
@ -1098,7 +1098,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
p = avpriv_mpv_find_start_code(p, buf_end, &state);
|
p = avpriv_mpv_find_start_code(p, buf_end, &state);
|
||||||
//av_log(s, AV_LOG_INFO, "nal %d\n", state & 0x1f);
|
av_dlog(s, "nal %d\n", state & 0x1f);
|
||||||
} while (p < buf_end && (state & 0x1f) != 9 &&
|
} while (p < buf_end && (state & 0x1f) != 9 &&
|
||||||
(state & 0x1f) != 5 && (state & 0x1f) != 1);
|
(state & 0x1f) != 5 && (state & 0x1f) != 1);
|
||||||
|
|
||||||
|
@ -2107,7 +2107,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
*out = pktl->pkt;
|
*out = pktl->pkt;
|
||||||
//av_log(s, AV_LOG_DEBUG, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts);
|
av_dlog(s, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts);
|
||||||
s->packet_buffer = pktl->next;
|
s->packet_buffer = pktl->next;
|
||||||
if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl)
|
if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl)
|
||||||
s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL;
|
s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL;
|
||||||
|
@ -96,16 +96,12 @@ static int find_header_idx(AVFormatContext *s, AVCodecContext *c, int size, int
|
|||||||
int i;
|
int i;
|
||||||
int len= find_expected_header(c, size, frame_type, out);
|
int len= find_expected_header(c, size, frame_type, out);
|
||||||
|
|
||||||
//av_log(NULL, AV_LOG_ERROR, "expected_h len=%d size=%d codec_id=%d\n", len, size, c->codec_id);
|
|
||||||
|
|
||||||
for(i=1; i<nut->header_count; i++){
|
for(i=1; i<nut->header_count; i++){
|
||||||
if( len == nut->header_len[i]
|
if( len == nut->header_len[i]
|
||||||
&& !memcmp(out, nut->header[i], len)){
|
&& !memcmp(out, nut->header[i], len)){
|
||||||
// av_log(NULL, AV_LOG_ERROR, "found %d\n", i);
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// av_log(NULL, AV_LOG_ERROR, "nothing found\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
|
|||||||
st->codec->codec_tag = avio_rl32(pb);
|
st->codec->codec_tag = avio_rl32(pb);
|
||||||
st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags,
|
st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags,
|
||||||
st->codec->codec_tag);
|
st->codec->codec_tag);
|
||||||
// av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
|
av_dlog(s, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
|
||||||
if (st->codec->codec_id == AV_CODEC_ID_NONE)
|
if (st->codec->codec_id == AV_CODEC_ID_NONE)
|
||||||
goto fail1;
|
goto fail1;
|
||||||
st->codec->width = avio_rb16(pb);
|
st->codec->width = avio_rb16(pb);
|
||||||
@ -1002,7 +1002,8 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((flags&2) && (seq&0x7F) == 1){
|
if((flags&2) && (seq&0x7F) == 1){
|
||||||
// av_log(s, AV_LOG_DEBUG, "%d %d-%d %"PRId64" %d\n", flags, stream_index2, stream_index, dts, seq);
|
av_dlog(s, "%d %d-%d %"PRId64" %d\n",
|
||||||
|
flags, stream_index2, stream_index, dts, seq);
|
||||||
av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME);
|
av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME);
|
||||||
if(stream_index2 == stream_index)
|
if(stream_index2 == stream_index)
|
||||||
break;
|
break;
|
||||||
|
@ -155,8 +155,6 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
|
|||||||
get_word_sep(buf, sizeof(buf), "-", &p);
|
get_word_sep(buf, sizeof(buf), "-", &p);
|
||||||
av_parse_time(end, buf, 1);
|
av_parse_time(end, buf, 1);
|
||||||
}
|
}
|
||||||
// av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start);
|
|
||||||
// av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
|
static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
|
||||||
|
@ -45,7 +45,6 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr)
|
|||||||
if (len == 0x3f) {
|
if (len == 0x3f) {
|
||||||
len = avio_rl32(pb);
|
len = avio_rl32(pb);
|
||||||
}
|
}
|
||||||
// av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len);
|
|
||||||
*len_ptr = len;
|
*len_ptr = len;
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
@ -1113,8 +1113,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
|
|||||||
if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts)
|
if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts)
|
||||||
presentation_delayed = 1;
|
presentation_delayed = 1;
|
||||||
|
|
||||||
// av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%d\n",
|
av_dlog(NULL, "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%d\n",
|
||||||
// presentation_delayed, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), pkt->stream_index, pc, pkt->duration);
|
presentation_delayed, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), pkt->stream_index, pc, pkt->duration);
|
||||||
/* interpolate PTS and DTS if they are not present */
|
/* interpolate PTS and DTS if they are not present */
|
||||||
//We skip H264 currently because delay and has_b_frames are not reliably set
|
//We skip H264 currently because delay and has_b_frames are not reliably set
|
||||||
if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != AV_CODEC_ID_H264){
|
if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != AV_CODEC_ID_H264){
|
||||||
@ -1182,8 +1182,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
|
|||||||
if(pkt->dts > st->cur_dts)
|
if(pkt->dts > st->cur_dts)
|
||||||
st->cur_dts = pkt->dts;
|
st->cur_dts = pkt->dts;
|
||||||
|
|
||||||
// av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s\n",
|
av_dlog(NULL, "OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s\n",
|
||||||
// presentation_delayed, delay, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts));
|
presentation_delayed, delay, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts));
|
||||||
|
|
||||||
/* update flags */
|
/* update flags */
|
||||||
if (is_intra_only(st->codec))
|
if (is_intra_only(st->codec))
|
||||||
@ -3536,7 +3536,8 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// av_log(s, AV_LOG_DEBUG, "av_write_frame: pts2:%s dts2:%s\n", av_ts2str(pkt->pts), av_ts2str(pkt->dts));
|
av_dlog(s, "av_write_frame: pts2:%s dts2:%s\n",
|
||||||
|
av_ts2str(pkt->pts), av_ts2str(pkt->dts));
|
||||||
st->cur_dts= pkt->dts;
|
st->cur_dts= pkt->dts;
|
||||||
st->pts.val= pkt->dts;
|
st->pts.val= pkt->dts;
|
||||||
|
|
||||||
|
@ -113,7 +113,6 @@ int main(int argc, char **argv)
|
|||||||
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
|
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
|
||||||
printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size,
|
printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size,
|
||||||
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
|
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
|
||||||
//printf("open(\"%s\")\n", pktfilename);
|
|
||||||
if (!nowrite) {
|
if (!nowrite) {
|
||||||
fd = open(pktfilename, O_WRONLY | O_CREAT, 0644);
|
fd = open(pktfilename, O_WRONLY | O_CREAT, 0644);
|
||||||
err = write(fd, pkt.data, pkt.size);
|
err = write(fd, pkt.data, pkt.size);
|
||||||
|
Loading…
Reference in New Issue
Block a user