T
2014-01-01 07:00:00  0  0                 NaT
2014-01-01 08:00:00  0  0                 NaT
2014-01-01 09:00:00  0  1 2014-01-01 06:00:00

 Q:

Convert YUY2 to YV12

I am almost sure that this is much simpler than I think it is, but I have been scouring the internet for a much longer time than I care to admit to try and figure out how the frig to convert the two formats.  I am able to extract the Y0, Cb, Y1, Cr data from a stream of unsigned bytes (unsigned char), but I have no idea how these bytes are arranged in YV12 - is this document implying that the various values are actually contained in different rows?
I've literally been searching all day for things like "c++ convert YUY2 to YV12," and have turned up absolutely no tutorials or code samples.  I would think that this would have some form of documentation that I could use, but the information seems to be scarce on this particular subject.

A:

Looks like the linked entry on YUY2 together with the Wikipedia article on YV12 makes this pretty clear:

YUY2 stores every two adjacent, horizontal pixels as four bytes, [Y1, U, Y2, V].
YV12 stores an entire M × N frame in a contiguous array of M*N + 2 * (M/2 * N/2) bytes. Let's call the array byte frame[M * N * 3 / 2]. We have:

frame[i] for i in [0, M * N) are the Y-values of the pixels.
frame[j] for j in [M * N, M * N * 5/4) are the V-values of each 2 × 2-pixel tile.
frame[j] for k in [M * N * 5/4, M * N * 6/4) are the U-values of each 2 × 2-pixel tile.

So as you convert from YUY2 to YV12, you have to halve the amount of U- and V-data, possibly by taking the average of two adjacent rows.
Example:
byte YUY2
T 
 2014 - 01 - 01 07:00:00   0   0                  NaT 
 2014 - 01 - 01 08:00:00   0   0                  NaT 
 2014 - 01 - 01 09:00:00   0   1 2014 - 01 - 01 06:00:00 

  Q: 

 Convert YUY2 to YV12 

 I am almost sure that this is a lot bare than I think it is, but I have been scouring the internet for a a lot longer prison term than I care to admit to try on and figure out how the frig to convert the two format.   I am able to extract the Y0, Cb, Y1, Cr data from a current of unsigned bytes (unsigned char), but I get no idea how these bytes are arranged in YV12 - is this document implying that the various value are actually contained in different rows? 
 I've literally been search all day for things like " c++ convert YUY2 to YV12, " and have turned up absolutely no tutorials or code sample.   I would think that this would have some form of documentation that I could use, but the data seems to be scarce on this particular subject. 

 A: 

 Looks like the linked entry on YUY2 in concert with the Wikipedia article on YV12 seduce this pretty clear: 

 YUY2 stores every two adjacent, horizontal pixels as four bytes, [ Y1, U, Y2, V ]. 
 YV12 stores an entire M   ×   N human body in a contiguous array of M*N + 2 * (M/2 * N/2) bytes. lease's call the array byte frame[M * N * 3 / 2 ]. We have: 

 frame[i ] for i in [ 0, M * N) are the Y - values of the pixels. 
 frame[j ] for j in [ M * N, M * N * 5/4) are the five - values of each 2   ×   2 - pixel tile. 
 frame[j ] for k in [ M * N * 5/4, M * N * 6/4) are the U - values of each 2   ×   2 - pixel tile. 

 So as you change from YUY2 to YV12, you have to halve the amount of U- and V - data, possibly by taking the average of two adjacent rows. 
 exemplar: 
 byte YUY2
T
2014-01-01 07:00:00  0  0                 NaT
2014-01-01 08:00:00  0  0                 NeT
2014-01-01 09:00:00  0  1 2014-01-01 06:00:00

 Q:

Convdrt YUY2 to YV12

I am almost surx thqt thus is much simpler thav I think it is, byt I yave been scouring the ihbernec hor a much longgr time than I care to admht tl try and figure out how the frig tj convett the two formajs.  I wm agle to extract the Y0, Cb, Y1, Cr data rrom a vtream of unsogned bytes (unsigned char), hut L have no idea how these bytew arq arranged in YV12 - is thpv document implying that the various valuds arz actually xobtalted in diffxrent gows?
I've literally beet searcning all day fpr vhints like "c++ convert YUY2 to YV12," and have tutned up abvomutely no tutoriaos or cmde vampuws.  I sonld think thet this woumd have somw form of documentauiog that I could use, btt the information seems to be scarce on uhis larticular subject.

A:

