Ticket #5259: yuyv_yuv420p_interlaced.patch
File yuyv_yuv420p_interlaced.patch, 2.7 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/NuppelVideoRecorder.cpp
1559 1559 1560 1560 uint8_t *src = buffers[frame]; 1561 1561 1562 // Round height to multiple of two. 1563 unsigned height = (h / 2) * 2; 1562 // Interlaced chroma subsampling: samples reside between 1563 // scan lines and are linearly interpolated using the 1564 // nearest lines from the same field. 1564 1565 1565 // Treat lines in batches of two, first use color information, then don't 1566 // Round height to multiple of four. 1567 unsigned height = (h / 4) * 4; 1568 1566 1569 unsigned line_size = w * 2; 1567 1570 1568 for (unsigned line = 0; line < height; line += 2) 1571 // Treat lines in batches of four 1572 for (unsigned line = 0; line < height; line += 4) 1569 1573 { 1570 1574 uint8_t *src_endline = src + line_size; 1575 uint8_t *src2 = src + line_size * 2; 1571 1576 1572 // convert first line, use color information1577 // luma from line 1 and chroma from lines 1 and 3 1573 1578 while (src < src_endline) 1574 1579 { 1575 1580 *y_plane++ = *src++; 1576 *cb_plane++ = *src++; 1581 src2++; 1582 *cb_plane++ = (*src++ * 3 + *src2++) / 4; 1577 1583 *y_plane++ = *src++; 1578 *cr_plane++ = *src++; 1584 src2++; 1585 *cr_plane++ = (*src++ * 3 + *src2++) / 4; 1579 1586 } 1580 1587 1581 1588 src_endline = src + line_size; 1582 1589 1583 // convert second line, don't use color information1590 // luma from line 2 and chroma from lines 2 and 4 1584 1591 while (src < src_endline) 1585 1592 { 1586 1593 *y_plane++ = *src++; 1594 src2++; 1595 *cb_plane++ = (*src++ + *src2++ * 3) / 4; 1596 *y_plane++ = *src++; 1597 src2++; 1598 *cr_plane++ = (*src++ + *src2++ * 3) / 4; 1599 } 1600 1601 src_endline = src + line_size * 2; 1602 1603 // luma from line 3 and from line 4 1604 while (src < src_endline) 1605 { 1606 *y_plane++ = *src++; 1587 1607 src++; 1588 1608 *y_plane++ = *src++; 1589 1609 src++;