胡斌

fix the last pixel of each line out of range when rotating 180

... ... @@ -463,7 +463,7 @@ int CAVTranscoder::open_output_file(const char *filename)
}
}
else if (pSrcFrame->pkt_dts == 180) {
unsigned char * startSrcY = pSrcFrame->data[0] + pSrcFrame->width + (pSrcFrame->height- 1 ) * pSrcFrame->linesize[0];
unsigned char * startSrcY = pSrcFrame->data[0] + pSrcFrame->width + (pSrcFrame->height- 1 ) * pSrcFrame->linesize[0] - 1;
for (int i = 0; i < pSrcFrame->height; i++) {
unsigned char * psrc = startSrcY - i * pSrcFrame->linesize[0];
unsigned char * pdst = pDstFrame->data[0] + (y + i)*pDstFrame->linesize[0] + x;
... ... @@ -472,8 +472,8 @@ int CAVTranscoder::open_output_file(const char *filename)
*pdst = *psrc;
}
}
unsigned char * startSrcU = pSrcFrame->data[1] + pSrcFrame->width/2 + (pSrcFrame->height/2 -1) * pSrcFrame->linesize[1];
unsigned char * startSrcV = pSrcFrame->data[2] + pSrcFrame->width/2 + (pSrcFrame->height/2 -1) * pSrcFrame->linesize[2];
unsigned char * startSrcU = pSrcFrame->data[1] + pSrcFrame->width/2 + (pSrcFrame->height/2 -1) * pSrcFrame->linesize[1] - 1;
unsigned char * startSrcV = pSrcFrame->data[2] + pSrcFrame->width/2 + (pSrcFrame->height/2 -1) * pSrcFrame->linesize[2] - 1;
for (int i = 0; i < pSrcFrame->height / 2; i++){
unsigned char * psrc = startSrcU - i * pSrcFrame->linesize[1];
unsigned char * pdst = pDstFrame->data[1] + (y/2 + i)*pDstFrame->linesize[1] + x/2;
... ... @@ -530,7 +530,7 @@ int CAVTranscoder::open_output_file(const char *filename)
}
}
else if (pSrcFrame->pkt_dts == 180) {
unsigned char * startSrcY = pSrcFrame->data[0] + pSrcFrame->width + (pSrcFrame->height - srcy - 1) * pSrcFrame->linesize[0] - srcx;
unsigned char * startSrcY = pSrcFrame->data[0] + pSrcFrame->width + (pSrcFrame->height - srcy - 1) * pSrcFrame->linesize[0] - srcx - 1;
for (int i = 0; i < h; i++) {
unsigned char * psrc = startSrcY - i * pSrcFrame->linesize[0];
unsigned char * pdst = pDstFrame->data[0] + (y + i)*pDstFrame->linesize[0] + x;
... ... @@ -539,8 +539,8 @@ int CAVTranscoder::open_output_file(const char *filename)
*pdst = *psrc;
}
}
unsigned char * startSrcU = pSrcFrame->data[1] + pSrcFrame->width / 2 + ((pSrcFrame->height - srcy -1)/ 2) * pSrcFrame->linesize[1] - srcx / 2;
unsigned char * startSrcV = pSrcFrame->data[2] + pSrcFrame->width / 2 + ((pSrcFrame->height - srcy -1)/ 2) * pSrcFrame->linesize[2] - srcx / 2;
unsigned char * startSrcU = pSrcFrame->data[1] + pSrcFrame->width / 2 + ((pSrcFrame->height - srcy -1)/ 2) * pSrcFrame->linesize[1] - srcx / 2 - 1;
unsigned char * startSrcV = pSrcFrame->data[2] + pSrcFrame->width / 2 + ((pSrcFrame->height - srcy -1)/ 2) * pSrcFrame->linesize[2] - srcx / 2 - 1;
for (int i = 0; i < h / 2; i++){
unsigned char * psrc = startSrcU - i * pSrcFrame->linesize[1];
unsigned char * pdst = pDstFrame->data[1] + (y / 2 + i)*pDstFrame->linesize[1] + x / 2;
... ...