[FFmpeg-cvslog] vp9: add profile names
James Almer
git at videolan.org
Mon May 4 23:41:23 CEST 2015
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon May 4 18:37:50 2015 -0300| [079b7f6eacc09bc2813fc1ddc230ab05022b69c2] | committer: James Almer
vp9: add profile names
Reviewed-by: Ronald S. Bultje <rsbultje at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=079b7f6eacc09bc2813fc1ddc230ab05022b69c2
---
doc/APIchanges | 3 +++
libavcodec/avcodec.h | 3 +++
libavcodec/version.h | 2 +-
libavcodec/vp9.c | 22 ++++++++++++++--------
4 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index b65fd62..bf0913a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2014-08-09
API changes, most recent first:
+2015-05-04 - xxxxxxx - 56.37.100 - avcodec.h
+ Add FF_PROFILE_VP9_0 and FF_PROFILE_VP9_1.
+
2015-xx-xx - xxxxxxx - lavf 56.xx.xxx - avformat.h
Add AVFMT_FLAG_FAST_SEEK flag. Some formats (initially mp3) use it to enable
fast, but inaccurate seeking.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8c7c420..3d5e82d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2912,6 +2912,9 @@ typedef struct AVCodecContext {
#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
#define FF_PROFILE_HEVC_REXT 4
+#define FF_PROFILE_VP9_0 0
+#define FF_PROFILE_VP9_1 1
+
/**
* level
* - encoding: Set by user.
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 41c4145..a4aa547 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR 36
+#define LIBAVCODEC_VERSION_MINOR 37
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 71ed4e6..c2ac997 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -107,7 +107,6 @@ typedef struct VP9Context {
ptrdiff_t y_stride, uv_stride;
// bitstream header
- uint8_t profile;
uint8_t keyframe, last_keyframe;
uint8_t invisible;
uint8_t use_last_frame_mvs;
@@ -481,7 +480,7 @@ static enum AVPixelFormat read_colorspace_details(AVCodecContext *ctx)
ctx->colorspace = colorspaces[get_bits(&s->gb, 3)];
if (ctx->colorspace == AVCOL_SPC_RGB) { // RGB = profile 1
- if (s->profile == 1) {
+ if (ctx->profile == 1) {
s->ss_h = s->ss_v = 1;
res = AV_PIX_FMT_GBRP;
ctx->color_range = AVCOL_RANGE_JPEG;
@@ -495,7 +494,7 @@ static enum AVPixelFormat read_colorspace_details(AVCodecContext *ctx)
{ AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV420P },
};
ctx->color_range = get_bits1(&s->gb) ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
- if (s->profile == 1) {
+ if (ctx->profile == 1) {
s->ss_h = get_bits1(&s->gb);
s->ss_v = get_bits1(&s->gb);
if ((res = pix_fmt_for_ss[s->ss_v][s->ss_h]) == AV_PIX_FMT_YUV420P) {
@@ -532,10 +531,10 @@ static int decode_frame_header(AVCodecContext *ctx,
av_log(ctx, AV_LOG_ERROR, "Invalid frame marker\n");
return AVERROR_INVALIDDATA;
}
- s->profile = get_bits1(&s->gb);
- s->profile |= get_bits1(&s->gb) << 1;
- if (s->profile > 1) {
- av_log(ctx, AV_LOG_ERROR, "Profile %d is not yet supported\n", s->profile);
+ ctx->profile = get_bits1(&s->gb);
+ ctx->profile |= get_bits1(&s->gb) << 1;
+ if (ctx->profile > 1) {
+ av_log(ctx, AV_LOG_ERROR, "Profile %d is not yet supported\n", ctx->profile);
return AVERROR_INVALIDDATA;
}
if (get_bits1(&s->gb)) {
@@ -569,7 +568,7 @@ static int decode_frame_header(AVCodecContext *ctx,
av_log(ctx, AV_LOG_ERROR, "Invalid sync code\n");
return AVERROR_INVALIDDATA;
}
- if (s->profile == 1) {
+ if (ctx->profile == 1) {
if ((fmt = read_colorspace_details(ctx)) < 0)
return fmt;
} else {
@@ -4080,6 +4079,12 @@ static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
return 0;
}
+static const AVProfile profiles[] = {
+ { FF_PROFILE_VP9_0, "Profile 0" },
+ { FF_PROFILE_VP9_1, "Profile 1" },
+ { FF_PROFILE_UNKNOWN },
+};
+
AVCodec ff_vp9_decoder = {
.name = "vp9",
.long_name = NULL_IF_CONFIG_SMALL("Google VP9"),
@@ -4093,4 +4098,5 @@ AVCodec ff_vp9_decoder = {
.flush = vp9_decode_flush,
.init_thread_copy = ONLY_IF_THREADS_ENABLED(vp9_decode_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp9_decode_update_thread_context),
+ .profiles = NULL_IF_CONFIG_SMALL(profiles),
};
More information about the ffmpeg-cvslog
mailing list