fix the last pixel of each line out of range when rotating 180
正在显示
1 个修改的文件
包含
6 行增加
和
6 行删除
| @@ -463,7 +463,7 @@ int CAVTranscoder::open_output_file(const char *filename) | @@ -463,7 +463,7 @@ int CAVTranscoder::open_output_file(const char *filename) | ||
| 463 | } | 463 | } |
| 464 | } | 464 | } |
| 465 | else if (pSrcFrame->pkt_dts == 180) { | 465 | else if (pSrcFrame->pkt_dts == 180) { |
| 466 | - unsigned char * startSrcY = pSrcFrame->data[0] + pSrcFrame->width + (pSrcFrame->height- 1 ) * pSrcFrame->linesize[0]; | 466 | + unsigned char * startSrcY = pSrcFrame->data[0] + pSrcFrame->width + (pSrcFrame->height- 1 ) * pSrcFrame->linesize[0] - 1; |
| 467 | for (int i = 0; i < pSrcFrame->height; i++) { | 467 | for (int i = 0; i < pSrcFrame->height; i++) { |
| 468 | unsigned char * psrc = startSrcY - i * pSrcFrame->linesize[0]; | 468 | unsigned char * psrc = startSrcY - i * pSrcFrame->linesize[0]; |
| 469 | unsigned char * pdst = pDstFrame->data[0] + (y + i)*pDstFrame->linesize[0] + x; | 469 | unsigned char * pdst = pDstFrame->data[0] + (y + i)*pDstFrame->linesize[0] + x; |
| @@ -472,8 +472,8 @@ int CAVTranscoder::open_output_file(const char *filename) | @@ -472,8 +472,8 @@ int CAVTranscoder::open_output_file(const char *filename) | ||
| 472 | *pdst = *psrc; | 472 | *pdst = *psrc; |
| 473 | } | 473 | } |
| 474 | } | 474 | } |
| 475 | - unsigned char * startSrcU = pSrcFrame->data[1] + pSrcFrame->width/2 + (pSrcFrame->height/2 -1) * pSrcFrame->linesize[1]; | ||
| 476 | - unsigned char * startSrcV = pSrcFrame->data[2] + pSrcFrame->width/2 + (pSrcFrame->height/2 -1) * pSrcFrame->linesize[2]; | 475 | + unsigned char * startSrcU = pSrcFrame->data[1] + pSrcFrame->width/2 + (pSrcFrame->height/2 -1) * pSrcFrame->linesize[1] - 1; |
| 476 | + unsigned char * startSrcV = pSrcFrame->data[2] + pSrcFrame->width/2 + (pSrcFrame->height/2 -1) * pSrcFrame->linesize[2] - 1; | ||
| 477 | for (int i = 0; i < pSrcFrame->height / 2; i++){ | 477 | for (int i = 0; i < pSrcFrame->height / 2; i++){ |
| 478 | unsigned char * psrc = startSrcU - i * pSrcFrame->linesize[1]; | 478 | unsigned char * psrc = startSrcU - i * pSrcFrame->linesize[1]; |
| 479 | unsigned char * pdst = pDstFrame->data[1] + (y/2 + i)*pDstFrame->linesize[1] + x/2; | 479 | 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) | @@ -530,7 +530,7 @@ int CAVTranscoder::open_output_file(const char *filename) | ||
| 530 | } | 530 | } |
| 531 | } | 531 | } |
| 532 | else if (pSrcFrame->pkt_dts == 180) { | 532 | else if (pSrcFrame->pkt_dts == 180) { |
| 533 | - unsigned char * startSrcY = pSrcFrame->data[0] + pSrcFrame->width + (pSrcFrame->height - srcy - 1) * pSrcFrame->linesize[0] - srcx; | 533 | + unsigned char * startSrcY = pSrcFrame->data[0] + pSrcFrame->width + (pSrcFrame->height - srcy - 1) * pSrcFrame->linesize[0] - srcx - 1; |
| 534 | for (int i = 0; i < h; i++) { | 534 | for (int i = 0; i < h; i++) { |
| 535 | unsigned char * psrc = startSrcY - i * pSrcFrame->linesize[0]; | 535 | unsigned char * psrc = startSrcY - i * pSrcFrame->linesize[0]; |
| 536 | unsigned char * pdst = pDstFrame->data[0] + (y + i)*pDstFrame->linesize[0] + x; | 536 | unsigned char * pdst = pDstFrame->data[0] + (y + i)*pDstFrame->linesize[0] + x; |
| @@ -539,8 +539,8 @@ int CAVTranscoder::open_output_file(const char *filename) | @@ -539,8 +539,8 @@ int CAVTranscoder::open_output_file(const char *filename) | ||
| 539 | *pdst = *psrc; | 539 | *pdst = *psrc; |
| 540 | } | 540 | } |
| 541 | } | 541 | } |
| 542 | - unsigned char * startSrcU = pSrcFrame->data[1] + pSrcFrame->width / 2 + ((pSrcFrame->height - srcy -1)/ 2) * pSrcFrame->linesize[1] - srcx / 2; | ||
| 543 | - unsigned char * startSrcV = pSrcFrame->data[2] + pSrcFrame->width / 2 + ((pSrcFrame->height - srcy -1)/ 2) * pSrcFrame->linesize[2] - srcx / 2; | 542 | + unsigned char * startSrcU = pSrcFrame->data[1] + pSrcFrame->width / 2 + ((pSrcFrame->height - srcy -1)/ 2) * pSrcFrame->linesize[1] - srcx / 2 - 1; |
| 543 | + unsigned char * startSrcV = pSrcFrame->data[2] + pSrcFrame->width / 2 + ((pSrcFrame->height - srcy -1)/ 2) * pSrcFrame->linesize[2] - srcx / 2 - 1; | ||
| 544 | for (int i = 0; i < h / 2; i++){ | 544 | for (int i = 0; i < h / 2; i++){ |
| 545 | unsigned char * psrc = startSrcU - i * pSrcFrame->linesize[1]; | 545 | unsigned char * psrc = startSrcU - i * pSrcFrame->linesize[1]; |
| 546 | unsigned char * pdst = pDstFrame->data[1] + (y / 2 + i)*pDstFrame->linesize[1] + x / 2; | 546 | unsigned char * pdst = pDstFrame->data[1] + (y / 2 + i)*pDstFrame->linesize[1] + x / 2; |
-
请 注册 或 登录 后发表评论