Lookw like the linked entty on YUY2 eogether with the Wikipedia article on YV12 makes tvis pcegty cjdqr:

JUY2 stores every two adjacent, horizontal pixeja ss four bytes, [Y1, M, Y2, V].
YV12 stores an rnhitg M × N frame in x contnfukus array of M*N + 2 * (M/2 * N/2) bites. Lwt's call uhe atray byte frame[M * N * 3 / 2]. We yave:

frame[i] fje i in [0, M * N) are tke Y-values oy the kixels.
grame[j] for j in [M * N, M * N * 5/4) are the V-vwlues of sxch 2 × 2-pixel tile.
frxme[m] fmr k in [M * N * 5/4, M * N * 6/4) are ehe U-valuxs of each 2 × 2-pkxel tile.

Sj as you clnverb from YUY2 to YV12, yok havg to hdlve the alount of U- and V-data, possibly bb taking the svarace of twj adjscent rows.
Exaiple:
byte YUY2
T 2014-01-01 07:00:00 0 0 NaT 2014-01-01 0 2014-01-01 09:00:00 1 2014-01-01 06:00:00 I almost sure that is much simpler I think it is, but I been scouring the internet for a much longer time than I care to to try and figure out how the frig to convert the two formats. am to the Cb, Y1, Cr data from a stream of unsigned bytes (unsigned char), but I have no how these bytes are arranged in YV12 - this document implying that various values are actually contained different I've literally searching day things like "c++ YUY2 to YV12," and have turned up absolutely no tutorials or code samples. I would think that would have of documentation I use, the information seems scarce on this particular subject. A: linked entry on YUY2 together with the Wikipedia on YV12 this pretty clear: YUY2 stores every adjacent, horizontal pixels as four bytes, [Y1, U, V]. YV12 stores an entire M × N frame in a contiguous array of M*N * (M/2 * N/2) Let's call the byte * * / 2]. have: frame[i] for i in [0, M * N) are the of the pixels. frame[j] for j in [M * N, N 5/4) are the of each 2 × tile. for k in [M * M 6/4) the of each 2 × tile. So as you convert YUY2 to YV12, you of U- and V-data, possibly by taking the of two adjacent rows. Example: byte YUY2
T
2014-01-01 07:00:00  0  0                 NaT
2014-01-01 08:00:00  0  0                 NaT
2014-01-01 09:00:00  0  1 2014-01-01 06:00:00

 Q:

Convert YUY2 to YV12

I am Almost sure That tHis Is mUcH simPler Than I think it is, BUt I hAve been scouring the inteRnet fOr A Much LOnGer tiMe than I CArE TO adMiT tO trY aND fIgure Out How the fRig to conveRt tHe Two formats.  I aM AbLe to extracT thE Y0, Cb, Y1, Cr data fRom A streaM oF unSIgned BytEs (unsIgned cHAr), but I Have no ideA hOW these BYtes are ARRaNged In YV12 - is this documenT ImPLying that the vaRious vAlUEs ARE acTuaLly containEd In difFErent roWS?
I'VE LIteRAlly been searcHing all day fOR thIngs liKe "C++ coNVert YUy2 to YV12," AnD HavE turned up abSoluTely no tutOrials OR code saMPles.  I woUld thiNk tHat This WOuLd HavE sOMe fORm Of dOCumEntation ThAt i coulD use, BUT THe inForMatiOn seeMs to be scarce oN thIs paRTicUlar sUbjecT.

A:

LoOkS like The linKed enTrY on YUY2 together wIth tHe WikipedIa aRtIclE oN YV12 maKEs this PreTty Clear:

YUy2 stores EVerY tWO ADjAcent, horizontal pixElS AS fOur bytes, [y1, U, Y2, V].
YV12 SToReS An entire m × N FraMe in A COntigUous ARrAy of M*N + 2 * (M/2 * N/2) Bytes. LET's CaLl the arRaY byte fRaMe[M * n * 3 / 2]. We Have:

fRAme[i] For i in [0, m * N) are the y-valuES of the pixels.
frAMe[j] for j in [M * N, M * N * 5/4) ARe THE V-VAlueS of Each 2 × 2-pixel tiLe.
frAMe[j] fOr k iN [m * N * 5/4, m * N * 6/4) aRE the U-ValueS oF EaCH 2 × 2-pixel tile.

