[FFmpeg-devel] [PATCH] libvpx: add token_partitions option
James Zern
jzern
Tue Oct 12 23:21:58 CEST 2010
Sorry for the delay in response to the ping on '[PATCH] libvpx:
deadline & profile support', I've been offline a bit and am just
coming back up to speed.
The attached adds a codec-specific option for libvpxenc to enable
setting the number of token partitions.
This does inherit a warning in the copy over from libvorbis for the
priv_class initialization. Should the AVCodec definition change or is
this acceptable?
-------------- next part --------------
Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h (revision 25455)
+++ libavcodec/avcodec.h (working copy)
@@ -32,7 +32,7 @@
#define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 92
-#define LIBAVCODEC_VERSION_MICRO 0
+#define LIBAVCODEC_VERSION_MICRO 1
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
Index: libavcodec/libvpxenc.c
===================================================================
--- libavcodec/libvpxenc.c (revision 25455)
+++ libavcodec/libvpxenc.c (working copy)
@@ -28,6 +28,7 @@
#include <vpx/vpx_encoder.h>
#include <vpx/vp8cx.h>
+#include "libavutil/opt.h"
#include "avcodec.h"
#include "libavutil/base64.h"
@@ -52,8 +53,22 @@
struct vpx_fixed_buf twopass_stats;
unsigned long deadline; //i.e., RT/GOOD/BEST
struct FrameListData *coded_frame_list;
+
+ /**
+ * Number of token partitions.
+ * Indicates number of sub-streams in the bitstream. Used for parallelized
+ * decoding.
+ * Valid values are 1, 2, 4 & 8
+ */
+ int token_partitions;
} VP8Context;
+static const AVOption options[]={
+{"token_partitions", "Number of sub-streams in bitstream (1,2,4,8). Used for parallelized decoding.", offsetof(VP8Context, token_partitions), FF_OPT_TYPE_INT, 1, 1, 8, AV_OPT_FLAG_ENCODING_PARAM},
+{NULL}
+};
+static const AVClass class = { "libvpx", NULL, options, LIBAVUTIL_VERSION_INT };
+
/** String mappings for enum vp8e_enc_control_id */
static const char *ctlidstr[] = {
[VP8E_UPD_ENTROPY] = "VP8E_UPD_ENTROPY",
@@ -310,6 +325,7 @@
av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n");
codecctl_int(avctx, VP8E_SET_CPUUSED, cpuused);
codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction);
+ codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(ctx->token_partitions));
//provide dummy value to initialize wrapper, values will be updated each _encode()
vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1,
@@ -505,4 +521,5 @@
CODEC_CAP_DELAY,
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"),
+ .priv_class= &class,
};
More information about the ffmpeg-devel
mailing list