# HG changeset patch # User michael # Date 1125649826 0 # Node ID c4311f623fd582e2660402d8da3ee2130d333bb0 # Parent 78ad77267785da851c66f476d8ebbddd46c46888 lowres support diff -r 78ad77267785 -r c4311f623fd5 dv.c --- a/dv.c Thu Sep 01 00:15:12 2005 +0000 +++ b/dv.c Fri Sep 02 08:30:26 2005 +0000 @@ -228,7 +228,13 @@ /* 248DCT setup */ s->fdct[1] = dsp.fdct248; s->idct_put[1] = simple_idct248_put; // FIXME: need to add it to DSP - memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); + if(avctx->lowres){ + for (i=0; i<64; i++){ + int j= ff_zigzag248_direct[i]; + s->dv_zigzag[1][i] = dsp.idct_permutation[(j&7) + (j&8)*4 + (j&48)/2]; + } + }else + memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); /* XXX: do it only for constant case */ dv_build_unquantize_tables(s, dsp.idct_permutation); @@ -377,6 +383,7 @@ DCTELEM sblock[5*6][64] __align8; uint8_t mb_bit_buffer[80 + 4] __align8; /* allow some slack */ uint8_t vs_bit_buffer[5 * 80 + 4] __align8; /* allow some slack */ + const int log2_blocksize= 3-s->avctx->lowres; assert((((int)mb_bit_buffer)&7)==0); assert((((int)vs_bit_buffer)&7)==0); @@ -482,39 +489,38 @@ v = *mb_pos_ptr++; mb_x = v & 0xff; mb_y = v >> 8; - y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 8); + y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x)<sys->pix_fmt == PIX_FMT_YUV411P) - c_offset = (mb_y * s->picture.linesize[1] * 8) + ((mb_x >> 2) * 8); + c_offset = ((mb_y * s->picture.linesize[1] + (mb_x >> 2))<> 1) * s->picture.linesize[1] * 8) + ((mb_x >> 1) * 8); + c_offset = (((mb_y >> 1) * s->picture.linesize[1] + (mb_x >> 1))<idct_put[mb->dct_mode]; + idct_put = s->idct_put[mb->dct_mode && log2_blocksize==3]; if (j < 4) { if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x < (704 / 8)) { /* NOTE: at end of line, the macroblock is handled as 420 */ - idct_put(y_ptr + (j * 8), s->picture.linesize[0], block); + idct_put(y_ptr + (j<picture.linesize[0], block); } else { - idct_put(y_ptr + ((j & 1) * 8) + ((j >> 1) * 8 * s->picture.linesize[0]), + idct_put(y_ptr + (((j & 1) + (j >> 1) * s->picture.linesize[0])<picture.linesize[0], block); } } else { if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) { uint64_t aligned_pixels[64/8]; uint8_t *pixels= (uint8_t*)aligned_pixels; - uint8_t *c_ptr, *c_ptr1, *ptr; - int y, linesize; + uint8_t *c_ptr, *c_ptr1, *ptr, *ptr1; + int x, y, linesize; /* NOTE: at end of line, the macroblock is handled as 420 */ idct_put(pixels, 8, block); linesize = s->picture.linesize[6 - j]; c_ptr = s->picture.data[6 - j] + c_offset; ptr = pixels; - for(y = 0;y < 8; y++) { - /* convert to 411P */ - c_ptr1 = c_ptr + 8*linesize; - c_ptr[0]= ptr[0]; c_ptr1[0]= ptr[4]; - c_ptr[1]= ptr[1]; c_ptr1[1]= ptr[5]; - c_ptr[2]= ptr[2]; c_ptr1[2]= ptr[6]; - c_ptr[3]= ptr[3]; c_ptr1[3]= ptr[7]; + for(y = 0;y < (1<picture.key_frame = 1; s->picture.pict_type = FF_I_TYPE; avctx->pix_fmt = s->sys->pix_fmt; - avctx->width = s->sys->width; - avctx->height = s->sys->height; + avcodec_set_dimensions(avctx, s->sys->width, s->sys->height); if(avctx->get_buffer(avctx, &s->picture) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1;