Commit 41211483 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  avconv: make -frames work for all types of streams, not just video.
  bfi: K&R cosmetics
  bgmc: K&R cleanup
  rawdec: Set start_time to 0 for raw audio files.
  Detect 'yuv2' as rawvideo also in avi.
  rawdec: propagate pict_type information to the output frame
  rawdec: Support more QT 1bpp rawvideo files.
  avconv: free bitstream filters
  threads: limit the number of automatic threads to MAX_AUTO_THREADS
  avplay: K&R cleanup
  fate: use rgb24 as output format for dfa tests
  threads: set thread_count to 1 when thread support is disabled
  threads: introduce CODEC_CAP_AUTO_THREADS and add it to libx264

Conflicts:
	ffplay.c
	libavcodec/avcodec.h
	libavcodec/pthread.c
	libavcodec/version.h
	tests/ref/fate/dfa1
	tests/ref/fate/dfa10
	tests/ref/fate/dfa11
	tests/ref/fate/dfa2
	tests/ref/fate/dfa3
	tests/ref/fate/dfa4
	tests/ref/fate/dfa5
	tests/ref/fate/dfa6
	tests/ref/fate/dfa7
	tests/ref/fate/dfa8
	tests/ref/fate/dfa9
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents ef611095 f15f02c2
...@@ -754,6 +754,15 @@ void exit_program(int ret) ...@@ -754,6 +754,15 @@ void exit_program(int ret)
avformat_free_context(s); avformat_free_context(s);
av_dict_free(&output_files[i].opts); av_dict_free(&output_files[i].opts);
} }
for (i = 0; i < nb_output_streams; i++) {
AVBitStreamFilterContext *bsfc = output_streams[i].bitstream_filters;
while (bsfc) {
AVBitStreamFilterContext *next = bsfc->next;
av_bitstream_filter_close(bsfc);
bsfc = next;
}
output_streams[i].bitstream_filters = NULL;
}
for (i = 0; i < nb_input_files; i++) { for (i = 0; i < nb_input_files; i++) {
avformat_close_input(&input_files[i].ctx); avformat_close_input(&input_files[i].ctx);
} }
...@@ -896,8 +905,10 @@ get_sync_ipts(const OutputStream *ost) ...@@ -896,8 +905,10 @@ get_sync_ipts(const OutputStream *ost)
return (double)(ist->pts - of->start_time) / AV_TIME_BASE; return (double)(ist->pts - of->start_time) / AV_TIME_BASE;
} }
static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc) static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
{ {
AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
AVCodecContext *avctx = ost->st->codec;
int ret; int ret;
while (bsfc) { while (bsfc) {
...@@ -927,6 +938,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx ...@@ -927,6 +938,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx
print_error("av_interleaved_write_frame()", ret); print_error("av_interleaved_write_frame()", ret);
exit_program(1); exit_program(1);
} }
ost->frame_number++;
} }
static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size) static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)
...@@ -1141,7 +1153,7 @@ need_realloc: ...@@ -1141,7 +1153,7 @@ need_realloc:
if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
write_frame(s, &pkt, enc, ost->bitstream_filters); write_frame(s, &pkt, ost);
ost->sync_opts += enc->frame_size; ost->sync_opts += enc->frame_size;
} }
...@@ -1176,7 +1188,7 @@ need_realloc: ...@@ -1176,7 +1188,7 @@ need_realloc:
if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
write_frame(s, &pkt, enc, ost->bitstream_filters); write_frame(s, &pkt, ost);
} }
} }
...@@ -1278,7 +1290,7 @@ static void do_subtitle_out(AVFormatContext *s, ...@@ -1278,7 +1290,7 @@ static void do_subtitle_out(AVFormatContext *s,
else else
pkt.pts += 90 * sub->end_display_time; pkt.pts += 90 * sub->end_display_time;
} }
write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters); write_frame(s, &pkt, ost);
} }
} }
...@@ -1429,7 +1441,7 @@ static void do_video_out(AVFormatContext *s, ...@@ -1429,7 +1441,7 @@ static void do_video_out(AVFormatContext *s,
pkt.pts = av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base); pkt.pts = av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base);
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters); write_frame(s, &pkt, ost);
} else { } else {
AVFrame big_picture; AVFrame big_picture;
...@@ -1477,7 +1489,7 @@ static void do_video_out(AVFormatContext *s, ...@@ -1477,7 +1489,7 @@ static void do_video_out(AVFormatContext *s,
if (enc->coded_frame->key_frame) if (enc->coded_frame->key_frame)
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters); write_frame(s, &pkt, ost);
*frame_size = ret; *frame_size = ret;
video_size += ret; video_size += ret;
// fprintf(stderr,"\nFrame: %3d size: %5d type: %d", // fprintf(stderr,"\nFrame: %3d size: %5d type: %d",
...@@ -1489,7 +1501,6 @@ static void do_video_out(AVFormatContext *s, ...@@ -1489,7 +1501,6 @@ static void do_video_out(AVFormatContext *s,
} }
} }
ost->sync_opts++; ost->sync_opts++;
ost->frame_number++;
} }
} }
...@@ -1747,7 +1758,7 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams) ...@@ -1747,7 +1758,7 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams)
pkt.size = ret; pkt.size = ret;
if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters); write_frame(os, &pkt, ost);
} }
} }
} }
...@@ -1831,9 +1842,8 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p ...@@ -1831,9 +1842,8 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
opkt.flags |= AV_PKT_FLAG_KEY; opkt.flags |= AV_PKT_FLAG_KEY;
} }
write_frame(of->ctx, &opkt, ost->st->codec, ost->bitstream_filters); write_frame(of->ctx, &opkt, ost);
ost->st->codec->frame_number++; ost->st->codec->frame_number++;
ost->frame_number++;
av_free_packet(&opkt); av_free_packet(&opkt);
} }
......
...@@ -812,6 +812,15 @@ void av_noreturn exit_program(int ret) ...@@ -812,6 +812,15 @@ void av_noreturn exit_program(int ret)
avformat_free_context(s); avformat_free_context(s);
av_dict_free(&output_files[i].opts); av_dict_free(&output_files[i].opts);
} }
for (i = 0; i < nb_output_streams; i++) {
AVBitStreamFilterContext *bsfc = output_streams[i].bitstream_filters;
while (bsfc) {
AVBitStreamFilterContext *next = bsfc->next;
av_bitstream_filter_close(bsfc);
bsfc = next;
}
output_streams[i].bitstream_filters = NULL;
}
for (i = 0; i < nb_input_files; i++) { for (i = 0; i < nb_input_files; i++) {
avformat_close_input(&input_files[i].ctx); avformat_close_input(&input_files[i].ctx);
} }
...@@ -958,8 +967,10 @@ static double get_sync_ipts(const OutputStream *ost) ...@@ -958,8 +967,10 @@ static double get_sync_ipts(const OutputStream *ost)
return (double)(ist->pts - of->start_time) / AV_TIME_BASE; return (double)(ist->pts - of->start_time) / AV_TIME_BASE;
} }
static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc) static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
{ {
AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
AVCodecContext *avctx = ost->st->codec;
int ret; int ret;
while (bsfc) { while (bsfc) {
...@@ -989,6 +1000,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx ...@@ -989,6 +1000,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx
print_error("av_interleaved_write_frame()", ret); print_error("av_interleaved_write_frame()", ret);
exit_program(1); exit_program(1);
} }
ost->frame_number++;
} }
static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size) static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)
...@@ -1188,7 +1200,7 @@ need_realloc: ...@@ -1188,7 +1200,7 @@ need_realloc:
if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
write_frame(s, &pkt, enc, ost->bitstream_filters); write_frame(s, &pkt, ost);
ost->sync_opts += enc->frame_size; ost->sync_opts += enc->frame_size;
} }
...@@ -1223,7 +1235,7 @@ need_realloc: ...@@ -1223,7 +1235,7 @@ need_realloc:
if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
write_frame(s, &pkt, enc, ost->bitstream_filters); write_frame(s, &pkt, ost);
} }
} }
...@@ -1325,7 +1337,7 @@ static void do_subtitle_out(AVFormatContext *s, ...@@ -1325,7 +1337,7 @@ static void do_subtitle_out(AVFormatContext *s,
else else
pkt.pts += 90 * sub->end_display_time; pkt.pts += 90 * sub->end_display_time;
} }
write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters); write_frame(s, &pkt, ost);
} }
} }
...@@ -1471,7 +1483,7 @@ static void do_video_out(AVFormatContext *s, ...@@ -1471,7 +1483,7 @@ static void do_video_out(AVFormatContext *s,
pkt.pts = av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base); pkt.pts = av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base);
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters); write_frame(s, &pkt, ost);
} else { } else {
AVFrame big_picture; AVFrame big_picture;
...@@ -1519,7 +1531,7 @@ static void do_video_out(AVFormatContext *s, ...@@ -1519,7 +1531,7 @@ static void do_video_out(AVFormatContext *s,
if (enc->coded_frame->key_frame) if (enc->coded_frame->key_frame)
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters); write_frame(s, &pkt, ost);
*frame_size = ret; *frame_size = ret;
video_size += ret; video_size += ret;
// fprintf(stderr,"\nFrame: %3d size: %5d type: %d", // fprintf(stderr,"\nFrame: %3d size: %5d type: %d",
...@@ -1531,7 +1543,6 @@ static void do_video_out(AVFormatContext *s, ...@@ -1531,7 +1543,6 @@ static void do_video_out(AVFormatContext *s,
} }
} }
ost->sync_opts++; ost->sync_opts++;
ost->frame_number++;
} }
} }
...@@ -1792,7 +1803,7 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams) ...@@ -1792,7 +1803,7 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams)
pkt.size = ret; pkt.size = ret;
if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters); write_frame(os, &pkt, ost);
} }
} }
} }
...@@ -1876,9 +1887,8 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p ...@@ -1876,9 +1887,8 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
opkt.flags |= AV_PKT_FLAG_KEY; opkt.flags |= AV_PKT_FLAG_KEY;
} }
write_frame(of->ctx, &opkt, ost->st->codec, ost->bitstream_filters); write_frame(of->ctx, &opkt, ost);
ost->st->codec->frame_number++; ost->st->codec->frame_number++;
ost->frame_number++;
av_free_packet(&opkt); av_free_packet(&opkt);
} }
......
This diff is collapsed.
...@@ -795,6 +795,10 @@ typedef struct RcOverride{ ...@@ -795,6 +795,10 @@ typedef struct RcOverride{
* Codec supports changed parameters at any point. * Codec supports changed parameters at any point.
*/ */
#define CODEC_CAP_PARAM_CHANGE 0x4000 #define CODEC_CAP_PARAM_CHANGE 0x4000
/**
* Codec supports avctx->thread_count == 0 (auto).
*/
#define CODEC_CAP_AUTO_THREADS 0x8000
/** /**
* Codec is lossless. * Codec is lossless.
*/ */
......
...@@ -37,7 +37,7 @@ typedef struct BFIContext { ...@@ -37,7 +37,7 @@ typedef struct BFIContext {
uint32_t pal[256]; uint32_t pal[256];
} BFIContext; } BFIContext;
static av_cold int bfi_decode_init(AVCodecContext * avctx) static av_cold int bfi_decode_init(AVCodecContext *avctx)
{ {
BFIContext *bfi = avctx->priv_data; BFIContext *bfi = avctx->priv_data;
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
...@@ -46,7 +46,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx) ...@@ -46,7 +46,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx)
return 0; return 0;
} }
static int bfi_decode_frame(AVCodecContext * avctx, void *data, static int bfi_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt) int *data_size, AVPacket *avpkt)
{ {
const uint8_t *buf = avpkt->data, *buf_end = avpkt->data + avpkt->size; const uint8_t *buf = avpkt->data, *buf_end = avpkt->data + avpkt->size;
...@@ -73,11 +73,11 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data, ...@@ -73,11 +73,11 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
bfi->frame.pict_type = AV_PICTURE_TYPE_I; bfi->frame.pict_type = AV_PICTURE_TYPE_I;
bfi->frame.key_frame = 1; bfi->frame.key_frame = 1;
/* Setting the palette */ /* Setting the palette */
if(avctx->extradata_size>768) { if (avctx->extradata_size > 768) {
av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n"); av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n");
return -1; return -1;
} }
pal = (uint32_t *) bfi->frame.data[1]; pal = (uint32_t *)bfi->frame.data[1];
for (i = 0; i < avctx->extradata_size / 3; i++) { for (i = 0; i < avctx->extradata_size / 3; i++) {
int shift = 16; int shift = 16;
*pal = 0xFF << 24; *pal = 0xFF << 24;
...@@ -96,16 +96,17 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data, ...@@ -96,16 +96,17 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
memcpy(bfi->frame.data[1], bfi->pal, sizeof(bfi->pal)); memcpy(bfi->frame.data[1], bfi->pal, sizeof(bfi->pal));
} }
buf += 4; //Unpacked size, not required. buf += 4; // Unpacked size, not required.
while (dst != frame_end) { while (dst != frame_end) {
static const uint8_t lentab[4]={0,2,0,1}; static const uint8_t lentab[4] = { 0, 2, 0, 1 };
unsigned int byte = *buf++, av_uninit(offset); unsigned int byte = *buf++, av_uninit(offset);
unsigned int code = byte >> 6; unsigned int code = byte >> 6;
unsigned int length = byte & ~0xC0; unsigned int length = byte & ~0xC0;
if (buf >= buf_end) { if (buf >= buf_end) {
av_log(avctx, AV_LOG_ERROR, "Input resolution larger than actual frame.\n"); av_log(avctx, AV_LOG_ERROR,
"Input resolution larger than actual frame.\n");
return -1; return -1;
} }
...@@ -125,7 +126,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data, ...@@ -125,7 +126,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
} }
/* Do boundary check */ /* Do boundary check */
if (dst + (length<<lentab[code]) > frame_end) if (dst + (length << lentab[code]) > frame_end)
break; break;
switch (code) { switch (code) {
...@@ -172,7 +173,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data, ...@@ -172,7 +173,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
dst += bfi->frame.linesize[0]; dst += bfi->frame.linesize[0];
} }
*data_size = sizeof(AVFrame); *data_size = sizeof(AVFrame);
*(AVFrame *) data = bfi->frame; *(AVFrame *)data = bfi->frame;
return buf_size; return buf_size;
} }
......
...@@ -474,7 +474,8 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status) ...@@ -474,7 +474,8 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status)
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n"); av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} else { } else {
// initialize lut_status buffer to a value never used to compare against // initialize lut_status buffer to a value never used to compare
// against
memset(*cf_lut_status, -1, sizeof(*cf_lut_status) * LUT_BUFF); memset(*cf_lut_status, -1, sizeof(*cf_lut_status) * LUT_BUFF);
} }
...@@ -494,7 +495,7 @@ void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status) ...@@ -494,7 +495,7 @@ void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
/** Initialize decoding and reads the first value /** Initialize decoding and reads the first value
*/ */
void ff_bgmc_decode_init(GetBitContext *gb, void ff_bgmc_decode_init(GetBitContext *gb,
unsigned int *h, unsigned int *l, unsigned int *v) unsigned int *h, unsigned int *l, unsigned int *v)
{ {
*h = TOP_VALUE; *h = TOP_VALUE;
*l = 0; *l = 0;
...@@ -513,9 +514,9 @@ void ff_bgmc_decode_end(GetBitContext *gb) ...@@ -513,9 +514,9 @@ void ff_bgmc_decode_end(GetBitContext *gb)
/** Read and decode a block Gilbert-Moore coded symbol /** Read and decode a block Gilbert-Moore coded symbol
*/ */
void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst, void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
int delta, unsigned int sx, int delta, unsigned int sx,
unsigned int *h, unsigned int *l, unsigned int *v, unsigned int *h, unsigned int *l, unsigned int *v,
uint8_t *cf_lut, int *cf_lut_status) uint8_t *cf_lut, int *cf_lut_status)
{ {
unsigned int i; unsigned int i;
uint8_t *lut = bgmc_lut_getp(cf_lut, cf_lut_status, delta); uint8_t *lut = bgmc_lut_getp(cf_lut, cf_lut_status, delta);
...@@ -567,4 +568,3 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst, ...@@ -567,4 +568,3 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
*l = low; *l = low;
*v = value; *v = value;
} }
...@@ -696,7 +696,7 @@ AVCodec ff_libx264_encoder = { ...@@ -696,7 +696,7 @@ AVCodec ff_libx264_encoder = {
.init = X264_init, .init = X264_init,
.encode = X264_frame, .encode = X264_frame,
.close = X264_close, .close = X264_close,
.capabilities = CODEC_CAP_DELAY, .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
.long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
.priv_class = &class, .priv_class = &class,
.defaults = x264_defaults, .defaults = x264_defaults,
......
...@@ -193,7 +193,7 @@ static int get_logical_cpus(AVCodecContext *avctx) ...@@ -193,7 +193,7 @@ static int get_logical_cpus(AVCodecContext *avctx)
if (avctx->height) if (avctx->height)
nb_cpus = FFMIN(nb_cpus, (avctx->height+15)/16); nb_cpus = FFMIN(nb_cpus, (avctx->height+15)/16);
return FFMIN(nb_cpus, MAX_AUTO_THREADS); return nb_cpus;
} }
...@@ -303,9 +303,11 @@ static int thread_init(AVCodecContext *avctx) ...@@ -303,9 +303,11 @@ static int thread_init(AVCodecContext *avctx)
if (!thread_count) { if (!thread_count) {
int nb_cpus = get_logical_cpus(avctx); int nb_cpus = get_logical_cpus(avctx);
// use number of cores + 1 as thread count if there is motre than one // use number of cores + 1 as thread count if there is more than one
if (nb_cpus > 1) if (nb_cpus > 1)
thread_count = avctx->thread_count = nb_cpus + 1; thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);
else
thread_count = avctx->thread_count = 1;
} }
if (thread_count <= 1) { if (thread_count <= 1) {
...@@ -783,9 +785,11 @@ static int frame_thread_init(AVCodecContext *avctx) ...@@ -783,9 +785,11 @@ static int frame_thread_init(AVCodecContext *avctx)
int nb_cpus = get_logical_cpus(avctx); int nb_cpus = get_logical_cpus(avctx);
if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) || avctx->debug_mv) if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) || avctx->debug_mv)
nb_cpus = 1; nb_cpus = 1;
// use number of cores + 1 as thread count if there is motre than one // use number of cores + 1 as thread count if there is more than one
if (nb_cpus > 1) if (nb_cpus > 1)
thread_count = avctx->thread_count = nb_cpus + 1; thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);
else
thread_count = avctx->thread_count = 1;
} }
if (thread_count <= 1) { if (thread_count <= 1) {
...@@ -1002,6 +1006,9 @@ static void validate_thread_parameters(AVCodecContext *avctx) ...@@ -1002,6 +1006,9 @@ static void validate_thread_parameters(AVCodecContext *avctx)
} else if (avctx->codec->capabilities & CODEC_CAP_SLICE_THREADS && } else if (avctx->codec->capabilities & CODEC_CAP_SLICE_THREADS &&
avctx->thread_type & FF_THREAD_SLICE) { avctx->thread_type & FF_THREAD_SLICE) {
avctx->active_thread_type = FF_THREAD_SLICE; avctx->active_thread_type = FF_THREAD_SLICE;
} else if (!(avctx->codec->capabilities & CODEC_CAP_AUTO_THREADS)) {
avctx->thread_count = 1;
avctx->active_thread_type = 0;
} }
} }
......
...@@ -765,6 +765,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD ...@@ -765,6 +765,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
goto free_and_end; goto free_and_end;
} }
} }
if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS))
avctx->thread_count = 1;
if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {
av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n",
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define LIBAVCODEC_VERSION_MAJOR 53 #define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 49 #define LIBAVCODEC_VERSION_MINOR 49
#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \
......
FATE_DFA += fate-dfa1 FATE_DFA += fate-dfa1
fate-dfa1: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0000.dfa fate-dfa1: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0000.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa2 FATE_DFA += fate-dfa2
fate-dfa2: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0001.dfa fate-dfa2: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0001.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa3 FATE_DFA += fate-dfa3
fate-dfa3: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0002.dfa fate-dfa3: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0002.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa4 FATE_DFA += fate-dfa4
fate-dfa4: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0003.dfa fate-dfa4: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0003.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa5 FATE_DFA += fate-dfa5
fate-dfa5: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0004.dfa fate-dfa5: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0004.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa6 FATE_DFA += fate-dfa6
fate-dfa6: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0005.dfa fate-dfa6: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0005.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa7 FATE_DFA += fate-dfa7
fate-dfa7: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0006.dfa fate-dfa7: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0006.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa8 FATE_DFA += fate-dfa8
fate-dfa8: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0007.dfa fate-dfa8: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0007.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa9 FATE_DFA += fate-dfa9
fate-dfa9: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0008.dfa fate-dfa9: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0008.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa10 FATE_DFA += fate-dfa10
fate-dfa10: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0009.dfa fate-dfa10: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0009.dfa -pix_fmt rgb24
FATE_DFA += fate-dfa11 FATE_DFA += fate-dfa11
fate-dfa11: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0010.dfa fate-dfa11: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0010.dfa -pix_fmt rgb24
FATE_TESTS += $(FATE_DFA) FATE_TESTS += $(FATE_DFA)
fate-dfa: $(FATE_DFA) fate-dfa: $(FATE_DFA)
0, 0, 308224, 0x7264439e 0, 0, 921600, 0xb69faa34
0, 11520, 308224, 0xe1734f4b 0, 11520, 921600, 0x38680829
0, 23040, 308224, 0x9cfe28a4 0, 23040, 921600, 0xa7263c5a
0, 34560, 308224, 0xebb6ec8b 0, 34560, 921600, 0xa784626a
0, 46080, 308224, 0xaef16ca7 0, 46080, 921600, 0xb4c47212
0, 57600, 308224, 0x0390b439 0, 57600, 921600, 0xd17285ea
0, 69120, 308224, 0xe69bd008 0, 69120, 921600, 0xe9b33902
0, 80640, 308224, 0xa1818468 0, 80640, 921600, 0x215ea693
0, 92160, 308224, 0x9d6e7d82 0, 92160, 921600, 0xe2ab6c7a
0, 103680, 308224, 0x54971a9e 0, 103680, 921600, 0xf2867624
0, 115200, 308224, 0xe14e15a8 0, 115200, 921600, 0x607d78c1
0, 126720, 308224, 0xa026cf3f 0, 126720, 921600, 0x6e743bb7
0, 138240, 308224, 0xf8921be4 0, 138240, 921600, 0x1fbf8f5a
0, 149760, 308224, 0xf49a42cc 0, 149760, 921600, 0xac6c912e
0, 161280, 308224, 0xa4108f17 0, 161280, 921600, 0x556933bc
0, 172800, 308224, 0xfa79cbfe 0, 172800, 921600, 0xda4c242b
0, 184320, 308224, 0x3431f47b 0, 184320, 921600, 0xa6b32f83
0, 195840, 308224, 0x72aa3426 0, 195840, 921600, 0x1ecc2996
0, 207360, 308224, 0x81159f85 0, 207360, 921600, 0xf1c3fc0f
0, 218880, 308224, 0x04bcb289 0, 218880, 921600, 0x3f1db909
0, 230400, 308224, 0xb1dabbcd 0, 230400, 921600, 0x7582fb93
0, 241920, 308224, 0x7e851c8c 0, 241920, 921600, 0x102ba261
0, 253440, 308224, 0x8bdea0bf 0, 253440, 921600, 0xfbcf9de0
0, 264960, 308224, 0xecacdb11 0, 264960, 921600, 0xe9ecb4d9
0, 276480, 308224, 0xec4c6c41 0, 276480, 921600, 0x7ee36a42
0, 0, 65024, 0x8f31c3f0 0, 0, 192000, 0x7384f9b2
0, 6390, 65024, 0x164a2d82 0, 6390, 192000, 0xd1f61c71
0, 12780, 65024, 0xbb72b738 0, 12780, 192000, 0x0c6937d1
0, 19170, 65024, 0x45b93e3a 0, 19170, 192000, 0x56459a3a
0, 25560, 65024, 0xcc4019df 0, 25560, 192000, 0x6d011790
0, 31950, 65024, 0x64644557 0, 31950, 192000, 0xb5347ce8
0, 38340, 65024, 0xb4584b28 0, 38340, 192000, 0xcd422568
0, 44730, 65024, 0x1d87966a 0, 44730, 192000, 0xde4fef2d
0, 0, 65024, 0x10db5645 0, 0, 192000, 0x4269d703
0, 6390, 65024, 0xb5d8a5bd 0, 6390, 192000, 0xdf8667e7
0, 12780, 65024, 0xc9555f27 0, 12780, 192000, 0x450026ad
0, 19170, 65024, 0x74c43f84 0, 19170, 192000, 0x2528ea52
0, 25560, 65024, 0x5b2445b0 0, 25560, 192000, 0x83bcd1ec
0, 31950, 65024, 0x8bd5be38 0, 31950, 192000, 0x88d5ba27
0, 38340, 65024, 0x75ec97da 0, 38340, 192000, 0x44424577
0, 44730, 65024, 0x34416636 0, 44730, 192000, 0xd93f12a3
0, 51120, 65024, 0x9cc2abcf 0, 51120, 192000, 0xcd625f3e
0, 0, 308224, 0x8dc9803f 0, 0, 921600, 0x8a5d15df
0, 6390, 308224, 0x06308b37 0, 6390, 921600, 0x92c01362
0, 12780, 308224, 0xb8cb7be6 0, 12780, 921600, 0xe1a31643
0, 19170, 308224, 0xc538862b 0, 19170, 921600, 0x37a90fe2
0, 25560, 308224, 0x8d4b7702 0, 25560, 921600, 0x74410783
0, 31950, 308224, 0x97a479f0 0, 31950, 921600, 0xecf4ef1a
0, 38340, 308224, 0x63d08e67 0, 38340, 921600, 0x4d7ff3d4
0, 44730, 308224, 0x470e8a18 0, 44730, 921600, 0xac820317
0, 51120, 308224, 0x08aa6be4 0, 51120, 921600, 0xbe5ff56e
0, 57510, 308224, 0x3b2f6f9a 0, 57510, 921600, 0x8e59c329
0, 63900, 308224, 0xf0f1490c 0, 63900, 921600, 0x73bf23f3
0, 70290, 308224, 0xcb8b2ec5 0, 70290, 921600, 0xb90c780f
0, 76680, 308224, 0xab361e75 0, 76680, 921600, 0xfbd9dc32
0, 83070, 308224, 0x485aed6d 0, 83070, 921600, 0x30586821
0, 89460, 308224, 0xd3e7ecb7 0, 89460, 921600, 0x6695195b
0, 95850, 308224, 0xa2c0d561 0, 95850, 921600, 0xc449aa85
0, 102240, 308224, 0xd8f8ccd4 0, 102240, 921600, 0xca6a391c
0, 0, 65024, 0xbf9d558b 0, 0, 192000, 0x236a1b54
0, 9000, 65024, 0x4c7ea2ac 0, 9000, 192000, 0xfb438b68
0, 18000, 65024, 0x4931827c 0, 18000, 192000, 0xde504563
0, 27000, 65024, 0x5a9e09a7 0, 27000, 192000, 0xfaf88e05
0, 36000, 65024, 0x2b76eca9 0, 36000, 192000, 0xe15de5af
0, 45000, 65024, 0xd5400a96 0, 45000, 192000, 0x641fcca4
0, 54000, 65024, 0xcca17f23 0, 54000, 192000, 0x74899cb6
0, 63000, 65024, 0xebca0dec 0, 63000, 192000, 0x93fdb1b4
0, 72000, 65024, 0x07a73cfc 0, 72000, 192000, 0x58d83456
0, 81000, 65024, 0xdd5e4620 0, 81000, 192000, 0x7d3012ac
0, 0, 308224, 0x5a24821c 0, 0, 921600, 0xd9e060e3
0, 12780, 308224, 0xa1ecf793 0, 12780, 921600, 0x15e28dc7
0, 25560, 308224, 0xcb91afa5 0, 25560, 921600, 0x78e8bfbc
0, 38340, 308224, 0x8b7e85b9 0, 38340, 921600, 0xe9407075
0, 51120, 308224, 0xe4755628 0, 51120, 921600, 0xab818b8a
0, 63900, 308224, 0xe4755628 0, 63900, 921600, 0xab818b8a
0, 76680, 308224, 0xe4755628 0, 76680, 921600, 0xab818b8a
0, 89460, 308224, 0xe4755628 0, 89460, 921600, 0xab818b8a
0, 102240, 308224, 0xe4755628 0, 102240, 921600, 0xab818b8a
0, 115020, 308224, 0xe4755628 0, 115020, 921600, 0xab818b8a
0, 127800, 308224, 0xdd6ca523 0, 127800, 921600, 0xad5ad11c
0, 140580, 308224, 0x961ba417 0, 140580, 921600, 0xe6e50f8c
0, 153360, 308224, 0x5ed15e7f 0, 153360, 921600, 0x9f127099
0, 0, 65024, 0x54831a1a 0, 0, 192000, 0x9754890f
0, 9000, 65024, 0x110f5bad 0, 9000, 192000, 0x01668965
0, 18000, 65024, 0xdd4f97fa 0, 18000, 192000, 0xbd1b5e12
0, 27000, 65024, 0x1ab375b2 0, 27000, 192000, 0x2e97fb9f
0, 36000, 65024, 0x311b51d3 0, 36000, 192000, 0xf8b452e2
0, 45000, 65024, 0xb0614f71 0, 45000, 192000, 0xc6859449
0, 54000, 65024, 0x6d968927 0, 54000, 192000, 0x910844f7
0, 63000, 65024, 0x28d85028 0, 63000, 192000, 0x99443581
0, 72000, 65024, 0x74ea41f5 0, 72000, 192000, 0xec52d1e5
0, 81000, 65024, 0x3480b067 0, 81000, 192000, 0x2fc66c35
0, 90000, 65024, 0x3e1115d4 0, 90000, 192000, 0xd9af7379
0, 99000, 65024, 0x0c715b57 0, 99000, 192000, 0x947a26ef
0, 108000, 65024, 0x3acaaea3 0, 108000, 192000, 0x7b77ab28
0, 117000, 65024, 0x1b60f1e8 0, 117000, 192000, 0x2507637e
0, 126000, 65024, 0xcee14632 0, 126000, 192000, 0x6ce8c0ea
0, 0, 65024, 0x190f2398 0, 0, 192000, 0xb718dc63
0, 6390, 65024, 0x19d8c3e0 0, 6390, 192000, 0x2efb7b89
0, 12780, 65024, 0x848020a2 0, 12780, 192000, 0x70827047
0, 19170, 65024, 0xbb64696f 0, 19170, 192000, 0x61e1fd2f
0, 25560, 65024, 0x85886472 0, 25560, 192000, 0x06f8bccd
0, 31950, 65024, 0xc9c26668 0, 31950, 192000, 0xf0362404
0, 38340, 65024, 0xf24d1524 0, 38340, 192000, 0xc00fc1b8
0, 44730, 65024, 0x64d98cd0 0, 44730, 192000, 0x94265476
0, 51120, 65024, 0xa1323b5e 0, 51120, 192000, 0x4b50ad23
0, 57510, 65024, 0x9f48dcf9 0, 57510, 192000, 0x4d578b60
0, 63900, 65024, 0x1a0591da 0, 63900, 192000, 0xfb14b875
0, 70290, 65024, 0x8eabf12e 0, 70290, 192000, 0x81682338
0, 0, 3648, 0xb6174031 0, 0, 7866, 0xab73dae7
0, 6390, 3648, 0x2e4649b0 0, 6390, 7866, 0x100adec8
0, 12780, 3648, 0xe05247cb 0, 12780, 7866, 0x1a20ddfa
0, 19170, 3648, 0x003941f0 0, 19170, 7866, 0xc358cd16
0, 25560, 3648, 0xa2563fed 0, 25560, 7866, 0xee0bd20e
0, 31950, 3648, 0x23d34cf1 0, 31950, 7866, 0xef26bef9
0, 38340, 3648, 0x624f5173 0, 38340, 7866, 0xa9d0c755
0, 44730, 3648, 0xc07a491e 0, 44730, 7866, 0x6c11cc7c
0, 51120, 3648, 0x74214090 0, 51120, 7866, 0x4d6ed988
0, 57510, 3648, 0xebfd469c 0, 57510, 7866, 0x9965cf24
0, 63900, 3648, 0x60083f49 0, 63900, 7866, 0x9a12db24
0, 70290, 3648, 0x6096486f 0, 70290, 7866, 0x2e85cfeb
0, 0, 45932, 0xf9bc2e69 0, 0, 134724, 0x53784ca9
0, 6390, 45932, 0x5b8736ad 0, 6390, 134724, 0x14c345b7
0, 12780, 45932, 0x4521ba17 0, 12780, 134724, 0xe0d0dd51
0, 19170, 45932, 0xf3a374a9 0, 19170, 134724, 0xd53b5610
0, 25560, 45932, 0x3fdfdc70 0, 25560, 134724, 0x7cbb8d47
0, 31950, 45932, 0x4eb18dbb 0, 31950, 134724, 0x875d67c4
0, 38340, 45932, 0x633c6377 0, 38340, 134724, 0x9811c085
0, 44730, 45932, 0x77dce8ba 0, 44730, 134724, 0x25f6d228
0, 51120, 45932, 0x8246fecd 0, 51120, 134724, 0x349495a0
0, 57510, 45932, 0xe8864c0d 0, 57510, 134724, 0xd0d75311
0, 63900, 45932, 0x995740d1 0, 63900, 134724, 0xb49cdfbb
0, 70290, 45932, 0xc8a298ee 0, 70290, 134724, 0x9fa69518
0, 76680, 45932, 0xa3535672 0, 76680, 134724, 0x28a1f58c
0, 83070, 45932, 0xb553f58b 0, 83070, 134724, 0xb8dab657
0, 89460, 45932, 0x8a5b3b92 0, 89460, 134724, 0x8c7e3b3b
0, 95850, 45932, 0x1bcd50b0 0, 95850, 134724, 0x37268acf
0, 102240, 45932, 0xf22b0531 0, 102240, 134724, 0xcce8ca02
0, 108630, 45932, 0x5f62bc78 0, 108630, 134724, 0xe0fd0c28
0, 115020, 45932, 0xc669075f 0, 115020, 134724, 0x5bdac906
0, 121410, 45932, 0xae3b4e80 0, 121410, 134724, 0xdd850bf0
0, 127800, 45932, 0x3f52062f 0, 127800, 134724, 0x2002a228
0, 134190, 45932, 0xde97a978 0, 134190, 134724, 0x633617ea
0, 140580, 45932, 0x3ba7ca71 0, 140580, 134724, 0x2a3ef337
0, 146970, 45932, 0xe418aba1 0, 146970, 134724, 0x507886c3
0, 153360, 45932, 0xb8b3f24b 0, 153360, 134724, 0x51c0f07b
0, 159750, 45932, 0xd054791d 0, 159750, 134724, 0x5e73dce1
0, 166140, 45932, 0xddf121ce 0, 166140, 134724, 0x26acc6f0
0, 172530, 45932, 0xf0dcdd42 0, 172530, 134724, 0x360c4349
0, 178920, 45932, 0xd5aa9281 0, 178920, 134724, 0xc7dbabd4
0, 185310, 45932, 0xffe8450b 0, 185310, 134724, 0x671bbf66
0, 191700, 45932, 0x84f9424a 0, 191700, 134724, 0x4d44df79
0, 198090, 45932, 0xe6c7592e 0, 198090, 134724, 0x69eade5b
0, 204480, 45932, 0xc29c492d 0, 204480, 134724, 0x2b1bca82
0, 210870, 45932, 0x87186732 0, 210870, 134724, 0x8b16af47
0, 217260, 45932, 0x02c73e12 0, 217260, 134724, 0xb59fa1bd
0, 223650, 45932, 0x32eb90c8 0, 223650, 134724, 0x2ec17c24
0, 0, 77076, 0x33b3bf99 0, 0, 228150, 0xde68df49
0, 6390, 77076, 0xde70a282 0, 6390, 228150, 0x8e12bcaf
0, 12780, 77076, 0x8d4c10a4 0, 12780, 228150, 0x851b04f7
0, 19170, 77076, 0xeb536bcc 0, 19170, 228150, 0x7e5e0950
0, 25560, 77076, 0x86cce3e8 0, 25560, 228150, 0x1d92219f
0, 31950, 77076, 0x292df285 0, 31950, 228150, 0x93caa693
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