First moving pictures

This commit is contained in:
F5OEO 2019-01-01 22:56:02 +00:00
parent b356479493
commit bb613f90ab
3 changed files with 37 additions and 35 deletions

View file

@ -640,34 +640,29 @@ void SimpleTestAtv(uint64_t Freq)
atv atvtest(Freq, SR, 14, 625);
//Frame 0
for (int j = 0; j < 312; j++)
{
if (j < 160)
{
for (int i = 0; i < 52; i++)
{
samples[i + j * 52] = 255*(1-i/52.0);//Frame 0
samples[i + j*52+312*52] =255*(1-i/52.0); //Frame 1
}
}
else
{
for (int i = 0; i < 52; i++)
{
samples[i + j * 52] = 255*(1-i/52.0);
samples[i + j*52+312*52] =255*(1-i/52.0);
}
}
}
//atvtest.SetFrame(samples,625);
atvtest.start();
while (running)
for(int frame=0;running;frame++)
{
for(int i=0;i<625;i++)
{
for (int j = 0; j < 52; j++)
{
if(i%2==0)
samples[i/2*52+j]=((i+j*frame)%255);
else
samples[i/2*52+j+52*312]=((i+j*frame)%255);
/*if(i%16<8)
samples[i*52+j]=(j%8<4)?0:255;
else
samples[i*52+j]=(j%8<4)?255:0;*/
}
}
//atvtest.SetTvSamples(samples,FifoSize/4);
usleep(400000);
atvtest.SetFrame(samples,625);
usleep(40000);
}
}

View file

@ -90,7 +90,7 @@ void atv::SetDmaAlgo()
for (int frame = 0; frame < 2; frame++)
{
//Preegalisation //6*4CB
//Preegalisation //6*4*2FrameCB
for (int i = 0; i < 6 /*-frame*/; i++)
{
//2us 0,30us 1
@ -143,7 +143,7 @@ void atv::SetDmaAlgo()
cbp->next = mem_virt_to_phys(cbp + 1);
cbp++;
}
//SYNC top trame 5*4CB
//SYNC top trame 5*4*2frameCB
for (int i = 0; i < 5; i++)
{
cbp->info = 0; //BCM2708_DMA_NO_WIDE_BURSTS | BCM2708_DMA_WAIT_RESP ;
@ -193,7 +193,7 @@ void atv::SetDmaAlgo()
cbp++;
}
//postegalisation ; copy paste from preegalisation
//5*4CB
//5*4*2CB
for (int i = 0; i < 5 /*-i*/; i++)
{
//2us 0,30us 1
@ -246,7 +246,7 @@ void atv::SetDmaAlgo()
cbp->next = mem_virt_to_phys(cbp + 1);
cbp++;
}
//(304+305)*(4+52*2)CB
//(304+305)*(4+52*2+2)CB
for (int line = 0; line < /*305*/ 304 + frame; line++)
{
@ -368,15 +368,24 @@ void atv::SetFrame(unsigned char *Luminance, size_t Lines)
{
for (size_t i = 0; i < Lines; i++)
{
for (size_t x = 0; x < 52; x++)
{
int AmplitudePAD = Luminance[i * 52 + x] * 6 + 1; //1 to 7
int AmplitudePAD = (Luminance[i * 52 + x]/255.0) * 6 + 1; //1 to 7
if (i % 2 == 0) // First field
usermem[i * 52 + x] = (0x5A << 24) + (AmplitudePAD & 0x7) + (1 << 4) + (0 << 3); // Amplitude PAD
else
usermem[i * 52 + x] = (0x5A << 24) + (AmplitudePAD & 0x7) + (1 << 4) + (0 << 3); // Amplitude PAD
}
/*for (size_t x = 0; x < 52; x++)
{
int AmplitudePAD = (Luminance[i * 52 + x]/255.0) * 6 + 1; //1 to 7
if (i % 2 == 0) // First field
usermem[i * 52 / 2 + x] = (0x5A << 24) + (AmplitudePAD & 0x7) + (1 << 4) + (0 << 3); // Amplitude PAD
else //second field
usermem[i * 52 / 2 + Lines / 2 + x] = (0x5A << 24) + (AmplitudePAD & 0x7) + (1 << 4) + (0 << 3); // Amplitude PAD
}
*/
}
}

View file

@ -31,7 +31,7 @@ extern "C"
dma::dma(int Channel,uint32_t CBSize,uint32_t UserMemSize) // Fixme! Need to check to be 256 Aligned for UserMem
{
fprintf(stderr,"Channel %d CBSize %d UsermemSize %d\n",Channel,CBSize,UserMemSize);
fprintf(stderr,"Channel %d CBSize %u UsermemSize %u\n",Channel,CBSize,UserMemSize);
channel=Channel;
mbox.handle = mbox_open();
@ -172,8 +172,6 @@ bufferdma::bufferdma(int Channel,uint32_t tbuffersize,uint32_t tcbbysample,uint3
registerbysample=tregisterbysample;
fprintf(stderr,"BufferSize %d , cb %d user %d\n",buffersize,buffersize*cbbysample,buffersize*registerbysample);
current_sample=0;
last_sample=0;
sample_available=buffersize;