Author Topic: file format for FPP  (Read 2567 times)

Offline charleskerr

  • Jr. Member
  • **
  • Join Date: Jun 2013
  • Location: Oak Hill, VA
  • Posts: 87
  • Kudos: 0
file format for FPP
« on: March 01, 2014, 06:04:48 PM »
With out having to dig through others code, is there a place that the file format for the FPP is documented, if one wanted to export to that format?
One is never too old to learn

Offline David Pitts

  • Administrator
  • *****
  • Join Date: Mar 2013
  • Location: Falcon, CO
  • Posts: 3,734
  • Kudos: 63
Re: file format for FPP
« Reply #1 on: March 01, 2014, 06:18:23 PM »
Yes. When I get home I will place it in documents and place a link to it here.
PixelController, LLC
PixelController.com

Offline smeighan

  • Developer
  • ******
  • Join Date: Mar 2013
  • Location: Highlands Ranch, Colorado
  • Posts: 1,033
  • Kudos: 11
    • Nutcracker123
Re: file format for FPP
« Reply #2 on: March 02, 2014, 12:22:03 AM »
and to go along with dave's document, here is the routine that writes a fpp *.fseq file from xlights

Code: [Select]
void xLightsFrame::WriteFalconPiFile(const wxString& filename)
{
    wxUint8 vMinor = 0;
    wxUint8 vMajor = 1;
    wxUint32 dataOffset = 28;
    wxUint16 fixedHeaderLength = 28;
    wxUint32 stepSize = SeqNumChannels + (SeqNumChannels%4);
    // Fixed 50 Milliseconds
    wxUint16 stepTime = 50;
    // Ignored by Pi Player
    wxUint16 numUniverses = 0;
    // Ignored by Pi Player
    wxUint16 universeSize = 0;
    // Gamma 0=encoded 1=linear
    wxUint8 gamma = 1;
    // Gamma 0=unknown 1=mono 2=RGB
    wxUint8 colorEncoding = 2;

    wxFile f;
    // Step Size must be multiple of 4
    //wxUint8 buf[stepSize];
    wxUint8* buf;
    buf = (wxUint8 *)calloc(sizeof(wxUint8),stepSize);

    size_t ch;
    if (!f.Create(filename,true))
    {
        ConversionError(_("Unable to create file: ")+filename);
        return;
    }

    // Header Information
    // Format Identifier
    buf[0] = 'F';
    buf[1] = 'S';
    buf[2] = 'E';
    buf[3] = 'Q';
    // Data offset
    buf[4] = (wxUint8)(dataOffset%256);
    buf[5] = (wxUint8)(dataOffset/256);
    // Data offset
    buf[6] = vMinor;
    buf[7] = vMajor;
    // Fixed header length
    buf[8] = (wxUint8)(fixedHeaderLength%256);
    buf[9] = (wxUint8)(fixedHeaderLength/256);
    // Step Size
    buf[10] = (wxUint8)(stepSize & 0xFF);
    buf[11] = (wxUint8)((stepSize >> 8) & 0xFF);
    buf[12] = (wxUint8)((stepSize >> 16) & 0xFF);
    buf[13] = (wxUint8)((stepSize >> 24) & 0xFF);
    // Number of Steps
    buf[14] = (wxUint8)(SeqNumPeriods & 0xFF);
    buf[15] = (wxUint8)((SeqNumPeriods >> 8) & 0xFF);
    buf[16] = (wxUint8)((SeqNumPeriods >> 16) & 0xFF);
    buf[17] = (wxUint8)((SeqNumPeriods >> 24) & 0xFF);
    // Step time in ms
    buf[18] = (wxUint8)(stepTime & 0xFF);
    buf[19] = (wxUint8)((stepTime >> 8) & 0xFF);
    // universe count
    buf[20] = (wxUint8)(numUniverses & 0xFF);
    buf[21] = (wxUint8)((numUniverses >> 8) & 0xFF);
    // universe Size
    buf[22] = (wxUint8)(universeSize & 0xFF);
    buf[23] = (wxUint8)((universeSize >> 8) & 0xFF);
    // universe Size
    buf[24] = gamma;
    // universe Size
    buf[25] = colorEncoding;
    buf[26] =0;
    buf[27] = 0;
    f.Write(buf,fixedHeaderLength);

    for (long period=0; period < SeqNumPeriods; period++)
    {
        //if (period % 500 == 499) TextCtrlConversionStatus->AppendText(wxString::Format("Writing time period %ld\n",period+1));
        wxYield();
        for(ch=0;ch<stepSize;ch++)
        {
          buf[ch] = ch < SeqNumChannels ? SeqData[(ch *SeqNumPeriods) + period] : 0;
        }
        f.Write(buf,stepSize);
    }
    f.Close();
}
« Last Edit: March 02, 2014, 02:17:32 PM by David Pitts »
Sean
Littleton, CO
Latest releases http://nutcracker123.com/nutcracker/releases
xLights/Nutcracker Forum http://nutcracker123.com/forum/index.php
Facebook [url=https://www.facebook.com/groups

Offline David Pitts

  • Administrator
  • *****
  • Join Date: Mar 2013
  • Location: Falcon, CO
  • Posts: 3,734
  • Kudos: 63
Re: file format for FPP
« Reply #3 on: March 02, 2014, 03:16:35 AM »
Here is the file.

[attachment deleted by admin]

Offline MyKroFt

  • Administrator
  • *****
  • Join Date: Mar 2013
  • Location: NC Montana
  • Posts: 1,389
  • Kudos: 54
Re: file format for FPP
« Reply #4 on: March 02, 2014, 01:07:33 PM »
for future reference - please put pasted code into the CODE BBC - that way it does not get displayed differently - Seans code for me has smiles etc into it - so the forum software is not displaying it in its orig form.....

Myk

Offline drlucas

  • Developer
  • ******
  • Join Date: Sep 2013
  • Location: Barrie, Ontario - Canada
  • Posts: 1,417
  • Kudos: 3
Re: file format for FPP
« Reply #5 on: March 02, 2014, 05:42:20 PM »
Sean's code always makes me smile :p
Ryan

derekbackus

  • Guest
Re: file format for FPP
« Reply #6 on: June 01, 2014, 05:50:50 PM »
Here is the file.

Been searching for this for a few minutes. Thank you!

Offline charleskerr

  • Jr. Member
  • **
  • Join Date: Jun 2013
  • Location: Oak Hill, VA
  • Posts: 87
  • Kudos: 0
Re: file format for FPP
« Reply #7 on: September 01, 2014, 08:08:37 AM »
Sorry to bring this thread back to life, but I have a few questions.

Just want to get some terminology understood. 

A "Step" is a buffer of data that is for one "50ms" (or whatever rate one has) worth of channels.

One has a "gamma" field with a 1 for "linear".  What does this field represent, and what are the other values.

One has a TYPE field, and it can be RGB or (1 for mono)????  If one has 2 (RGB) what does this indicate (in terms of the data stream)  What would a value of 1 (mono?) mean in terms of the data stream?

At offset 28 one has the step data starting. It says it is zero padded to be on 4 byte boundaries.  I assume this is not each "pixel" worth of information, but the entire step buffer must be on a 4 byte boundary (so I have 5 pixels (15 channels), my step buffer would be 16 bytes. Versus 20 bytes if it was each "pixel" had to be 4 byte boundary.).

Lastly, is the data assumed to be written in RGB order for the "channels" in the step buffer (so if I have one pixel, assume the format to alway be R=channel1, G=channel2, blue=channel 3). ?

Online CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 8,268
  • Kudos: 151
Re: file format for FPP
« Reply #8 on: September 01, 2014, 08:31:07 AM »
Correct on step size.

Gamma is not currently used so I will defer to David for the exact intention but I believe it was to allow FPP to adjust output if needed.

Type isn't used yet either.

The 4-byte padding is for the step size not for any pixel info.  FPP currently just deals with raw channels it does not know what features or colors those channels might be for.  There is no implicit or implied RGB channel ordering, it is whatever your hardware or lights require.

-
Chris

Offline charleskerr

  • Jr. Member
  • **
  • Join Date: Jun 2013
  • Location: Oak Hill, VA
  • Posts: 87
  • Kudos: 0
Re: file format for FPP
« Reply #9 on: September 01, 2014, 11:53:42 AM »
Ok, that helps a lot.  Curious why the step size must be a multiple of 4. 

The last thing I have having problems understanding is from the pdf:
Quote
28 +(2* Channels)

That isn't actually correct is it, if I have to pad for multiples of four. Or is it just the all the step sizes combined that together must be on a multiple of 4 bytes?

Online CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 8,268
  • Kudos: 151
Re: file format for FPP
« Reply #10 on: September 01, 2014, 03:43:27 PM »
Don't have the code in front of me but I believe the step itself must be a multiple of four.  This was in case we wanted to optimize by prebufferjng or anything that might benefit from 4-byte alignment.

 

Back to top