Commit bae053fc authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  fate: make compare() function compatible with POSIX bc
  Update Janne's email address.
  APIchanges: Replace Subversion revision numbers by Git hashes.
  bytestream: Eliminate one level of pointless macro indirection.
  xwd: convert to bytestream2.
  vqavideo: port to bytestream2 API
  Read preset files with suffix .avpreset
  prores: allow user to set fixed quantiser
  lavf: remove some disabled code.
  lavf: only set average frame rate for video.
  lavf: remove a pointless check.
  avcodec: add XBM encoder

Conflicts:
	Changelog
	cmdutils.c
	cmdutils.h
	doc/APIchanges
	libavcodec/Makefile
	libavcodec/avcodec.h
	libavcodec/version.h
	libavcodec/vqavideo.c
	libavformat/img2enc.c
	libavformat/utils.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 7f4c5ab8 a56fba50
......@@ -15,6 +15,7 @@ version next:
- libutvideo encoder wrapper (--enable-libutvideo)
- swapuv filter
- bbox filter
- XBM encoder
version 0.10:
......
......@@ -1064,7 +1064,7 @@ FILE *get_preset_file(char *filename, size_t filename_size,
if (!f && codec_name) {
snprintf(filename, filename_size,
"%s%s/%s-%s.ffpreset",
base[i], i != 1 ? "" : "/.ffmpeg", codec_name,
base[i], i != 1 ? "" : "/.ffmpeg", codec_name,
preset_name);
f = fopen(filename, "r");
}
......
......@@ -357,7 +357,7 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
* at configuration time or in a "ffpresets" folder along the executable
* on win32, in that order. If no such file is found and
* codec_name is defined, then search for a file named
* codec_name-preset_name.ffpreset in the above-mentioned directories.
* codec_name-preset_name.avpreset in the above-mentioned directories.
*
* @param filename buffer where the name of the found filename is written
* @param filename_size size in bytes of the filename buffer
......
This diff is collapsed.
......@@ -401,6 +401,8 @@ following image formats are supported:
@tab YUV, JPEG and some extension is not supported yet.
@item Truevision Targa @tab X @tab X
@tab Targa (.TGA) image format
@item XBM @tab X @tab
@tab X BitMap image format
@item XWD @tab X @tab X
@tab X Window Dump image format
@end multitable
......
......@@ -482,6 +482,7 @@ OBJS-$(CONFIG_XAN_DPCM_DECODER) += dpcm.o
OBJS-$(CONFIG_XAN_WC3_DECODER) += xan.o
OBJS-$(CONFIG_XAN_WC4_DECODER) += xxan.o
OBJS-$(CONFIG_XBIN_DECODER) += bintext.o cga_data.o
OBJS-$(CONFIG_XBM_ENCODER) += xbmenc.o
OBJS-$(CONFIG_XL_DECODER) += xl.o
OBJS-$(CONFIG_XSUB_DECODER) += xsubdec.o
OBJS-$(CONFIG_XSUB_ENCODER) += xsubenc.o
......
......@@ -5,7 +5,7 @@
*
* AAC LATM decoder
* Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz>
* Copyright (c) 2010 Janne Grunau <janne-ffmpeg@jannau.net>
* Copyright (c) 2010 Janne Grunau <janne-libav@jannau.net>
*
* This file is part of FFmpeg.
*
......
......@@ -249,6 +249,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (WNV1, wnv1);
REGISTER_DECODER (XAN_WC3, xan_wc3);
REGISTER_DECODER (XAN_WC4, xan_wc4);
REGISTER_ENCODER (XBM, xbm);
REGISTER_DECODER (XL, xl);
REGISTER_ENCDEC (XWD, xwd);
REGISTER_ENCDEC (Y41P, y41p);
......
......@@ -247,6 +247,7 @@ enum CodecID {
CODEC_ID_V410,
CODEC_ID_XWD,
CODEC_ID_CDXL,
CODEC_ID_XBM,
CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
CODEC_ID_AVRP = MKBETAG('A','V','R','P'),
......
......@@ -23,6 +23,7 @@
#ifndef AVCODEC_BYTESTREAM_H
#define AVCODEC_BYTESTREAM_H
#include <stdint.h>
#include <string.h>
#include "libavutil/common.h"
......@@ -37,7 +38,7 @@ typedef struct {
int eof;
} PutByteContext;
#define DEF_T(type, name, bytes, read, write) \
#define DEF(type, name, bytes, read, write) \
static av_always_inline type bytestream_get_ ## name(const uint8_t **b) \
{ \
(*b) += bytes; \
......@@ -80,24 +81,15 @@ static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \
return read(g->buffer); \
}
#define DEF(name, bytes, read, write) \
DEF_T(unsigned int, name, bytes, read, write)
#define DEF64(name, bytes, read, write) \
DEF_T(uint64_t, name, bytes, read, write)
DEF64(le64, 8, AV_RL64, AV_WL64)
DEF (le32, 4, AV_RL32, AV_WL32)
DEF (le24, 3, AV_RL24, AV_WL24)
DEF (le16, 2, AV_RL16, AV_WL16)
DEF64(be64, 8, AV_RB64, AV_WB64)
DEF (be32, 4, AV_RB32, AV_WB32)
DEF (be24, 3, AV_RB24, AV_WB24)
DEF (be16, 2, AV_RB16, AV_WB16)
DEF (byte, 1, AV_RB8 , AV_WB8 )
#undef DEF
#undef DEF64
#undef DEF_T
DEF(uint64_t, le64, 8, AV_RL64, AV_WL64)
DEF(unsigned int, le32, 4, AV_RL32, AV_WL32)
DEF(unsigned int, le24, 3, AV_RL24, AV_WL24)
DEF(unsigned int, le16, 2, AV_RL16, AV_WL16)
DEF(uint64_t, be64, 8, AV_RB64, AV_WB64)
DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)
DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8)
#if HAVE_BIGENDIAN
# define bytestream2_get_ne16 bytestream2_get_be16
......
......@@ -184,6 +184,7 @@ typedef struct ProresContext {
int num_slices;
int num_planes;
int bits_per_mb;
int force_quant;
char *vendor;
int quant_sel;
......@@ -397,7 +398,9 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
int plane_factor, is_chroma;
uint16_t *qmat;
if (quant < MAX_STORED_Q) {
if (ctx->force_quant) {
qmat = ctx->quants[0];
} else if (quant < MAX_STORED_Q) {
qmat = ctx->quants[quant];
} else {
qmat = ctx->custom_q;
......@@ -750,21 +753,23 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
// slices
for (y = 0; y < ctx->mb_height; y++) {
mbs_per_slice = ctx->mbs_per_slice;
for (x = mb = 0; x < ctx->mb_width; x += mbs_per_slice, mb++) {
while (ctx->mb_width - x < mbs_per_slice)
mbs_per_slice >>= 1;
q = find_slice_quant(avctx, pic, (mb + 1) * TRELLIS_WIDTH, x, y,
mbs_per_slice);
}
if (!ctx->force_quant) {
for (x = mb = 0; x < ctx->mb_width; x += mbs_per_slice, mb++) {
while (ctx->mb_width - x < mbs_per_slice)
mbs_per_slice >>= 1;
q = find_slice_quant(avctx, pic, (mb + 1) * TRELLIS_WIDTH, x, y,
mbs_per_slice);
}
for (x = ctx->slices_width - 1; x >= 0; x--) {
ctx->slice_q[x] = ctx->nodes[q].quant;
q = ctx->nodes[q].prev_node;
for (x = ctx->slices_width - 1; x >= 0; x--) {
ctx->slice_q[x] = ctx->nodes[q].quant;
q = ctx->nodes[q].prev_node;
}
}
mbs_per_slice = ctx->mbs_per_slice;
for (x = mb = 0; x < ctx->mb_width; x += mbs_per_slice, mb++) {
q = ctx->slice_q[mb];
q = ctx->force_quant ? ctx->force_quant : ctx->slice_q[mb];
while (ctx->mb_width - x < mbs_per_slice)
mbs_per_slice >>= 1;
......@@ -859,27 +864,66 @@ static av_cold int encode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
if (!ctx->bits_per_mb) {
for (i = 0; i < NUM_MB_LIMITS - 1; i++)
if (prores_mb_limits[i] >= ctx->mb_width * ctx->mb_height)
break;
ctx->bits_per_mb = ctx->profile_info->br_tab[i];
} else if (ctx->bits_per_mb < 128) {
av_log(avctx, AV_LOG_ERROR, "too few bits per MB, please set at least 128\n");
return AVERROR_INVALIDDATA;
ctx->force_quant = avctx->global_quality / FF_QP2LAMBDA;
if (!ctx->force_quant) {
if (!ctx->bits_per_mb) {
for (i = 0; i < NUM_MB_LIMITS - 1; i++)
if (prores_mb_limits[i] >= ctx->mb_width * ctx->mb_height)
break;
ctx->bits_per_mb = ctx->profile_info->br_tab[i];
} else if (ctx->bits_per_mb < 128) {
av_log(avctx, AV_LOG_ERROR, "too few bits per MB, please set at least 128\n");
return AVERROR_INVALIDDATA;
}
min_quant = ctx->profile_info->min_quant;
max_quant = ctx->profile_info->max_quant;
for (i = min_quant; i < MAX_STORED_Q; i++) {
for (j = 0; j < 64; j++)
ctx->quants[i][j] = ctx->quant_mat[j] * i;
}
ctx->nodes = av_malloc((ctx->slices_width + 1) * TRELLIS_WIDTH
* sizeof(*ctx->nodes));
if (!ctx->nodes) {
encode_close(avctx);
return AVERROR(ENOMEM);
}
for (i = min_quant; i < max_quant + 2; i++) {
ctx->nodes[i].prev_node = -1;
ctx->nodes[i].bits = 0;
ctx->nodes[i].score = 0;
}
ctx->slice_q = av_malloc(ctx->slices_width * sizeof(*ctx->slice_q));
if (!ctx->slice_q) {
encode_close(avctx);
return AVERROR(ENOMEM);
}
} else {
int ls = 0;
if (ctx->force_quant > 64) {
av_log(avctx, AV_LOG_ERROR, "too large quantiser, maximum is 64\n");
return AVERROR_INVALIDDATA;
}
for (j = 0; j < 64; j++) {
ctx->quants[0][j] = ctx->quant_mat[j] * ctx->force_quant;
ls += av_log2((1 << 11) / ctx->quants[0][j]) * 2 + 1;
}
ctx->bits_per_mb = ls * 8;
if (ctx->chroma_factor == CFACTOR_Y444)
ctx->bits_per_mb += ls * 4;
if (ctx->num_planes == 4)
ctx->bits_per_mb += ls * 4;
}
ctx->frame_size = ctx->num_slices * (2 + 2 * ctx->num_planes
+ (2 * mps * ctx->bits_per_mb) / 8)
+ 200;
min_quant = ctx->profile_info->min_quant;
max_quant = ctx->profile_info->max_quant;
for (i = min_quant; i < MAX_STORED_Q; i++) {
for (j = 0; j < 64; j++)
ctx->quants[i][j] = ctx->quant_mat[j] * i;
}
avctx->codec_tag = ctx->profile_info->tag;
av_log(avctx, AV_LOG_DEBUG, "profile %d, %d slices, %d bits per MB\n",
......@@ -887,24 +931,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_DEBUG, "estimated frame size %d\n",
ctx->frame_size);
ctx->nodes = av_malloc((ctx->slices_width + 1) * TRELLIS_WIDTH
* sizeof(*ctx->nodes));
if (!ctx->nodes) {
encode_close(avctx);
return AVERROR(ENOMEM);
}
for (i = min_quant; i < max_quant + 2; i++) {
ctx->nodes[i].prev_node = -1;
ctx->nodes[i].bits = 0;
ctx->nodes[i].score = 0;
}
ctx->slice_q = av_malloc(ctx->slices_width * sizeof(*ctx->slice_q));
if (!ctx->slice_q) {
encode_close(avctx);
return AVERROR(ENOMEM);
}
return 0;
}
......
......@@ -21,7 +21,7 @@
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 10
#define LIBAVCODEC_VERSION_MINOR 11
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
This diff is collapsed.
/*
* XBM image format
*
* Copyright (c) 2012 Paul B Mahol
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
#include "internal.h"
static av_cold int xbm_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
return 0;
}
static int xbm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *p, int *got_packet)
{
int i, j, ret, size, linesize;
uint8_t *ptr, *buf;
linesize = (avctx->width + 7) / 8;
size = avctx->height * (linesize * 7 + 2) + 110;
if ((ret = ff_alloc_packet(pkt, size)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
}
buf = pkt->data;
ptr = p->data[0];
buf += snprintf(buf, 32, "#define image_width %u\n", avctx->width);
buf += snprintf(buf, 33, "#define image_height %u\n", avctx->height);
buf += snprintf(buf, 40, "static unsigned char image_bits[] = {\n");
for (i = 0; i < avctx->height; i++) {
for (j = 0; j < linesize; j++)
buf += snprintf(buf, 7, " 0x%02X,", av_reverse[*ptr++]);
ptr += p->linesize[0] - linesize;
buf += snprintf(buf, 2, "\n");
}
buf += snprintf(buf, 5, " };\n");
pkt->size = buf - pkt->data;
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;
}
static av_cold int xbm_encode_close(AVCodecContext *avctx)
{
av_freep(&avctx->coded_frame);
return 0;
}
AVCodec ff_xbm_encoder = {
.name = "xbm",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_XBM,
.init = xbm_encode_init,
.encode2 = xbm_encode_frame,
.close = xbm_encode_close,
.pix_fmts = (const enum PixelFormat[]) { PIX_FMT_MONOWHITE,
PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("XBM (X BitMap) image"),
};
......@@ -45,43 +45,43 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
uint32_t pixformat, pixdepth, bunit, bitorder, bpad;
uint32_t rgb[3];
uint8_t *ptr;
GetByteContext gb;
if (buf_size < XWD_HEADER_SIZE)
return AVERROR_INVALIDDATA;
header_size = bytestream_get_be32(&buf);
if (buf_size < header_size)
return AVERROR_INVALIDDATA;
bytestream2_init(&gb, buf, buf_size);
header_size = bytestream2_get_be32u(&gb);
version = bytestream_get_be32(&buf);
version = bytestream2_get_be32u(&gb);
if (version != XWD_VERSION) {
av_log(avctx, AV_LOG_ERROR, "unsupported version\n");
return AVERROR_INVALIDDATA;
}
if (header_size < XWD_HEADER_SIZE) {
if (buf_size < header_size || header_size < XWD_HEADER_SIZE) {
av_log(avctx, AV_LOG_ERROR, "invalid header size\n");
return AVERROR_INVALIDDATA;
}
pixformat = bytestream_get_be32(&buf);
pixdepth = bytestream_get_be32(&buf);
avctx->width = bytestream_get_be32(&buf);
avctx->height = bytestream_get_be32(&buf);
xoffset = bytestream_get_be32(&buf);
be = bytestream_get_be32(&buf);
bunit = bytestream_get_be32(&buf);
bitorder = bytestream_get_be32(&buf);
bpad = bytestream_get_be32(&buf);
bpp = bytestream_get_be32(&buf);
lsize = bytestream_get_be32(&buf);
vclass = bytestream_get_be32(&buf);
rgb[0] = bytestream_get_be32(&buf);
rgb[1] = bytestream_get_be32(&buf);
rgb[2] = bytestream_get_be32(&buf);
buf += 8;
ncolors = bytestream_get_be32(&buf);
buf += header_size - (XWD_HEADER_SIZE - 20);
pixformat = bytestream2_get_be32u(&gb);
pixdepth = bytestream2_get_be32u(&gb);
avctx->width = bytestream2_get_be32u(&gb);
avctx->height = bytestream2_get_be32u(&gb);
xoffset = bytestream2_get_be32u(&gb);
be = bytestream2_get_be32u(&gb);
bunit = bytestream2_get_be32u(&gb);
bitorder = bytestream2_get_be32u(&gb);
bpad = bytestream2_get_be32u(&gb);
bpp = bytestream2_get_be32u(&gb);
lsize = bytestream2_get_be32u(&gb);
vclass = bytestream2_get_be32u(&gb);
rgb[0] = bytestream2_get_be32u(&gb);
rgb[1] = bytestream2_get_be32u(&gb);
rgb[2] = bytestream2_get_be32u(&gb);
bytestream2_skipu(&gb, 8);
ncolors = bytestream2_get_be32u(&gb);
bytestream2_skipu(&gb, header_size - (XWD_HEADER_SIZE - 20));
av_log(avctx, AV_LOG_DEBUG, "pixformat %d, pixdepth %d, bunit %d, bitorder %d, bpad %d\n",
pixformat, pixdepth, bunit, bitorder, bpad);
......@@ -143,7 +143,7 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
if (buf_size < header_size + ncolors * XWD_CMAP_SIZE + avctx->height * lsize) {
if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + avctx->height * lsize) {
av_log(avctx, AV_LOG_ERROR, "input buffer too small\n");
return AVERROR_INVALIDDATA;
}
......@@ -192,7 +192,7 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
avctx->pix_fmt = be ? PIX_FMT_ABGR : PIX_FMT_RGBA;
}
buf += ncolors * XWD_CMAP_SIZE;
bytestream2_skipu(&gb, ncolors * XWD_CMAP_SIZE);
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid visual class\n");
......@@ -222,11 +222,13 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
for (i = 0; i < ncolors; i++) {
buf += 4; // skip colormap entry number
red = *buf; buf += 2;
green = *buf; buf += 2;
blue = *buf; buf += 2;
buf += 2; // skip bitmask flag and padding
bytestream2_skipu(&gb, 4); // skip colormap entry number
red = bytestream2_get_byteu(&gb);
bytestream2_skipu(&gb, 1);
green = bytestream2_get_byteu(&gb);
bytestream2_skipu(&gb, 1);
blue = bytestream2_get_byteu(&gb);
bytestream2_skipu(&gb, 3); // skip bitmask flag and padding
dst[i] = red << 16 | green << 8 | blue;
}
......@@ -234,8 +236,8 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
ptr = p->data[0];
for (i = 0; i < avctx->height; i++) {
bytestream_get_buffer(&buf, ptr, rsize);
buf += lsize - rsize;
bytestream2_get_bufferu(&gb, ptr, rsize);
bytestream2_skipu(&gb, lsize - rsize);
ptr += p->linesize[0];
}
......
......@@ -71,6 +71,7 @@ static const IdStrMap img_tags[] = {
{ CODEC_ID_JPEG2000 , "jpc"},
{ CODEC_ID_DPX , "dpx"},
{ CODEC_ID_PICTOR , "pic"},
{ CODEC_ID_XBM , "xbm"},
{ CODEC_ID_XWD , "xwd"},
{ CODEC_ID_NONE , NULL}
};
......
......@@ -153,7 +153,7 @@ AVOutputFormat ff_image2_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
.extensions = "bmp,dpx,jls,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png,"
"ppm,sgi,tga,tif,tiff,jp2,j2c,xwd,sun,ras,rs,im1,im8,im24,"
"sunras",
"sunras,xbm",
.priv_data_size = sizeof(VideoMuxData),
.video_codec = CODEC_ID_MJPEG,
.write_header = write_header,
......
......@@ -1749,14 +1749,6 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
static int seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
int64_t pos_min, pos_max;
#if 0
AVStream *st;
if (stream_index < 0)
return -1;
st= s->streams[stream_index];
#endif
pos_min = s->data_offset;
pos_max = avio_size(s->pb) - 1;
......@@ -1766,9 +1758,6 @@ static int seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, in
avio_seek(s->pb, pos, SEEK_SET);
#if 0
av_update_cur_dts(s, st, ts);
#endif
return 0;
}
......@@ -2593,10 +2582,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if (st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && st->info->codec_info_duration)
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
(st->codec_info_nb_frames-2)*(int64_t)st->time_base.den,
st->info->codec_info_duration*(int64_t)st->time_base.num, 60000);
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample){
uint32_t tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
......@@ -2604,6 +2589,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
st->codec->codec_tag= tag;
}
if (st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && st->info->codec_info_duration)
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
(st->codec_info_nb_frames-2)*(int64_t)st->time_base.den,
st->info->codec_info_duration*(int64_t)st->time_base.num, 60000);
// the check for tb_unreliable() is not completely correct, since this is not about handling
// a unreliable/inexact time base, but a time base that is finer than necessary, as e.g.
// ipmovie.c produces.
......@@ -2674,31 +2663,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
compute_chapters_end(ic);
#if 0
/* correct DTS for B-frame streams with no timestamps */
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if(b-frames){
ppktl = &ic->packet_buffer;
while(ppkt1){
if(ppkt1->stream_index != i)
continue;
if(ppkt1->pkt->dts < 0)
break;
if(ppkt1->pkt->pts != AV_NOPTS_VALUE)
break;
ppkt1->pkt->dts -= delta;
ppkt1= ppkt1->next;
}
if(ppkt1)
continue;
st->cur_dts -= delta;
}
}
}
#endif
find_stream_info_err:
for (i=0; i < ic->nb_streams; i++) {
if (ic->streams[i]->codec)
......
......@@ -31,8 +31,7 @@ repfile="${outdir}/${test}.rep"
# $1=value1, $2=value2, $3=threshold
# prints 0 if absolute difference between value1 and value2 is <= threshold
compare(){
v=$(echo "scale=2; if ($1 >= $2) { $1 - $2 } else { $2 - $1 }" | bc)
echo "if ($v <= $3) { 0 } else { 1 }" | bc
echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" | bc
}
do_tiny_psnr(){
......
......@@ -70,7 +70,6 @@
1, 53654, 53654, 1470, 2940, 0xac8bb6c8
0, 37, 37, 1, 192000, 0xb58c1566
1, 55124, 55124, 1470, 2940, 0xa503c73b
0, 38, 38, 1, 192000, 0xb58c1566
1, 56594, 56594, 1470, 2940, 0x7cd588a3
1, 58064, 58064, 1470, 2940, 0xa6974b04
1, 59534, 59534, 1470, 2940, 0xbf448241
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment