summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-08-27 08:26:14 +0200
committerAnton Khirnov <anton@khirnov.net>2011-08-31 13:19:14 +0200
commit297d9cb3dc6850b83ba4e95789143833cecdfd87 (patch)
tree102aa9f94dd1fe2e4e44d044fa6fd3a4c44417a0 /libavcodec
parentd2f119a1f2d2d72b0001fcdf2cc051b022bf6528 (diff)
mpeg12enc: add intra_vlc private option.
Deprecate CODEC_FLAG2_INTRA_VLC.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/arm/asm-offsets.h12
-rw-r--r--libavcodec/avcodec.h2
-rw-r--r--libavcodec/mpeg12enc.c22
-rw-r--r--libavcodec/mpegvideo.h1
-rw-r--r--libavcodec/mpegvideo_enc.c2
-rw-r--r--libavcodec/options.c2
-rw-r--r--libavcodec/version.h3
7 files changed, 38 insertions, 6 deletions
diff --git a/libavcodec/arm/asm-offsets.h b/libavcodec/arm/asm-offsets.h
index 89994569c1..4864a9bdd9 100644
--- a/libavcodec/arm/asm-offsets.h
+++ b/libavcodec/arm/asm-offsets.h
@@ -29,11 +29,11 @@
#endif
/* MpegEncContext */
-#define Y_DC_SCALE 0xa8
-#define C_DC_SCALE 0xac
-#define AC_PRED 0xb0
-#define BLOCK_LAST_INDEX 0xb4
-#define H263_AIC 0xe4
-#define INTER_SCANTAB_RASTER_END 0x12c
+#define Y_DC_SCALE 0xac
+#define C_DC_SCALE 0xb0
+#define AC_PRED 0xb4
+#define BLOCK_LAST_INDEX 0xb8
+#define H263_AIC 0xe8
+#define INTER_SCANTAB_RASTER_END 0x130
#endif /* AVCODEC_ARM_ASM_OFFSETS_H */
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e9cf0eaa8a..408438e62f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -616,7 +616,9 @@ typedef struct RcOverride{
#define CODEC_FLAG2_AUD 0x00000200 ///< H.264 access unit delimiters
#define CODEC_FLAG2_BRDO 0x00000400 ///< B-frame rate-distortion optimization
#endif
+#if FF_API_MPEGVIDEO_GLOBAL_OPTS
#define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< Use MPEG-2 intra VLC table.
+#endif
#define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format.
#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 6602d81f6c..eca57d0df7 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -33,6 +33,8 @@
#include "mpeg12data.h"
#include "bytestream.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
static const uint8_t inv_non_linear_qscale[13] = {
0, 2, 4, 6, 8,
@@ -925,6 +927,24 @@ static void mpeg1_encode_block(MpegEncContext *s,
put_bits(&s->pb, table_vlc[112][1], table_vlc[112][0]);
}
+#define OFFSET(x) offsetof(MpegEncContext, x)
+#define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption options[] = {
+ { "intra_vlc", "Use MPEG-2 intra VLC table.", OFFSET(intra_vlc_format), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE },
+ { NULL },
+};
+
+#define mpeg12_class(x)\
+static const AVClass mpeg## x ##_class = {\
+ .class_name = "mpeg" #x "video encoder",\
+ .item_name = av_default_item_name,\
+ .option = options,\
+ .version = LIBAVUTIL_VERSION_INT,\
+};
+
+mpeg12_class(1)
+mpeg12_class(2)
+
AVCodec ff_mpeg1video_encoder = {
.name = "mpeg1video",
.type = AVMEDIA_TYPE_VIDEO,
@@ -937,6 +957,7 @@ AVCodec ff_mpeg1video_encoder = {
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
.capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
+ .priv_class = &mpeg1_class,
};
AVCodec ff_mpeg2video_encoder = {
@@ -951,4 +972,5 @@ AVCodec ff_mpeg2video_encoder = {
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE},
.capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
+ .priv_class = &mpeg2_class,
};
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 47c8e8a38d..0790b075f0 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -199,6 +199,7 @@ typedef struct MotionEstContext{
* MpegEncContext.
*/
typedef struct MpegEncContext {
+ AVClass *class;
struct AVCodecContext *avctx;
/* the following parameters must be initialized before encoding */
int width, height;///< picture size. must be a multiple of 16
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 6ca48d8fb3..42fd6609c9 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -336,7 +336,9 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
s->obmc= !!(s->flags & CODEC_FLAG_OBMC);
s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER);
s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN);
+#if FF_API_MPEGVIDEO_GLOBAL_OPTS
s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC);
+#endif
s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT);
if(avctx->rc_max_rate && !avctx->rc_buffer_size){
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 9f7a899a75..19a4133a78 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -407,7 +407,9 @@ static const AVOption options[]={
{"partb8x8", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_B8X8 }, INT_MIN, INT_MAX, V|E, "partitions"},
{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), FF_OPT_TYPE_INT, {.dbl = 6 }, 0, INT_MAX, V|E},
{"mv0_threshold", NULL, OFFSET(mv0_threshold), FF_OPT_TYPE_INT, {.dbl = 256 }, 0, INT_MAX, V|E},
+#if FF_API_MPEGVIDEO_GLOBAL_OPTS
{"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_INTRA_VLC }, INT_MIN, INT_MAX, V|E, "flags2"},
+#endif
{"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, {.dbl = 40 }, 1, INT_MAX, V|E},
{"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, {.dbl = FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E},
{"min_prediction_order", NULL, OFFSET(min_prediction_order), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E},
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 889e945082..928513f002 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -86,5 +86,8 @@
#ifndef FF_API_X264_GLOBAL_OPTS
#define FF_API_X264_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_MPEGVIDEO_GLOBAL_OPTS
+#define FF_API_MPEGVIDEO_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
#endif /* AVCODEC_VERSION_H */