summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/Makefile2
-rw-r--r--libavcodec/avcodec.h12
-rw-r--r--libavcodec/cook.c12
-rw-r--r--libavcodec/dnxhdenc.c1
-rw-r--r--libavcodec/dv.c3
-rw-r--r--libavcodec/ffv1.c3
-rw-r--r--libavcodec/h264.c4
-rw-r--r--libavcodec/mpeg12.c4
-rw-r--r--libavcodec/mpeg12enc.c4
-rw-r--r--libavcodec/mpeg4videoenc.c2
-rw-r--r--libavcodec/mpegvideo_enc.c1
-rw-r--r--libavcodec/opt.h16
-rw-r--r--libavcodec/pthread.c3
-rw-r--r--libavcodec/truemotion1.c4
-rw-r--r--libavcodec/tta.c5
-rw-r--r--libavcodec/utils.c8
-rw-r--r--libavcodec/v210x.c2
-rw-r--r--libavcodec/version.h8
18 files changed, 72 insertions, 22 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index df2cda03dc..62ac8999a8 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -3,7 +3,7 @@ include $(SUBDIR)../config.mak
NAME = avcodec
FFLIBS = avutil
-HEADERS = avcodec.h avfft.h dxva2.h vaapi.h vdpau.h version.h xvmc.h
+HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h version.h xvmc.h
OBJS = allcodecs.o \
audioconvert.o \
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index dd1dd6bf3b..1919b2cd33 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -680,6 +680,10 @@ typedef struct RcOverride{
* Codec supports frame-level multithreading.
*/
#define CODEC_CAP_FRAME_THREADS 0x1000
+/**
+ * Codec supports slice-based (or partition-based) multithreading.
+ */
+#define CODEC_CAP_SLICE_THREADS 0x2000
//The following defines may change, don't expect compatibility if you use them.
#define MB_TYPE_INTRA4x4 0x0001
@@ -3633,6 +3637,14 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
+#if FF_API_THREAD_INIT
+/**
+ * @deprecated Set s->thread_count before calling avcodec_open() instead of calling this.
+ */
+attribute_deprecated
+int avcodec_thread_init(AVCodecContext *s, int thread_count);
+#endif
+
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
//FIXME func typedef
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 3f7776bed0..27a45f318b 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -1136,7 +1136,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
switch (q->subpacket[s].cookversion) {
case MONO:
if (q->nb_channels != 1) {
- av_log(avctx,AV_LOG_ERROR,"Container channels != 1, report sample!\n");
+ av_log_ask_for_sample(avctx, "Container channels != 1.!\n");
return -1;
}
av_log(avctx,AV_LOG_DEBUG,"MONO\n");
@@ -1150,7 +1150,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
break;
case JOINT_STEREO:
if (q->nb_channels != 2) {
- av_log(avctx,AV_LOG_ERROR,"Container channels != 2, report sample!\n");
+ av_log_ask_for_sample(avctx, "Container channels != 2.\n");
return -1;
}
av_log(avctx,AV_LOG_DEBUG,"JOINT_STEREO\n");
@@ -1188,7 +1188,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
break;
default:
- av_log(avctx,AV_LOG_ERROR,"Unknown Cook version, report sample!\n");
+ av_log_ask_for_sample(avctx, "Unknown Cook version.\n");
return -1;
break;
}
@@ -1205,7 +1205,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
/* Try to catch some obviously faulty streams, othervise it might be exploitable */
if (q->subpacket[s].total_subbands > 53) {
- av_log(avctx,AV_LOG_ERROR,"total_subbands > 53, report sample!\n");
+ av_log_ask_for_sample(avctx, "total_subbands > 53\n");
return -1;
}
@@ -1215,7 +1215,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
}
if (q->subpacket[s].subbands > 50) {
- av_log(avctx,AV_LOG_ERROR,"subbands > 50, report sample!\n");
+ av_log_ask_for_sample(avctx, "subbands > 50\n");
return -1;
}
q->subpacket[s].gains1.now = q->subpacket[s].gain_1;
@@ -1226,7 +1226,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q->num_subpackets++;
s++;
if (s > MAX_SUBPACKETS) {
- av_log(avctx,AV_LOG_ERROR,"Too many subpackets > 5, report file!\n");
+ av_log_ask_for_sample(avctx, "Too many subpackets > 5\n");
return -1;
}
}
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index bd73290031..6d1a17fd0a 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -869,6 +869,7 @@ AVCodec ff_dnxhd_encoder = {
dnxhd_encode_init,
dnxhd_encode_picture,
dnxhd_encode_end,
+ .capabilities = CODEC_CAP_SLICE_THREADS,
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
.priv_class = &class,
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 6a4914768d..5fca22f9f7 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -1297,6 +1297,7 @@ AVCodec ff_dvvideo_encoder = {
sizeof(DVVideoContext),
dvvideo_init_encoder,
dvvideo_encode_frame,
+ .capabilities = CODEC_CAP_SLICE_THREADS,
.pix_fmts = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
};
@@ -1312,7 +1313,7 @@ AVCodec ff_dvvideo_decoder = {
NULL,
dvvideo_close,
dvvideo_decode_frame,
- CODEC_CAP_DR1,
+ CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
NULL,
.max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index b00b463e16..0a982e8754 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -1795,7 +1795,7 @@ AVCodec ff_ffv1_decoder = {
NULL,
common_end,
decode_frame,
- CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
+ CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/ | CODEC_CAP_SLICE_THREADS,
NULL,
.long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
};
@@ -1809,6 +1809,7 @@ AVCodec ff_ffv1_encoder = {
encode_init,
encode_frame,
common_end,
+ .capabilities = CODEC_CAP_SLICE_THREADS,
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
};
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index c64e6fb3f9..22a57866d4 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3467,7 +3467,9 @@ AVCodec ff_h264_decoder = {
NULL,
ff_h264_decode_end,
decode_frame,
- /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_FRAME_THREADS,
+ /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY |
+ CODEC_CAP_FRAME_THREADS |
+ CODEC_CAP_SLICE_THREADS,
.flush= flush_dpb,
.long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
.init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 9afe8c3385..192ecdd478 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2602,7 +2602,7 @@ AVCodec ff_mpeg2video_decoder = {
NULL,
mpeg_decode_end,
mpeg_decode_frame,
- CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
+ CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
.flush= flush,
.max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
@@ -2619,7 +2619,7 @@ AVCodec ff_mpegvideo_decoder = {
NULL,
mpeg_decode_end,
mpeg_decode_frame,
- CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
+ CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
.flush= flush,
.max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index b2526f6b7a..cc1d9c8230 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -940,7 +940,7 @@ AVCodec ff_mpeg1video_encoder = {
MPV_encode_end,
.supported_framerates= ff_frame_rate_tab+1,
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .capabilities= CODEC_CAP_DELAY,
+ .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
};
@@ -954,6 +954,6 @@ AVCodec ff_mpeg2video_encoder = {
MPV_encode_end,
.supported_framerates= ff_frame_rate_tab+1,
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE},
- .capabilities= CODEC_CAP_DELAY,
+ .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
};
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index d6834a6e40..f6a18b77cc 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1359,6 +1359,6 @@ AVCodec ff_mpeg4_encoder = {
MPV_encode_picture,
MPV_encode_end,
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .capabilities= CODEC_CAP_DELAY,
+ .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
};
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 9255fa872a..7760ee58b6 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3802,6 +3802,7 @@ AVCodec ff_h263p_encoder = {
MPV_encode_init,
MPV_encode_picture,
MPV_encode_end,
+ .capabilities = CODEC_CAP_SLICE_THREADS,
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"),
};
diff --git a/libavcodec/opt.h b/libavcodec/opt.h
new file mode 100644
index 0000000000..e754bb93d8
--- /dev/null
+++ b/libavcodec/opt.h
@@ -0,0 +1,16 @@
+/**
+ * @file
+ * This header is provided for compatibility only and will be removed
+ * on next major bump
+ */
+
+#ifndef AVCODEC_OPT_H
+#define AVCODEC_OPT_H
+
+#include "libavcodec/version.h"
+
+#if FF_API_OPT_H
+#include "libavutil/opt.h"
+#endif
+
+#endif
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 82b0732592..e0eea4b1f1 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -877,7 +877,8 @@ static void validate_thread_parameters(AVCodecContext *avctx)
avctx->active_thread_type = 0;
} else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) {
avctx->active_thread_type = FF_THREAD_FRAME;
- } else if (avctx->thread_type & FF_THREAD_SLICE) {
+ } else if (avctx->codec->capabilities & CODEC_CAP_SLICE_THREADS &&
+ avctx->thread_type & FF_THREAD_SLICE) {
avctx->active_thread_type = FF_THREAD_SLICE;
}
}
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index c7d414a648..b1b14319c5 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -353,7 +353,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
s->flags = FLAG_KEYFRAME;
if (s->flags & FLAG_SPRITE) {
- av_log(s->avctx, AV_LOG_INFO, "SPRITE frame found, please report the sample to the developers\n");
+ av_log_ask_for_sample(s->avctx, "SPRITE frame found.\n");
/* FIXME header.width, height, xoffset and yoffset aren't initialized */
#if 0
s->w = header.width;
@@ -370,7 +370,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
if ((s->w < 213) && (s->h >= 176))
{
s->flags |= FLAG_INTERPOLATED;
- av_log(s->avctx, AV_LOG_INFO, "INTERPOLATION selected, please report the sample to the developers\n");
+ av_log_ask_for_sample(s->avctx, "INTERPOLATION selected.\n");
}
}
}
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index eb4d71ff85..ece5c1c43b 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -247,7 +247,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
if (s->is_float)
{
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n");
+ av_log_ask_for_sample(s->avctx, "Unsupported sample format.\n");
return -1;
}
else switch(s->bps) {
@@ -256,7 +256,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
// case 3: avctx->sample_fmt = AV_SAMPLE_FMT_S24; break;
case 4: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break;
default:
- av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n");
+ av_log_ask_for_sample(s->avctx,
+ "Invalid/unsupported sample format.\n");
return -1;
}
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 47b752a794..ec3f4b965b 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1295,3 +1295,11 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field)
}
#endif
+
+#if FF_API_THREAD_INIT
+int avcodec_thread_init(AVCodecContext *s, int thread_count)
+{
+ s->thread_count = thread_count;
+ return ff_thread_init(s);
+}
+#endif
diff --git a/libavcodec/v210x.c b/libavcodec/v210x.c
index 0d6a681b78..962678dde6 100644
--- a/libavcodec/v210x.c
+++ b/libavcodec/v210x.c
@@ -52,7 +52,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
if(avpkt->size > avctx->width * avctx->height * 8 / 3){
- av_log(avctx, AV_LOG_ERROR, "Probably padded data, need sample!\n");
+ av_log_ask_for_sample(avctx, "Probably padded data\n");
}
pic->reference= 0;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5e88f10b99..e5ca102814 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -21,7 +21,7 @@
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 53
-#define LIBAVCODEC_VERSION_MINOR 0
+#define LIBAVCODEC_VERSION_MINOR 1
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -62,5 +62,11 @@
#ifndef FF_API_REQUEST_CHANNELS
#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_OPT_H
+#define FF_API_OPT_H (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_THREAD_INIT
+#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
#endif /* AVCODEC_VERSION_H */