[FFmpeg-devel] [PATCH 2/2] proresenc: move profile handling to global avcodec options

2014-07-17 Thread Timothy Gu
This allows users to use the two encoders with the same syntax.

Signed-off-by: Timothy Gu timothyg...@gmail.com
---
 libavcodec/avcodec.h|  5 +
 libavcodec/options_table.h  |  5 +
 libavcodec/proresenc_anatoliy.c |  5 -
 libavcodec/proresenc_kostya.c   | 44 +
 4 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 93ba4d0..cd29065 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2862,6 +2862,11 @@ typedef struct AVCodecContext {
 #define FF_PROFILE_JPEG2000_DCINEMA_2K  3
 #define FF_PROFILE_JPEG2000_DCINEMA_4K  4
 
+#define FF_PROFILE_PRORES_PROXY 0
+#define FF_PROFILE_PRORES_LT1
+#define FF_PROFILE_PRORES_STANDARD  2
+#define FF_PROFILE_PRORES_HQ3
+#define FF_PROFILE_PRORES_  4
 
 #define FF_PROFILE_HEVC_MAIN1
 #define FF_PROFILE_HEVC_MAIN_10 2
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index cbefa52..7d0a425 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -338,6 +338,11 @@ static const AVOption avcodec_options[] = {
 {dts_96_24, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_96_24 }, 
INT_MIN, INT_MAX, A|E, profile},
 {dts_hd_hra, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_HD_HRA }, 
INT_MIN, INT_MAX, A|E, profile},
 {dts_hd_ma, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_HD_MA }, 
INT_MIN, INT_MAX, A|E, profile},
+{prores_proxy, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_PRORES_PROXY 
}, INT_MIN, INT_MAX, V|E, profile },
+{prores_lt,NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_PRORES_LT },  
  INT_MIN, INT_MAX, V|E, profile },
+{prores_standard,NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
FF_PROFILE_PRORES_STANDARD }, INT_MIN, INT_MAX, V|E, profile },
+{prores_hq,NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_PRORES_HQ },  
  INT_MIN, INT_MAX, V|E, profile },
+{prores_,  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_PRORES_ 
},  INT_MIN, INT_MAX, V|E, profile },
 {level, NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, 
INT_MIN, INT_MAX, V|A|E, level},
 {unknown, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, 
INT_MAX, V|A|E, level},
 {lowres, decode at 1= 1/2, 2=1/4, 3=1/8 resolutions, OFFSET(lowres), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|A|D},
diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index b8531cd..b66f405 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -36,11 +36,6 @@
 
 #define DEFAULT_SLICE_MB_WIDTH 8
 
-#define FF_PROFILE_PRORES_PROXY 0
-#define FF_PROFILE_PRORES_LT1
-#define FF_PROFILE_PRORES_STANDARD  2
-#define FF_PROFILE_PRORES_HQ3
-
 static const AVProfile profiles[] = {
 { FF_PROFILE_PRORES_PROXY,apco},
 { FF_PROFILE_PRORES_LT,   apcs},
diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 93bcde7..9505df0 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -40,14 +40,6 @@
 #define MAX_PLANES 4
 
 enum {
-PRORES_PROFILE_PROXY = 0,
-PRORES_PROFILE_LT,
-PRORES_PROFILE_STANDARD,
-PRORES_PROFILE_HQ,
-PRORES_PROFILE_,
-};
-
-enum {
 QUANT_MAT_PROXY = 0,
 QUANT_MAT_LT,
 QUANT_MAT_STANDARD,
@@ -1214,6 +1206,19 @@ static av_cold int encode_init(AVCodecContext *avctx)
 
 avctx-codec_tag   = ctx-profile_info-tag;
 
+if (avctx-profile == FF_PROFILE_UNKNOWN) {
+avctx-profile = FF_PROFILE_PRORES_STANDARD;
+av_log(avctx, AV_LOG_INFO,
+   no profile specified. encoding with ProRes standard (apcn) 
profile\n);
+} else if (avctx-profile  FF_PROFILE_PRORES_PROXY
+|| avctx-profile  FF_PROFILE_PRORES_) {
+av_log(avctx, AV_LOG_ERROR,
+   unknown profile %d. Supported profiles: prores_proxy, 
prores_lt,\n
+   prores_standard, prores_hq, prores_.\n,
+   avctx-profile);
+return AVERROR(EINVAL);
+}
+
 av_log(avctx, AV_LOG_DEBUG,
profile %d, %d slices, interlacing: %s, %d bits per MB\n,
ctx-profile, ctx-slices_per_picture * ctx-pictures_per_frame,
@@ -1230,19 +1235,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
 static const AVOption options[] = {
 { mbs_per_slice, macroblocks per slice, OFFSET(mbs_per_slice),
 AV_OPT_TYPE_INT, { .i64 = 8 }, 1, MAX_MBS_PER_SLICE, VE },
-{ profile,   NULL, OFFSET(profile), AV_OPT_TYPE_INT,
-{ .i64 = PRORES_PROFILE_STANDARD },
-PRORES_PROFILE_PROXY, PRORES_PROFILE_, VE, profile },
-{ proxy, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
PRORES_PROFILE_PROXY },
-0, 0, VE, profile },
-{ lt,NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRORES_PROFILE_LT 
},
-0, 0, VE, profile },
-{ standard,  

Re: [FFmpeg-devel] [PATCH 2/2] proresenc: move profile handling to global avcodec options

2014-07-17 Thread Michael Niedermayer
On Thu, Jul 17, 2014 at 06:04:07PM -0700, Timothy Gu wrote:
 This allows users to use the two encoders with the same syntax.
 
 Signed-off-by: Timothy Gu timothyg...@gmail.com
 ---
  libavcodec/avcodec.h|  5 +
  libavcodec/options_table.h  |  5 +
  libavcodec/proresenc_anatoliy.c |  5 -
  libavcodec/proresenc_kostya.c   | 44 
 +

seems to break fate

--- ./tests/ref/vsynth/vsynth1-prores_ks2014-07-17 16:00:41.213032673 
+0200
+++ tests/data/fate/vsynth1-prores_ks   2014-07-18 04:40:34.717993203 +0200
@@ -1,4 +0,0 @@
-fe41a284da97ea5ec8866ca9a55b84da *tests/data/fate/vsynth1-prores_ks.mov
-3858911 tests/data/fate/vsynth1-prores_ks.mov
-100eb002413fe7a632d440dfbdf7e3ff 
*tests/data/fate/vsynth1-prores_ks.out.rawvideo
-stddev:3.17 PSNR: 38.09 MAXDIFF:   39 bytes:  7603200/  7603200


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
Used only once- Some unspecified defect prevented a second use
In good condition - Can be repaird by experienced expert
As is - You wouldnt want it even if you were payed for it, if you knew ...


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel