[x265] CLI: allow 'mono' & 'mono16' color space for y4m input
Mateusz Brzostek
mateusz at msystem.waw.pl
Wed Oct 26 17:09:07 CEST 2016
I've based on FFmpeg -- if you execute wrong pixel format for y4m, for example:
ffmpeg -i 720p50_parkrun_ter.y4m -pix_fmt monow -f yuv4mpegpipe w.y4m
you can see error message:
ERROR: yuv4mpeg can only handle yuv444p, yuv422p, yuv420p, yuv411p and gray8 pixel formats.
And using 'strict -1' also yuv444p9, yuv422p9, yuv420p9, yuv444p10, yuv422p10, yuv420p10,
yuv444p12, yuv422p12, yuv420p12, yuv444p14, yuv422p14, yuv420p14, yuv444p16, yuv422p16,
yuv420p16 and gray16 pixel formats. Use -pix_fmt to select one.
For gray8 and gray16 the y4m header has mono and mono16 strings.
I found also mjpeg (yuv4mpeg creator?):
http://mjpeg.cvs.sourceforge.net/viewvc/mjpeg/mjpeg_play/utils/yuv4mpeg.h?revision=1.28&view=markup
-- see line 641.
Mateusz
W dniu 2016-10-25 o 06:18, Pradeep Ramachandran pisze:
>
> On Sun, Oct 16, 2016 at 11:17 PM, Mateusz <mateusz at msystem.waw.pl <mailto:mateusz at msystem.waw.pl>> wrote:
>
> This patch fixes issue #282.
>
> # HG changeset patch
> # User Ma0 <mateuszb at poczta.onet.pl <mailto:mateuszb at poczta.onet.pl>>
> # Date 1476639059 -7200
> # Sun Oct 16 19:30:59 2016 +0200
> # Node ID f49487ee92a296a36938dfb92b7b51c9fb7f2ff9
> # Parent c97805dad9148ad3cddba10a67ed5596508e8f86
> CLI: allow 'mono' & 'mono16' color space for y4m input
>
> diff -r c97805dad914 -r f49487ee92a2 source/input/y4m.cpp
> --- a/source/input/y4m.cpp Thu Oct 13 17:53:48 2016 +0800
> +++ b/source/input/y4m.cpp Sun Oct 16 19:30:59 2016 +0200
> @@ -280,7 +280,7 @@
> {
> c = ifs->get();
>
> - if (c <= '9' && c >= '0')
> + if (c <= 'o' && c >= '0')
> csp = csp * 10 + (c - '0');
> else if (c == 'p')
> {
> @@ -300,9 +300,23 @@
> break;
> }
>
> - if (d >= 8 && d <= 16)
> - depth = d;
> - colorSpace = (csp == 444) ? X265_CSP_I444 : (csp == 422) ? X265_CSP_I422 : X265_CSP_I420;
> + switch (csp)
> + {
> + case ('m'-'0')*100000 + ('o'-'0')*10000 + ('n'-'0')*1000 + ('o'-'0')*100 + 16:
> + colorSpace = X265_CSP_I400;
> + depth = 16;
> + break;
> +
> + case ('m'-'0')*1000 + ('o'-'0')*100 + ('n'-'0')*10 + ('o'-'0'):
> + colorSpace = X265_CSP_I400;
> + depth = 8;
> + break;
> +
> + default:
> + if (d >= 8 && d <= 16)
> + depth = d;
> + colorSpace = (csp == 444) ? X265_CSP_I444 : (csp == 422) ? X265_CSP_I422 : X265_CSP_I420;
> + }
>
>
> Do you have a pointer to the definition of the Y4M headers? From the description on wikipedia (https://wiki.multimedia.cx/index.php?title=YUV4MPEG2), I don't see the mono or mono16 string additions for the csp.
>
>
> break;
>
> default:
> @@ -324,7 +338,7 @@
> if (width < MIN_FRAME_WIDTH || width > MAX_FRAME_WIDTH ||
> height < MIN_FRAME_HEIGHT || height > MAX_FRAME_HEIGHT ||
> (rateNum / rateDenom) < 1 || (rateNum / rateDenom) > MAX_FRAME_RATE ||
> - colorSpace <= X265_CSP_I400 || colorSpace >= X265_CSP_COUNT)
> + colorSpace < X265_CSP_I400 || colorSpace >= X265_CSP_COUNT)
> return false;
>
> return true;
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org <mailto:x265-devel at videolan.org>
> https://mailman.videolan.org/listinfo/x265-devel <https://mailman.videolan.org/listinfo/x265-devel>
>
>
>
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20161026/ea802515/attachment.html>
More information about the x265-devel
mailing list