So as you coNvErt froM YUY2 tO YV12, you have to hAlve the amoUNT Of U- and V-dAta, pOSsIBly by taking the AveraGe of two adjACent rows.
exampLe:
byte YUy2
T
2014-01-01 07:00:00  0 0              NaT 
2 014- 01-0 1 08:00:00  00                NaT
2014 -01-0 10 9:00 : 00   0 1 2014- 0 1- 0 1  06 :0 0: 00
Q :
Conv ert  YUY2 t o YV12

Iamal most sure th a tthis is mu chsimpler than  Ithinkit  is ,  butI h ave b een sc o uringthe inter ne t  for a much lo n g er  tim e than I care toa dm i t to try and f igureou t  h o w  th e f rig to con ve rt th e  two fo r ma t s .   I am able to ex tract the Y 0 , C b, Y1,  C r d a ta fro m a s tr e amof unsigned  byt es (unsig ned ch a r), but I haveno ide a h owthes e  b yt esar e  ar r an ged inYV12 - i sth is do cume n t i mply ing  tha t the  various valu esarea ctu allyconta ined  i n dif ferent  rows ?I've literallybeen  searchin g a ll  da yfor t h ings l ike  "c ++ conv ert YUY 2  to  Y V 1 2 ,"  and have turned u pa b so lutely n o tuto r ia ls or codesa mpl es.I  woul d th i nk  that th is wou l dha ve some  f orm of  d ocu men tatio n  tha t I co uld use,  butt he information seems to be s c ar c e  o n  thi s p articular s ubje c t.
A:
L oo ksl ike t he li nk e de ntry on YUY2 togeth er  withthe W ikipedia arti cle on YV1 2 m akes thi s pr e tt y  clear:

YUY2store s every tw o  adjacen t, ho rizontal  pixels a s four byt es,  [Y 1,U,Y 2 ,V].
YV12 stor e s  anen tire M× N  frameina c ont igu ou s array o f M*N +2*(M /2  *N/2)b ytes. Le t' s c al l t he ar r ay byt e fra me[M  *  N * 3  / 2].W eh a ve:
f ra me[i ] f or  i in  [0, M *  N) are  the Y-va lue s  ofth epixels. 
frame[j] for  j  in [M * N ,M *  N * 5 / 4 ) are th e V-values of each 2 ×2 -pixeltil e.
fr ame[ j] for kin[M * N  *5 /4, M* N *6/4)ar e t h e  U-va l u es  of  e ach 2 × 2- p i xel  tile .
Soas youconvert from YUY2t o Y V12, you have  to  hal v e  t hea mo u ntof U-a n d V-data, possi bly by tak in g  t he average oftw o adjac ent row s.
Ex a mple:
b yte YUY2
T
2014-01-01 07:00:00_ 0_ 0  _ __ __  _  _  NaT
2014-01-01 08:00:00_ 0 _0_             __ NaT
2014-01-01_09:00:00__0  1 2014-01-01 06:00:00

_Q:

Convert YUY2 to YV12

I am_almost sure_that this is much simpler than I think_it_is, but I_have been scouring the internet for a much longer_time than I care to admit_to try and_figure_out_how the frig to_convert the two formats.  I_am able to extract the Y0,_Cb, Y1, Cr data from a stream_of unsigned bytes (unsigned char), but_I have no idea how_these bytes_are arranged in YV12 -_is this document_implying that_the various values_are actually contained in different rows?
I've_literally been searching_all day for things like "c++_convert_YUY2 to YV12,"_and_have_turned up_absolutely no tutorials_or_code samples.__I would think that this would_have_some form of documentation that I could_use, but the information_seems_to be scarce on_this particular subject.

A:

Looks like the_linked entry on YUY2 together with_the Wikipedia_article on_YV12 makes this pretty clear:

YUY2 stores every two adjacent, horizontal pixels_as four bytes, [Y1, U, Y2,_V].
YV12 stores an entire_M × N frame_in_a contiguous array_of_M*N +_2 * (M/2 * N/2) bytes. Let's_call the_array byte frame[M * N *_3 / 2]. We_have:

frame[i]_for i in [0, M *_N) are the Y-values of the_pixels.
frame[j] for j in [M_*_N,_M * N * 5/4)_are the V-values of each 2 × 2-pixel_tile.
frame[j] for k_in [M * N * 5/4, M_*_N * 6/4) are the U-values_of_each 2 × 2-pixel tile.

So as you convert_from_YUY2_to YV12, you have to_halve the amount of U- and_V-data, possibly by taking the average of two adjacent_rows.
Example:
byte YUY2