l35633
10th December 2014, 10:32
hello. I make a 10-bits x264 project for encoding.
profile is high10, yuv format is 4:2:0,
Y or U, V value is kept by 2 bytes.
I used the function below to allocat buffer for picture, it is ok for 8 bits.
x264_picture_t* pic,
x264_picture_alloc(pic, X264_CSP_I420, 640, 480);
Then I will copy yuv data to y,u,v plane buffer as below,
first copy to Y plane buffer.
unsigned char *p1,*p2;
p1=YUVBuf;
p2=pic->img.plane[0];
int len = 640*2;
for(int i=0;i<480;i++)
{
memcpy(p2,p1,len);
p1+=len;
p2+=len;
}
But error will happen here.when debugging, I find the size of
p1 buffer is larger than the p2,ie. img.plane
I think when allocating buffer for image, it is not 2 bytes for a Y or U or V value, still 1 bytes.
Do I forget set some parameters for encoding?
Thank you very much! Need you nice help.
profile is high10, yuv format is 4:2:0,
Y or U, V value is kept by 2 bytes.
I used the function below to allocat buffer for picture, it is ok for 8 bits.
x264_picture_t* pic,
x264_picture_alloc(pic, X264_CSP_I420, 640, 480);
Then I will copy yuv data to y,u,v plane buffer as below,
first copy to Y plane buffer.
unsigned char *p1,*p2;
p1=YUVBuf;
p2=pic->img.plane[0];
int len = 640*2;
for(int i=0;i<480;i++)
{
memcpy(p2,p1,len);
p1+=len;
p2+=len;
}
But error will happen here.when debugging, I find the size of
p1 buffer is larger than the p2,ie. img.plane
I think when allocating buffer for image, it is not 2 bytes for a Y or U or V value, still 1 bytes.
Do I forget set some parameters for encoding?
Thank you very much! Need you nice help.