summaryrefslogtreecommitdiff
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-10 19:02:01 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-18 18:19:28 +0100
commit3e70c7023e598afa15d40ae3fce62ae1eee25195 (patch)
tree55c3073d01dd16e295d687e01cd21be1f315cc64 /ffmpeg_opt.c
parentcbcfd7da4d1f5d43b0b9abb05d9b6fc4451cad0d (diff)
ffmpeg: support setting the chroma intra matrix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 26798f712b..5db961a1fa 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1265,6 +1265,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
char *frame_size = NULL;
char *frame_pix_fmt = NULL;
char *intra_matrix = NULL, *inter_matrix = NULL;
+ char *chroma_intra_matrix = NULL;
int do_pass = 0;
int i;
@@ -1297,6 +1298,16 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
}
parse_matrix_coeffs(video_enc->intra_matrix, intra_matrix);
}
+ MATCH_PER_STREAM_OPT(chroma_intra_matrices, str, chroma_intra_matrix, oc, st);
+ if (chroma_intra_matrix) {
+ uint16_t *p = av_mallocz(sizeof(*video_enc->chroma_intra_matrix) * 64);
+ if (!p) {
+ av_log(NULL, AV_LOG_FATAL, "Could not allocate memory for intra matrix.\n");
+ exit_program(1);
+ }
+ av_codec_set_chroma_intra_matrix(video_enc, p);
+ parse_matrix_coeffs(p, chroma_intra_matrix);
+ }
MATCH_PER_STREAM_OPT(inter_matrices, str, inter_matrix, oc, st);
if (inter_matrix) {
if (!(video_enc->inter_matrix = av_mallocz(sizeof(*video_enc->inter_matrix) * 64))) {
@@ -2860,6 +2871,9 @@ const OptionDef options[] = {
{ "inter_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(inter_matrices) },
"specify inter matrix coeffs", "matrix" },
+ { "chroma_intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC |
+ OPT_OUTPUT, { .off = OFFSET(chroma_intra_matrices) },
+ "specify intra matrix coeffs", "matrix" },
{ "top", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_INT| OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) },
"top=1/bottom=0/auto=-1 field first", "" },