aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dv.c
diff options
context:
space:
mode:
authorRoman Shaposhnik <roman@shaposhnik.org>2008-08-11 10:14:46 +0000
committerRoman Shaposhnik <roman@shaposhnik.org>2008-08-11 10:14:46 +0000
commit3f66d16821a4a6140b4ed5b977f14008ba5f826e (patch)
tree59ec350a4be67e4fa61a1a715f6ed75fb86b445c /libavcodec/dv.c
parent5e8ecfde5022e44bfeab04bec9720baca96bc484 (diff)
downloadffmpeg-3f66d16821a4a6140b4ed5b977f14008ba5f826e.tar.gz
Fixing the units in DV50 tables (both coordinates are
supposed to be in units of 8 pixels) and simplifying the calculations of y_ptr and c_offset. Originally committed as revision 14693 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dv.c')
-rw-r--r--libavcodec/dv.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index c3240383b4..30e0b1da55 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -470,16 +470,10 @@ static inline void dv_decode_video_segment(DVVideoContext *s,
v = *mb_pos_ptr++;
mb_x = v & 0xff;
mb_y = v >> 8;
- if (s->sys->pix_fmt == PIX_FMT_YUV422P) {
- y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + (mb_x>>1))<<log2_blocksize);
- c_offset = ((mb_y * s->picture.linesize[1] + (mb_x >> 2))<<log2_blocksize);
- } else { /* 4:1:1 or 4:2:0 */
- y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x)<<log2_blocksize);
- if (s->sys->pix_fmt == PIX_FMT_YUV411P)
- c_offset = ((mb_y * s->picture.linesize[1] + (mb_x >> 2))<<log2_blocksize);
- else /* 4:2:0 */
- c_offset = (((mb_y >> 1) * s->picture.linesize[1] + (mb_x >> 1))<<log2_blocksize);
- }
+ y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x)<<log2_blocksize);
+ c_offset = (((mb_y>>(s->sys->pix_fmt == PIX_FMT_YUV420P)) * s->picture.linesize[1] +
+ (mb_x>>((s->sys->pix_fmt == PIX_FMT_YUV411P)?2:1)))<<log2_blocksize);
+
for(j = 0;j < 6; j++) {
idct_put = s->idct_put[mb->dct_mode && log2_blocksize==3];
if (s->sys->pix_fmt == PIX_FMT_YUV422P) { /* 4:2:2 */
@@ -838,16 +832,9 @@ static inline void dv_encode_video_segment(DVVideoContext *s,
v = *mb_pos_ptr++;
mb_x = v & 0xff;
mb_y = v >> 8;
- if (s->sys->pix_fmt == PIX_FMT_YUV422P) {
- y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 4);
- } else { /* 4:1:1 */
- y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 8);
- }
- if (s->sys->pix_fmt == PIX_FMT_YUV420P) {
- c_offset = (((mb_y >> 1) * s->picture.linesize[1] * 8) + ((mb_x >> 1) * 8));
- } else { /* 4:2:2 or 4:1:1 */
- c_offset = ((mb_y * s->picture.linesize[1] * 8) + ((mb_x >> 2) * 8));
- }
+ y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x)<<3);
+ c_offset = (((mb_y>>(s->sys->pix_fmt == PIX_FMT_YUV420P)) * s->picture.linesize[1] +
+ (mb_x>>((s->sys->pix_fmt == PIX_FMT_YUV411P)?2:1)))<<3);
do_edge_wrap = 0;
qnos[mb_index] = 15; /* No quantization */
ptr = dif + mb_index*80 + 4;