diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-09-05 03:35:46 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-09-06 11:49:03 +0000 |
commit | 8bd13eb8be592b97566ca229efbb7535fb021fb1 (patch) | |
tree | 260425158ab6837040f3b0c7f56eeb38ee25ca6f | |
parent | 4b2bafbd4c8ecba0d6d4c932b0acab185be5b7c5 (diff) | |
download | ffmpeg-8bd13eb8be592b97566ca229efbb7535fb021fb1.tar.gz |
avfilter/vf_stereo3d: add HDMI output format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavfilter/vf_stereo3d.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libavfilter/vf_stereo3d.c b/libavfilter/vf_stereo3d.c index af837de2af..299a18f32f 100644 --- a/libavfilter/vf_stereo3d.c +++ b/libavfilter/vf_stereo3d.c @@ -62,6 +62,7 @@ enum StereoCode { ALTERNATING_RL, // alternating frames (right eye first, left eye second) CHECKERBOARD_LR, // checkerboard pattern (left eye first, right eye second) CHECKERBOARD_RL, // checkerboard pattern (right eye first, left eye second) + HDMI, // HDMI frame pack (left eye first, right eye second) STEREO_CODE_COUNT // TODO: needs autodetection }; @@ -145,6 +146,7 @@ typedef struct Stereo3DContext { int pixstep[4]; AVFrame *prev; double ts_unit; + int blanks; int in_off_left[4], in_off_right[4]; } Stereo3DContext; @@ -196,6 +198,7 @@ static const AVOption stereo3d_options[] = { { "sbsr", "side by side right first", 0, AV_OPT_TYPE_CONST, {.i64=SIDE_BY_SIDE_RL}, 0, 0, FLAGS, "out" }, { "chl", "checkerboard left first", 0, AV_OPT_TYPE_CONST, {.i64=CHECKERBOARD_LR}, 0, 0, FLAGS, "out" }, { "chr", "checkerboard right first", 0, AV_OPT_TYPE_CONST, {.i64=CHECKERBOARD_RL}, 0, 0, FLAGS, "out" }, + { "hdmi", "HDMI frame pack", 0, AV_OPT_TYPE_CONST, {.i64=HDMI}, 0, 0, FLAGS, "out" }, { NULL } }; @@ -446,6 +449,14 @@ static int config_output(AVFilterLink *outlink) s->out.height = s->height * 2; s->out.row_right = s->height; break; + case HDMI: + if (s->in.height <= 720) + s->blanks = 30; + else + s->blanks = 45; + s->out.height = s->height * 2 + s->blanks; + s->out.row_right = s->height + s->blanks; + break; case ABOVE_BELOW_2_RL: aspect.num *= 2; case ABOVE_BELOW_RL: @@ -614,6 +625,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) } switch (s->out.format) { + case HDMI: + for (i = 0; i < s->nb_planes; i++) { + int j, h = s->height >> ((i == 1 || i == 2) ? s->vsub : 0); + int b = (s->blanks) >> ((i == 1 || i == 2) ? s->vsub : 0); + + for (j = h; j < h + b; j++) + memset(oleft->data[i] + j * s->linesize[i], 0, s->linesize[i]); + } case ALTERNATING_LR: case ALTERNATING_RL: case SIDE_BY_SIDE_LR: |