55 int16_t *
block,
int n,
int qscale)
58 const uint16_t *quant_matrix;
60 nCoeffs=
s->block_last_index[n];
62 block[0] *= n < 4 ?
s->y_dc_scale :
s->c_dc_scale;
64 quant_matrix =
s->intra_matrix;
65 for(
i=1;
i<=nCoeffs;
i++) {
66 int j=
s->intra_scantable.permutated[
i];
84 int16_t *
block,
int n,
int qscale)
87 const uint16_t *quant_matrix;
89 nCoeffs=
s->block_last_index[n];
91 quant_matrix =
s->inter_matrix;
92 for(
i=0;
i<=nCoeffs;
i++) {
93 int j=
s->intra_scantable.permutated[
i];
99 ((
int) (quant_matrix[j]))) >> 4;
104 ((
int) (quant_matrix[j]))) >> 4;
113 int16_t *
block,
int n,
int qscale)
116 const uint16_t *quant_matrix;
121 if(
s->alternate_scan) nCoeffs= 63;
122 else nCoeffs=
s->block_last_index[n];
124 block[0] *= n < 4 ?
s->y_dc_scale :
s->c_dc_scale;
125 quant_matrix =
s->intra_matrix;
126 for(
i=1;
i<=nCoeffs;
i++) {
127 int j=
s->intra_scantable.permutated[
i];
143 int16_t *
block,
int n,
int qscale)
146 const uint16_t *quant_matrix;
152 if(
s->alternate_scan) nCoeffs= 63;
153 else nCoeffs=
s->block_last_index[n];
155 block[0] *= n < 4 ?
s->y_dc_scale :
s->c_dc_scale;
157 quant_matrix =
s->intra_matrix;
158 for(
i=1;
i<=nCoeffs;
i++) {
159 int j=
s->intra_scantable.permutated[
i];
177 int16_t *
block,
int n,
int qscale)
180 const uint16_t *quant_matrix;
186 if(
s->alternate_scan) nCoeffs= 63;
187 else nCoeffs=
s->block_last_index[n];
189 quant_matrix =
s->inter_matrix;
190 for(
i=0;
i<=nCoeffs;
i++) {
191 int j=
s->intra_scantable.permutated[
i];
197 ((
int) (quant_matrix[j]))) >> 5;
201 ((
int) (quant_matrix[j]))) >> 5;
211 int16_t *
block,
int n,
int qscale)
221 block[0] *= n < 4 ?
s->y_dc_scale :
s->c_dc_scale;
222 qadd = (qscale - 1) | 1;
229 nCoeffs=
s->intra_scantable.raster_end[
s->block_last_index[n] ];
231 for(
i=1;
i<=nCoeffs;
i++) {
245 int16_t *
block,
int n,
int qscale)
252 qadd = (qscale - 1) | 1;
255 nCoeffs=
s->inter_scantable.raster_end[
s->block_last_index[n] ];
257 for(
i=0;
i<=nCoeffs;
i++) {
294 for (
i=0;
i<4;
i++) {
295 s->hdsp.avg_pixels_tab[0][
i] =
gray16;
296 s->hdsp.put_pixels_tab[0][
i] =
gray16;
297 s->hdsp.put_no_rnd_pixels_tab[0][
i] =
gray16;
299 s->hdsp.avg_pixels_tab[1][
i] =
gray8;
300 s->hdsp.put_pixels_tab[1][
i] =
gray8;
301 s->hdsp.put_no_rnd_pixels_tab[1][
i] =
gray8;
314 if (HAVE_INTRINSICS_NEON)
334 s->idsp.mpeg4_studio_profile =
s->studio_profile;
340 if (
s->alternate_scan) {
354 s->chroma_x_shift,
s->chroma_y_shift,
s->out_format,
355 s->mb_stride,
s->mb_width,
s->mb_height,
s->b8_stride,
356 &
s->linesize, &
s->uvlinesize);
361 int y_size =
s->b8_stride * (2 *
s->mb_height + 1);
362 int c_size =
s->mb_stride * (
s->mb_height + 1);
363 int yc_size = y_size + 2 * c_size;
366 if (
s->mb_height & 1)
367 yc_size += 2*
s->b8_stride + 2*
s->mb_stride;
374 if (
s->noise_reduction) {
381 s->block =
s->blocks[0];
383 for (
i = 0;
i < 12;
i++) {
384 s->pblocks[
i] = &
s->block[
i];
388 !(
s->dpcm_macroblock =
av_mallocz(
sizeof(*
s->dpcm_macroblock))))
390 s->dpcm_direction = 0;
392 if (
s->avctx->codec_tag ==
AV_RL32(
"VCR2")) {
394 FFSWAP(
void *,
s->pblocks[4],
s->pblocks[5]);
401 s->ac_val[0] =
s->ac_val_base +
s->b8_stride + 1;
402 s->ac_val[1] =
s->ac_val_base + y_size +
s->mb_stride + 1;
403 s->ac_val[2] =
s->ac_val[1] + c_size;
416 int nb_slices =
s->slice_context_count,
ret;
421 for (
int i = 1;
i < nb_slices;
i++) {
423 if (!
s->thread_context[
i])
427 s->thread_context[
i]->start_mb_y =
428 (
s->mb_height * (
i ) + nb_slices / 2) / nb_slices;
429 s->thread_context[
i]->end_mb_y =
430 (
s->mb_height * (
i + 1) + nb_slices / 2) / nb_slices;
433 s->end_mb_y = nb_slices > 1 ? (
s->mb_height + nb_slices / 2) / nb_slices
446 s->sc.rd_scratchpad =
448 s->sc.obmc_scratchpad =
NULL;
462 for (
int i = 1;
i <
s->slice_context_count;
i++) {
471 #define COPY(a) bak->a = src->a
472 COPY(sc.edge_emu_buffer);
475 COPY(sc.rd_scratchpad);
476 COPY(sc.b_scratchpad);
477 COPY(sc.obmc_scratchpad);
483 COPY(dpcm_macroblock);
484 COPY(dpcm_direction);
507 for (
i = 0;
i < 12;
i++) {
518 "scratch buffers.\n");
537 if (!
s->context_initialized) {
542 s->bitstream_buffer =
NULL;
543 s->bitstream_buffer_size =
s->allocated_bitstream_buffer_size = 0;
545 if (
s1->context_initialized){
557 if (
s->height !=
s1->height ||
s->width !=
s1->width ||
s->context_reinit) {
558 s->height =
s1->height;
559 s->width =
s1->width;
564 s->avctx->coded_height =
s1->avctx->coded_height;
565 s->avctx->coded_width =
s1->avctx->coded_width;
566 s->avctx->width =
s1->avctx->width;
567 s->avctx->height =
s1->avctx->height;
569 s->quarter_sample =
s1->quarter_sample;
571 s->coded_picture_number =
s1->coded_picture_number;
572 s->picture_number =
s1->picture_number;
578 if (
s1->picture &&
s1->picture[
i].f->buf[0] &&
583 #define UPDATE_PICTURE(pic)\
585 ff_mpeg_unref_picture(s->avctx, &s->pic);\
586 if (s1->pic.f && s1->pic.f->buf[0])\
587 ret = ff_mpeg_ref_picture(s->avctx, &s->pic, &s1->pic);\
589 ret = ff_update_picture_tables(&s->pic, &s1->pic);\
598 #define REBASE_PICTURE(pic, new_ctx, old_ctx) \
599 ((pic && pic >= old_ctx->picture && \
600 pic < old_ctx->picture + MAX_PICTURE_COUNT) ? \
601 &new_ctx->picture[pic - old_ctx->picture] : NULL)
608 s->next_p_frame_damaged =
s1->next_p_frame_damaged;
609 s->workaround_bugs =
s1->workaround_bugs;
610 s->padding_bug_score =
s1->padding_bug_score;
613 memcpy(&
s->last_time_base, &
s1->last_time_base,
614 (
char *) &
s1->pb_field_time +
sizeof(
s1->pb_field_time) -
615 (
char *) &
s1->last_time_base);
618 s->max_b_frames =
s1->max_b_frames;
619 s->low_delay =
s1->low_delay;
620 s->droppable =
s1->droppable;
623 s->divx_packed =
s1->divx_packed;
625 if (
s1->bitstream_buffer) {
626 if (
s1->bitstream_buffer_size +
629 &
s->allocated_bitstream_buffer_size,
630 s1->allocated_bitstream_buffer_size);
631 if (!
s->bitstream_buffer) {
632 s->bitstream_buffer_size = 0;
636 s->bitstream_buffer_size =
s1->bitstream_buffer_size;
637 memcpy(
s->bitstream_buffer,
s1->bitstream_buffer,
638 s1->bitstream_buffer_size);
639 memset(
s->bitstream_buffer +
s->bitstream_buffer_size, 0,
644 if (!
s->sc.edge_emu_buffer)
647 &
s->sc,
s1->linesize) < 0) {
649 "scratch buffers.\n");
654 "be allocated due to unknown size.\n");
658 memcpy(&
s->progressive_sequence, &
s1->progressive_sequence,
659 (
char *) &
s1->rtp_mode - (
char *) &
s1->progressive_sequence);
672 s->y_dc_scale_table =
675 s->progressive_frame = 1;
676 s->progressive_sequence = 1;
679 s->coded_picture_number = 0;
680 s->picture_number = 0;
685 s->slice_context_count = 1;
712 int y_size, c_size, yc_size,
i, mb_array_size, mv_table_size, x, y;
714 s->mb_width = (
s->width + 15) / 16;
715 s->mb_stride =
s->mb_width + 1;
716 s->b8_stride =
s->mb_width * 2 + 1;
717 mb_array_size =
s->mb_height *
s->mb_stride;
718 mv_table_size = (
s->mb_height + 2) *
s->mb_stride + 1;
722 s->h_edge_pos =
s->mb_width * 16;
723 s->v_edge_pos =
s->mb_height * 16;
725 s->mb_num =
s->mb_width *
s->mb_height;
730 s->block_wrap[3] =
s->b8_stride;
732 s->block_wrap[5] =
s->mb_stride;
734 y_size =
s->b8_stride * (2 *
s->mb_height + 1);
735 c_size =
s->mb_stride * (
s->mb_height + 1);
736 yc_size = y_size + 2 * c_size;
738 if (
s->mb_height & 1)
739 yc_size += 2*
s->b8_stride + 2*
s->mb_stride;
743 for (y = 0; y <
s->mb_height; y++)
744 for (x = 0; x <
s->mb_width; x++)
745 s->mb_index2xy[x + y *
s->mb_width] = x + y *
s->mb_stride;
747 s->mb_index2xy[
s->mb_height *
s->mb_width] = (
s->mb_height - 1) *
s->mb_stride +
s->mb_width;
758 s->p_mv_table =
s->p_mv_table_base +
s->mb_stride + 1;
759 s->b_forw_mv_table =
s->b_forw_mv_table_base +
s->mb_stride + 1;
760 s->b_back_mv_table =
s->b_back_mv_table_base +
s->mb_stride + 1;
761 s->b_bidir_forw_mv_table =
s->b_bidir_forw_mv_table_base +
s->mb_stride + 1;
762 s->b_bidir_back_mv_table =
s->b_bidir_back_mv_table_base +
s->mb_stride + 1;
763 s->b_direct_mv_table =
s->b_direct_mv_table_base +
s->mb_stride + 1;
772 #define ALLOCZ_ARRAYS(p, mult, numb) ((p) = av_calloc(numb, mult * sizeof(*(p))))
777 if (!(tmp1 =
ALLOCZ_ARRAYS(
s->b_field_mv_table_base, 8, mv_table_size)) ||
778 !(tmp2 =
ALLOCZ_ARRAYS(
s->b_field_select_table[0][0], 2 * 4, mv_table_size)) ||
782 s->p_field_select_table[1] =
s->p_field_select_table[0] + 2 * mv_table_size;
783 tmp1 +=
s->mb_stride + 1;
785 for (
int i = 0;
i < 2;
i++) {
786 for (
int j = 0; j < 2; j++) {
787 for (
int k = 0; k < 2; k++) {
788 s->b_field_mv_table[
i][j][k] = tmp1;
789 tmp1 += mv_table_size;
791 s->b_field_select_table[
i][j] = tmp2;
792 tmp2 += 2 * mv_table_size;
804 tmp +=
s->mb_stride + 1;
805 for (
int i = 0;
i < 2;
i++) {
806 for (
int j = 0; j < 2; j++) {
807 s->p_field_mv_table[
i][j] =
tmp;
808 tmp += mv_table_size;
819 s->coded_block =
s->coded_block_base +
s->b8_stride + 1;
822 if (
s->h263_pred ||
s->h263_plus || !
s->encoding) {
827 s->dc_val[0] =
s->dc_val_base +
s->b8_stride + 1;
828 s->dc_val[1] =
s->dc_val_base + y_size +
s->mb_stride + 1;
829 s->dc_val[2] =
s->dc_val[1] + c_size;
830 for (
i = 0;
i < yc_size;
i++)
831 s->dc_val_base[
i] = 1024;
839 memset(
s->mbintra_table, 1, mb_array_size);
848 memset(&
s->next_picture, 0,
sizeof(
s->next_picture));
849 memset(&
s->last_picture, 0,
sizeof(
s->last_picture));
850 memset(&
s->current_picture, 0,
sizeof(
s->current_picture));
851 memset(&
s->new_picture, 0,
sizeof(
s->new_picture));
853 memset(
s->thread_context, 0,
sizeof(
s->thread_context));
856 s->me.score_map =
NULL;
857 s->dct_error_sum =
NULL;
861 memset(
s->pblocks, 0,
sizeof(
s->pblocks));
862 s->dpcm_direction = 0;
863 s->dpcm_macroblock =
NULL;
864 s->ac_val_base =
NULL;
868 s->sc.edge_emu_buffer =
NULL;
869 s->me.scratchpad =
NULL;
871 s->sc.rd_scratchpad =
873 s->sc.obmc_scratchpad =
NULL;
876 s->bitstream_buffer =
NULL;
877 s->allocated_bitstream_buffer_size = 0;
880 s->p_mv_table_base =
NULL;
881 s->b_forw_mv_table_base =
NULL;
882 s->b_back_mv_table_base =
NULL;
883 s->b_bidir_forw_mv_table_base =
NULL;
884 s->b_bidir_back_mv_table_base =
NULL;
885 s->b_direct_mv_table_base =
NULL;
886 s->p_mv_table =
NULL;
887 s->b_forw_mv_table =
NULL;
888 s->b_back_mv_table =
NULL;
889 s->b_bidir_forw_mv_table =
NULL;
890 s->b_bidir_back_mv_table =
NULL;
891 s->b_direct_mv_table =
NULL;
892 s->b_field_mv_table_base =
NULL;
893 s->p_field_mv_table_base =
NULL;
894 for (
i = 0;
i < 2;
i++) {
895 for (j = 0; j < 2; j++) {
896 for (k = 0; k < 2; k++) {
897 s->b_field_mv_table[
i][j][k] =
NULL;
899 s->b_field_select_table[
i][j] =
NULL;
900 s->p_field_mv_table[
i][j] =
NULL;
902 s->p_field_select_table[
i] =
NULL;
905 s->dc_val_base =
NULL;
906 s->coded_block_base =
NULL;
907 s->mbintra_table =
NULL;
909 s->pred_dir_table =
NULL;
911 s->mbskip_table =
NULL;
913 s->er.error_status_table =
NULL;
914 s->er.er_temp_buffer =
NULL;
915 s->mb_index2xy =
NULL;
916 s->lambda_table =
NULL;
929 int nb_slices = (HAVE_THREADS &&
931 s->avctx->thread_count : 1;
935 if (
s->encoding &&
s->avctx->slices)
936 nb_slices =
s->avctx->slices;
939 s->mb_height = (
s->height + 31) / 32 * 2;
941 s->mb_height = (
s->height + 15) / 16;
945 "decoding to AV_PIX_FMT_NONE is not supported.\n");
949 if (nb_slices >
MAX_THREADS || (nb_slices >
s->mb_height &&
s->mb_height)) {
956 " reducing to %d\n", nb_slices, max_slices);
957 nb_slices = max_slices;
960 if ((
s->width ||
s->height) &&
977 if (!
s->picture[
i].f)
990 #if FF_API_FLAG_TRUNCATED
991 s->parse_context.state = -1;
994 s->context_initialized = 1;
995 memset(
s->thread_context, 0,
sizeof(
s->thread_context));
996 s->thread_context[0] =
s;
997 s->slice_context_count = nb_slices;
1029 av_freep(&
s->b_bidir_forw_mv_table_base);
1030 av_freep(&
s->b_bidir_back_mv_table_base);
1032 s->p_mv_table =
NULL;
1033 s->b_forw_mv_table =
NULL;
1034 s->b_back_mv_table =
NULL;
1035 s->b_bidir_forw_mv_table =
NULL;
1036 s->b_bidir_back_mv_table =
NULL;
1037 s->b_direct_mv_table =
NULL;
1039 av_freep(&
s->b_field_select_table[0][0]);
1042 for (
i = 0;
i < 2;
i++) {
1043 for (j = 0; j < 2; j++) {
1044 for (k = 0; k < 2; k++) {
1045 s->b_field_mv_table[
i][j][k] =
NULL;
1047 s->b_field_select_table[
i][j] =
NULL;
1048 s->p_field_mv_table[
i][j] =
NULL;
1050 s->p_field_select_table[
i] =
NULL;
1069 s->linesize =
s->uvlinesize = 0;
1076 if (!
s->context_initialized)
1083 s->picture[
i].needs_realloc = 1;
1086 s->last_picture_ptr =
1087 s->next_picture_ptr =
1088 s->current_picture_ptr =
NULL;
1092 s->mb_height = (
s->height + 31) / 32 * 2;
1094 s->mb_height = (
s->height + 15) / 16;
1096 if ((
s->width ||
s->height) &&
1103 &
s->chroma_y_shift);
1110 memset(
s->thread_context, 0,
sizeof(
s->thread_context));
1111 s->thread_context[0] =
s;
1113 if (
s->width &&
s->height) {
1118 s->context_reinit = 0;
1123 s->context_reinit = 1;
1136 if (
s->slice_context_count > 1)
1137 s->slice_context_count = 1;
1139 #if FF_API_FLAG_TRUNCATED
1141 s->parse_context.buffer_size = 0;
1145 s->allocated_bitstream_buffer_size = 0;
1171 s->context_initialized = 0;
1172 s->context_reinit = 0;
1173 s->last_picture_ptr =
1174 s->next_picture_ptr =
1175 s->current_picture_ptr =
NULL;
1176 s->linesize =
s->uvlinesize = 0;
1182 int i, h_chroma_shift, v_chroma_shift;
1213 s->last_picture_ptr !=
s->next_picture_ptr &&
1214 s->last_picture_ptr->f->buf[0]) {
1221 if (&
s->picture[
i] !=
s->last_picture_ptr &&
1222 &
s->picture[
i] !=
s->next_picture_ptr &&
1223 s->picture[
i].reference && !
s->picture[
i].needs_realloc) {
1234 if (!
s->picture[
i].reference)
1238 if (
s->current_picture_ptr && !
s->current_picture_ptr->f->buf[0]) {
1241 pic =
s->current_picture_ptr;
1248 pic = &
s->picture[
i];
1252 if (!
s->droppable) {
1262 s->current_picture_ptr = pic;
1264 s->current_picture_ptr->f->top_field_first =
s->top_field_first;
1268 s->current_picture_ptr->f->top_field_first =
1271 s->current_picture_ptr->f->interlaced_frame = !
s->progressive_frame &&
1272 !
s->progressive_sequence;
1273 s->current_picture_ptr->field_picture =
s->picture_structure !=
PICT_FRAME;
1275 s->current_picture_ptr->f->pict_type =
s->pict_type;
1281 s->current_picture_ptr)) < 0)
1285 s->last_picture_ptr =
s->next_picture_ptr;
1287 s->next_picture_ptr =
s->current_picture_ptr;
1289 ff_dlog(
s->avctx,
"L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
1290 s->last_picture_ptr,
s->next_picture_ptr,
s->current_picture_ptr,
1291 s->last_picture_ptr ?
s->last_picture_ptr->f->data[0] :
NULL,
1292 s->next_picture_ptr ?
s->next_picture_ptr->f->data[0] :
NULL,
1293 s->current_picture_ptr ?
s->current_picture_ptr->f->data[0] :
NULL,
1294 s->pict_type,
s->droppable);
1296 if ((!
s->last_picture_ptr || !
s->last_picture_ptr->f->buf[0]) &&
1298 int h_chroma_shift, v_chroma_shift;
1300 &h_chroma_shift, &v_chroma_shift);
1301 if (
s->pict_type ==
AV_PICTURE_TYPE_B &&
s->next_picture_ptr &&
s->next_picture_ptr->f->buf[0])
1303 "allocating dummy last picture for B frame\n");
1306 "warning: first frame is no keyframe\n");
1314 s->last_picture_ptr = &
s->picture[
i];
1316 s->last_picture_ptr->reference = 3;
1317 s->last_picture_ptr->f->key_frame = 0;
1321 s->last_picture_ptr =
NULL;
1327 memset(
s->last_picture_ptr->f->data[0] +
s->last_picture_ptr->f->linesize[0]*
i,
1328 0x80, avctx->
width);
1329 if (
s->last_picture_ptr->f->data[2]) {
1331 memset(
s->last_picture_ptr->f->data[1] +
s->last_picture_ptr->f->linesize[1]*
i,
1333 memset(
s->last_picture_ptr->f->data[2] +
s->last_picture_ptr->f->linesize[2]*
i,
1340 memset(
s->last_picture_ptr->f->data[0] +
s->last_picture_ptr->f->linesize[0]*
i, 16, avctx->
width);
1347 if ((!
s->next_picture_ptr || !
s->next_picture_ptr->f->buf[0]) &&
1355 s->next_picture_ptr = &
s->picture[
i];
1357 s->next_picture_ptr->reference = 3;
1358 s->next_picture_ptr->f->key_frame = 0;
1362 s->next_picture_ptr =
NULL;
1369 #if 0 // BUFREF-FIXME
1370 memset(
s->last_picture.f->data, 0,
sizeof(
s->last_picture.f->data));
1371 memset(
s->next_picture.f->data, 0,
sizeof(
s->next_picture.f->data));
1373 if (
s->last_picture_ptr) {
1374 if (
s->last_picture_ptr->f->buf[0] &&
1376 s->last_picture_ptr)) < 0)
1379 if (
s->next_picture_ptr) {
1380 if (
s->next_picture_ptr->f->buf[0] &&
1382 s->next_picture_ptr)) < 0)
1387 s->last_picture_ptr->f->buf[0]));
1391 for (
i = 0;
i < 4;
i++) {
1393 s->current_picture.f->data[
i] +=
1394 s->current_picture.f->linesize[
i];
1396 s->current_picture.f->linesize[
i] *= 2;
1397 s->last_picture.f->linesize[
i] *= 2;
1398 s->next_picture.f->linesize[
i] *= 2;
1406 s->dct_unquantize_intra =
s->dct_unquantize_mpeg2_intra;
1407 s->dct_unquantize_inter =
s->dct_unquantize_mpeg2_inter;
1409 s->dct_unquantize_intra =
s->dct_unquantize_h263_intra;
1410 s->dct_unquantize_inter =
s->dct_unquantize_h263_inter;
1412 s->dct_unquantize_intra =
s->dct_unquantize_mpeg1_intra;
1413 s->dct_unquantize_inter =
s->dct_unquantize_mpeg1_inter;
1428 if (
s->current_picture.reference)
1436 s->mb_width,
s->mb_height,
s->mb_stride,
s->quarter_sample);
1471 uint8_t *dest, uint8_t *
src,
1472 int field_based,
int field_select,
1473 int src_x,
int src_y,
1475 int h_edge_pos,
int v_edge_pos,
1477 int motion_x,
int motion_y)
1479 const int lowres =
s->avctx->lowres;
1481 const int s_mask = (2 <<
lowres) - 1;
1485 if (
s->quarter_sample) {
1490 sx = motion_x & s_mask;
1491 sy = motion_y & s_mask;
1492 src_x += motion_x >>
lowres + 1;
1493 src_y += motion_y >>
lowres + 1;
1497 if ((
unsigned)src_x >
FFMAX( h_edge_pos - (!!sx) -
w, 0) ||
1498 (unsigned)src_y >
FFMAX((v_edge_pos >> field_based) - (!!sy) -
h, 0)) {
1499 s->vdsp.emulated_edge_mc(
s->sc.edge_emu_buffer,
src,
1500 s->linesize,
s->linesize,
1501 w + 1, (
h + 1) << field_based,
1502 src_x, src_y << field_based,
1503 h_edge_pos, v_edge_pos);
1504 src =
s->sc.edge_emu_buffer;
1508 sx = (sx << 2) >>
lowres;
1509 sy = (sy << 2) >>
lowres;
1512 pix_op[op_index](dest,
src,
stride,
h, sx, sy);
1524 uint8_t **ref_picture,
1526 int motion_x,
int motion_y,
1529 uint8_t *ptr_y, *ptr_cb, *ptr_cr;
1530 int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, sx, sy, uvsx, uvsy;
1532 const int lowres =
s->avctx->lowres;
1533 const int op_index =
FFMIN(
lowres-1+
s->chroma_x_shift, 3);
1534 const int block_s = 8>>
lowres;
1535 const int s_mask = (2 <<
lowres) - 1;
1536 const int h_edge_pos =
s->h_edge_pos >>
lowres;
1537 const int v_edge_pos =
s->v_edge_pos >>
lowres;
1538 linesize =
s->current_picture.f->linesize[0] << field_based;
1539 uvlinesize =
s->current_picture.f->linesize[1] << field_based;
1542 if (
s->quarter_sample) {
1548 motion_y += (bottom_field - field_select)*((1 <<
lowres)-1);
1551 sx = motion_x & s_mask;
1552 sy = motion_y & s_mask;
1553 src_x =
s->mb_x * 2 * block_s + (motion_x >>
lowres + 1);
1554 src_y = (mb_y * 2 * block_s >> field_based) + (motion_y >>
lowres + 1);
1557 uvsx = ((motion_x >> 1) & s_mask) | (sx & 1);
1558 uvsy = ((motion_y >> 1) & s_mask) | (sy & 1);
1559 uvsrc_x = src_x >> 1;
1560 uvsrc_y = src_y >> 1;
1565 uvsx = (2 * mx) & s_mask;
1566 uvsy = (2 * my) & s_mask;
1567 uvsrc_x =
s->mb_x * block_s + (mx >>
lowres);
1568 uvsrc_y = mb_y * block_s + (my >>
lowres);
1570 if(
s->chroma_y_shift){
1575 uvsrc_x =
s->mb_x * block_s + (mx >>
lowres + 1);
1576 uvsrc_y = (mb_y * block_s >> field_based) + (my >>
lowres + 1);
1578 if(
s->chroma_x_shift){
1582 uvsy = motion_y & s_mask;
1584 uvsrc_x =
s->mb_x*block_s + (mx >> (
lowres+1));
1587 uvsx = motion_x & s_mask;
1588 uvsy = motion_y & s_mask;
1595 ptr_y = ref_picture[0] + src_y *
linesize + src_x;
1596 ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
1597 ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
1599 if ((
unsigned) src_x >
FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 ||
1600 (
unsigned) src_y >
FFMAX((v_edge_pos >> field_based) - (!!sy) -
h, 0)) {
1601 s->vdsp.emulated_edge_mc(
s->sc.edge_emu_buffer, ptr_y,
1603 17, 17 + field_based,
1604 src_x, src_y << field_based, h_edge_pos,
1606 ptr_y =
s->sc.edge_emu_buffer;
1608 uint8_t *ubuf =
s->sc.edge_emu_buffer + 18 *
s->linesize;
1609 uint8_t *vbuf =ubuf + 10 *
s->uvlinesize;
1611 vbuf -=
s->uvlinesize;
1612 s->vdsp.emulated_edge_mc(ubuf, ptr_cb,
1613 uvlinesize >> field_based, uvlinesize >> field_based,
1615 uvsrc_x, uvsrc_y << field_based,
1616 h_edge_pos >> 1, v_edge_pos >> 1);
1617 s->vdsp.emulated_edge_mc(vbuf, ptr_cr,
1618 uvlinesize >> field_based,uvlinesize >> field_based,
1620 uvsrc_x, uvsrc_y << field_based,
1621 h_edge_pos >> 1, v_edge_pos >> 1);
1629 dest_y +=
s->linesize;
1630 dest_cb +=
s->uvlinesize;
1631 dest_cr +=
s->uvlinesize;
1635 ptr_y +=
s->linesize;
1636 ptr_cb +=
s->uvlinesize;
1637 ptr_cr +=
s->uvlinesize;
1640 sx = (sx << 2) >>
lowres;
1641 sy = (sy << 2) >>
lowres;
1645 int hc =
s->chroma_y_shift ? (
h+1-bottom_field)>>1 :
h;
1646 uvsx = (uvsx << 2) >>
lowres;
1647 uvsy = (uvsy << 2) >>
lowres;
1649 pix_op[op_index](dest_cb, ptr_cb, uvlinesize, hc, uvsx, uvsy);
1650 pix_op[op_index](dest_cr, ptr_cr, uvlinesize, hc, uvsx, uvsy);
1657 uint8_t *dest_cb, uint8_t *dest_cr,
1658 uint8_t **ref_picture,
1662 const int lowres =
s->avctx->lowres;
1664 const int block_s = 8 >>
lowres;
1665 const int s_mask = (2 <<
lowres) - 1;
1666 const int h_edge_pos =
s->h_edge_pos >>
lowres + 1;
1667 const int v_edge_pos =
s->v_edge_pos >>
lowres + 1;
1668 int emu = 0, src_x, src_y, sx, sy;
1672 if (
s->quarter_sample) {
1684 src_x =
s->mb_x * block_s + (mx >>
lowres + 1);
1685 src_y =
s->mb_y * block_s + (my >>
lowres + 1);
1687 offset = src_y *
s->uvlinesize + src_x;
1688 ptr = ref_picture[1] +
offset;
1689 if ((
unsigned) src_x >
FFMAX(h_edge_pos - (!!sx) - block_s, 0) ||
1690 (unsigned) src_y >
FFMAX(v_edge_pos - (!!sy) - block_s, 0)) {
1691 s->vdsp.emulated_edge_mc(
s->sc.edge_emu_buffer, ptr,
1692 s->uvlinesize,
s->uvlinesize,
1694 src_x, src_y, h_edge_pos, v_edge_pos);
1695 ptr =
s->sc.edge_emu_buffer;
1698 sx = (sx << 2) >>
lowres;
1699 sy = (sy << 2) >>
lowres;
1700 pix_op[op_index](dest_cb, ptr,
s->uvlinesize, block_s, sx, sy);
1702 ptr = ref_picture[2] +
offset;
1704 s->vdsp.emulated_edge_mc(
s->sc.edge_emu_buffer, ptr,
1705 s->uvlinesize,
s->uvlinesize,
1707 src_x, src_y, h_edge_pos, v_edge_pos);
1708 ptr =
s->sc.edge_emu_buffer;
1710 pix_op[op_index](dest_cr, ptr,
s->uvlinesize, block_s, sx, sy);
1725 uint8_t *dest_y, uint8_t *dest_cb,
1727 int dir, uint8_t **ref_picture,
1732 const int lowres =
s->avctx->lowres;
1733 const int block_s = 8 >>
lowres;
1738 switch (
s->mv_type) {
1742 ref_picture, pix_op,
1743 s->mv[dir][0][0],
s->mv[dir][0][1],
1749 for (
i = 0;
i < 4;
i++) {
1751 s->linesize) * block_s,
1752 ref_picture[0], 0, 0,
1753 (2 * mb_x + (
i & 1)) * block_s,
1754 (2 * mb_y + (
i >> 1)) * block_s,
1755 s->width,
s->height,
s->linesize,
1757 block_s, block_s, pix_op,
1758 s->mv[dir][
i][0],
s->mv[dir][
i][1]);
1760 mx +=
s->mv[dir][
i][0];
1761 my +=
s->mv[dir][
i][1];
1772 1, 0,
s->field_select[dir][0],
1773 ref_picture, pix_op,
1774 s->mv[dir][0][0],
s->mv[dir][0][1],
1778 1, 1,
s->field_select[dir][1],
1779 ref_picture, pix_op,
1780 s->mv[dir][1][0],
s->mv[dir][1][1],
1783 if (
s->picture_structure !=
s->field_select[dir][0] + 1 &&
1785 ref_picture =
s->current_picture_ptr->f->data;
1789 0, 0,
s->field_select[dir][0],
1790 ref_picture, pix_op,
1792 s->mv[dir][0][1], 2 * block_s, mb_y >> 1);
1796 for (
i = 0;
i < 2;
i++) {
1797 uint8_t **ref2picture;
1799 if (
s->picture_structure ==
s->field_select[dir][
i] + 1 ||
1801 ref2picture = ref_picture;
1803 ref2picture =
s->current_picture_ptr->f->data;
1807 0, 0,
s->field_select[dir][
i],
1808 ref2picture, pix_op,
1809 s->mv[dir][
i][0],
s->mv[dir][
i][1] +
1810 2 * block_s *
i, block_s, mb_y >> 1);
1812 dest_y += 2 * block_s *
s->linesize;
1813 dest_cb += (2 * block_s >>
s->chroma_y_shift) *
s->uvlinesize;
1814 dest_cr += (2 * block_s >>
s->chroma_y_shift) *
s->uvlinesize;
1819 for (
i = 0;
i < 2;
i++) {
1821 for (j = 0; j < 2; j++) {
1824 ref_picture, pix_op,
1825 s->mv[dir][2 *
i + j][0],
1826 s->mv[dir][2 *
i + j][1],
1829 pix_op =
s->h264chroma.avg_h264_chroma_pixels_tab;
1832 for (
i = 0;
i < 2;
i++) {
1834 0, 0,
s->picture_structure !=
i + 1,
1835 ref_picture, pix_op,
1836 s->mv[dir][2 *
i][0],
s->mv[dir][2 *
i][1],
1837 2 * block_s, mb_y >> 1);
1840 pix_op =
s->h264chroma.avg_h264_chroma_pixels_tab;
1844 if (!
s->first_field) {
1845 ref_picture =
s->current_picture_ptr->f->data;
1860 int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !
s->quarter_sample;
1861 int my, off,
i, mvs;
1866 switch (
s->mv_type) {
1880 for (
i = 0;
i < mvs;
i++) {
1881 my =
s->mv[dir][
i][1];
1882 my_max =
FFMAX(my_max, my);
1883 my_min =
FFMIN(my_min, my);
1886 off = ((
FFMAX(-my_min, my_max)<<qpel_shift) + 63) >> 6;
1888 return av_clip(
s->mb_y + off, 0,
s->mb_height - 1);
1890 return s->mb_height-1;
1895 int16_t *
block,
int i, uint8_t *dest,
int line_size,
int qscale)
1897 s->dct_unquantize_intra(
s,
block,
i, qscale);
1898 s->idsp.idct_put(dest, line_size,
block);
1903 int16_t *
block,
int i, uint8_t *dest,
int line_size)
1905 if (
s->block_last_index[
i] >= 0) {
1906 s->idsp.idct_add(dest, line_size,
block);
1911 int16_t *
block,
int i, uint8_t *dest,
int line_size,
int qscale)
1913 if (
s->block_last_index[
i] >= 0) {
1914 s->dct_unquantize_inter(
s,
block,
i, qscale);
1916 s->idsp.idct_add(dest, line_size,
block);
1925 int wrap =
s->b8_stride;
1926 int xy =
s->block_index[0];
1929 s->dc_val[0][xy + 1 ] =
1930 s->dc_val[0][xy +
wrap] =
1931 s->dc_val[0][xy + 1 +
wrap] = 1024;
1933 memset(
s->ac_val[0][xy ], 0, 32 *
sizeof(int16_t));
1934 memset(
s->ac_val[0][xy +
wrap], 0, 32 *
sizeof(int16_t));
1935 if (
s->msmpeg4_version>=3) {
1936 s->coded_block[xy ] =
1937 s->coded_block[xy + 1 ] =
1938 s->coded_block[xy +
wrap] =
1939 s->coded_block[xy + 1 +
wrap] = 0;
1942 wrap =
s->mb_stride;
1943 xy =
s->mb_x +
s->mb_y *
wrap;
1945 s->dc_val[2][xy] = 1024;
1947 memset(
s->ac_val[1][xy], 0, 16 *
sizeof(int16_t));
1948 memset(
s->ac_val[2][xy], 0, 16 *
sizeof(int16_t));
1950 s->mbintra_table[xy]= 0;
1965 int lowres_flag,
int is_mpeg12)
1967 const int mb_xy =
s->mb_y *
s->mb_stride +
s->mb_x;
1970 s->avctx->hwaccel &&
s->avctx->hwaccel->decode_mb) {
1971 s->avctx->hwaccel->decode_mb(
s);
1980 for(j=0; j<64; j++){
1982 block[
i][
s->idsp.idct_permutation[j]]);
1988 s->current_picture.qscale_table[mb_xy] =
s->qscale;
1992 if (!is_mpeg12 && (
s->h263_pred ||
s->h263_aic)) {
1993 if(
s->mbintra_table[mb_xy])
1998 s->last_dc[2] = 128 <<
s->intra_dc_precision;
2001 else if (!is_mpeg12 && (
s->h263_pred ||
s->h263_aic))
2002 s->mbintra_table[mb_xy]=1;
2007 uint8_t *dest_y, *dest_cb, *dest_cr;
2008 int dct_linesize, dct_offset;
2011 const int linesize =
s->current_picture.f->linesize[0];
2012 const int uvlinesize =
s->current_picture.f->linesize[1];
2013 const int readable=
s->pict_type !=
AV_PICTURE_TYPE_B ||
s->encoding ||
s->avctx->draw_horiz_band || lowres_flag;
2014 const int block_size= lowres_flag ? 8>>
s->avctx->lowres : 8;
2019 uint8_t *mbskip_ptr = &
s->mbskip_table[mb_xy];
2021 if (
s->mb_skipped) {
2025 }
else if(!
s->current_picture.reference) {
2032 dct_linesize =
linesize <<
s->interlaced_dct;
2037 dest_cb=
s->dest[1];
2038 dest_cr=
s->dest[2];
2040 dest_y =
s->sc.b_scratchpad;
2041 dest_cb=
s->sc.b_scratchpad+16*
linesize;
2042 dest_cr=
s->sc.b_scratchpad+32*
linesize;
2068 op_pix =
s->h264chroma.avg_h264_chroma_pixels_tab;
2074 op_qpix =
s->me.qpel_put;
2076 op_pix =
s->hdsp.put_pixels_tab;
2078 op_pix =
s->hdsp.put_no_rnd_pixels_tab;
2081 ff_mpv_motion(
s, dest_y, dest_cb, dest_cr, 0,
s->last_picture.f->data, op_pix, op_qpix);
2082 op_pix =
s->hdsp.avg_pixels_tab;
2083 op_qpix=
s->me.qpel_avg;
2086 ff_mpv_motion(
s, dest_y, dest_cb, dest_cr, 1,
s->next_picture.f->data, op_pix, op_qpix);
2092 if(
s->avctx->skip_idct){
2108 if (
s->chroma_y_shift){
2123 add_dct(
s,
block[2], 2, dest_y + dct_offset , dct_linesize);
2124 add_dct(
s,
block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
2127 if(
s->chroma_y_shift){
2132 dct_linesize = uvlinesize <<
s->interlaced_dct;
2133 dct_offset =
s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
2139 if(!
s->chroma_x_shift){
2142 add_dct(
s,
block[10], 10, dest_cb+block_size+dct_offset, dct_linesize);
2143 add_dct(
s,
block[11], 11, dest_cr+block_size+dct_offset, dct_linesize);
2148 else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) {
2154 if (
s->avctx->bits_per_raw_sample > 8){
2155 const int act_block_size = block_size * 2;
2157 if(
s->dpcm_direction == 0) {
2158 s->idsp.idct_put(dest_y, dct_linesize, (int16_t*)(*
s->block32)[0]);
2159 s->idsp.idct_put(dest_y + act_block_size, dct_linesize, (int16_t*)(*
s->block32)[1]);
2160 s->idsp.idct_put(dest_y + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[2]);
2161 s->idsp.idct_put(dest_y + dct_offset + act_block_size, dct_linesize, (int16_t*)(*
s->block32)[3]);
2163 dct_linesize = uvlinesize <<
s->interlaced_dct;
2164 dct_offset =
s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
2166 s->idsp.idct_put(dest_cb, dct_linesize, (int16_t*)(*
s->block32)[4]);
2167 s->idsp.idct_put(dest_cr, dct_linesize, (int16_t*)(*
s->block32)[5]);
2168 s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[6]);
2169 s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[7]);
2170 if(!
s->chroma_x_shift){
2171 s->idsp.idct_put(dest_cb + act_block_size, dct_linesize, (int16_t*)(*
s->block32)[8]);
2172 s->idsp.idct_put(dest_cr + act_block_size, dct_linesize, (int16_t*)(*
s->block32)[9]);
2173 s->idsp.idct_put(dest_cb + act_block_size + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[10]);
2174 s->idsp.idct_put(dest_cr + act_block_size + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[11]);
2176 }
else if(
s->dpcm_direction == 1) {
2178 uint16_t *dest_pcm[3] = {(uint16_t*)dest_y, (uint16_t*)dest_cb, (uint16_t*)dest_cr};
2179 int linesize[3] = {dct_linesize, uvlinesize, uvlinesize};
2180 for(
i = 0;
i < 3;
i++) {
2182 int vsub =
i ?
s->chroma_y_shift : 0;
2183 int hsub =
i ?
s->chroma_x_shift : 0;
2184 for(
h = 0;
h < (16 >> vsub);
h++){
2185 for(
w = 0;
w < (16 >>
hsub);
w++)
2186 dest_pcm[
i][
w] = (*
s->dpcm_macroblock)[
i][idx++];
2190 }
else if(
s->dpcm_direction == -1) {
2192 uint16_t *dest_pcm[3] = {(uint16_t*)dest_y, (uint16_t*)dest_cb, (uint16_t*)dest_cr};
2193 int linesize[3] = {dct_linesize, uvlinesize, uvlinesize};
2194 for(
i = 0;
i < 3;
i++) {
2196 int vsub =
i ?
s->chroma_y_shift : 0;
2197 int hsub =
i ?
s->chroma_x_shift : 0;
2198 dest_pcm[
i] += (
linesize[
i] / 2) * ((16 >> vsub) - 1);
2199 for(
h = (16 >> vsub)-1;
h >= 1;
h--){
2200 for(
w = (16 >>
hsub)-1;
w >= 1;
w--)
2201 dest_pcm[
i][
w] = (*
s->dpcm_macroblock)[
i][idx++];
2210 put_dct(
s,
block[1], 1, dest_y + block_size, dct_linesize,
s->qscale);
2211 put_dct(
s,
block[2], 2, dest_y + dct_offset , dct_linesize,
s->qscale);
2212 put_dct(
s,
block[3], 3, dest_y + dct_offset + block_size, dct_linesize,
s->qscale);
2215 if(
s->chroma_y_shift){
2221 put_dct(
s,
block[4], 4, dest_cb, dct_linesize,
s->chroma_qscale);
2222 put_dct(
s,
block[5], 5, dest_cr, dct_linesize,
s->chroma_qscale);
2223 put_dct(
s,
block[6], 6, dest_cb + dct_offset, dct_linesize,
s->chroma_qscale);
2224 put_dct(
s,
block[7], 7, dest_cr + dct_offset, dct_linesize,
s->chroma_qscale);
2228 s->idsp.idct_put(dest_y, dct_linesize,
block[0]);
2229 s->idsp.idct_put(dest_y + block_size, dct_linesize,
block[1]);
2230 s->idsp.idct_put(dest_y + dct_offset, dct_linesize,
block[2]);
2231 s->idsp.idct_put(dest_y + dct_offset + block_size, dct_linesize,
block[3]);
2234 if(
s->chroma_y_shift){
2235 s->idsp.idct_put(dest_cb, uvlinesize,
block[4]);
2236 s->idsp.idct_put(dest_cr, uvlinesize,
block[5]);
2239 dct_linesize = uvlinesize <<
s->interlaced_dct;
2240 dct_offset =
s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
2242 s->idsp.idct_put(dest_cb, dct_linesize,
block[4]);
2243 s->idsp.idct_put(dest_cr, dct_linesize,
block[5]);
2244 s->idsp.idct_put(dest_cb + dct_offset, dct_linesize,
block[6]);
2245 s->idsp.idct_put(dest_cr + dct_offset, dct_linesize,
block[7]);
2246 if(!
s->chroma_x_shift){
2247 s->idsp.idct_put(dest_cb + block_size, dct_linesize,
block[8]);
2248 s->idsp.idct_put(dest_cr + block_size, dct_linesize,
block[9]);
2249 s->idsp.idct_put(dest_cb + block_size + dct_offset, dct_linesize,
block[10]);
2250 s->idsp.idct_put(dest_cr + block_size + dct_offset, dct_linesize,
block[11]);
2258 s->hdsp.put_pixels_tab[0][0](
s->dest[0], dest_y ,
linesize,16);
2260 s->hdsp.put_pixels_tab[
s->chroma_x_shift][0](
s->dest[1], dest_cb, uvlinesize,16 >>
s->chroma_y_shift);
2261 s->hdsp.put_pixels_tab[
s->chroma_x_shift][0](
s->dest[2], dest_cr, uvlinesize,16 >>
s->chroma_y_shift);
2282 s->last_picture_ptr ?
s->last_picture_ptr->f :
NULL, y,
h,
s->picture_structure,
2283 s->first_field,
s->low_delay);
2287 const int linesize =
s->current_picture.f->linesize[0];
2288 const int uvlinesize =
s->current_picture.f->linesize[1];
2289 const int width_of_mb = (4 + (
s->avctx->bits_per_raw_sample > 8)) -
s->avctx->lowres;
2290 const int height_of_mb = 4 -
s->avctx->lowres;
2292 s->block_index[0]=
s->b8_stride*(
s->mb_y*2 ) - 2 +
s->mb_x*2;
2293 s->block_index[1]=
s->b8_stride*(
s->mb_y*2 ) - 1 +
s->mb_x*2;
2294 s->block_index[2]=
s->b8_stride*(
s->mb_y*2 + 1) - 2 +
s->mb_x*2;
2295 s->block_index[3]=
s->b8_stride*(
s->mb_y*2 + 1) - 1 +
s->mb_x*2;
2296 s->block_index[4]=
s->mb_stride*(
s->mb_y + 1) +
s->b8_stride*
s->mb_height*2 +
s->mb_x - 1;
2297 s->block_index[5]=
s->mb_stride*(
s->mb_y +
s->mb_height + 2) +
s->b8_stride*
s->mb_height*2 +
s->mb_x - 1;
2300 s->dest[0] =
s->current_picture.f->data[0] + (
int)((
s->mb_x - 1
U) << width_of_mb);
2301 s->dest[1] =
s->current_picture.f->data[1] + (
int)((
s->mb_x - 1
U) << (width_of_mb -
s->chroma_x_shift));
2302 s->dest[2] =
s->current_picture.f->data[2] + (
int)((
s->mb_x - 1
U) << (width_of_mb -
s->chroma_x_shift));
2307 s->dest[0] +=
s->mb_y *
linesize << height_of_mb;
2308 s->dest[1] +=
s->mb_y * uvlinesize << (height_of_mb -
s->chroma_y_shift);
2309 s->dest[2] +=
s->mb_y * uvlinesize << (height_of_mb -
s->chroma_y_shift);
2311 s->dest[0] += (
s->mb_y>>1) *
linesize << height_of_mb;
2312 s->dest[1] += (
s->mb_y>>1) * uvlinesize << (height_of_mb -
s->chroma_y_shift);
2313 s->dest[2] += (
s->mb_y>>1) * uvlinesize << (height_of_mb -
s->chroma_y_shift);
2323 if (!
s || !
s->picture)
2328 s->current_picture_ptr =
s->last_picture_ptr =
s->next_picture_ptr =
NULL;
2334 s->mb_x=
s->mb_y= 0;
2336 #if FF_API_FLAG_TRUNCATED
2337 s->parse_context.state= -1;
2338 s->parse_context.frame_start_found= 0;
2339 s->parse_context.overread= 0;
2340 s->parse_context.overread_index= 0;
2341 s->parse_context.index= 0;
2342 s->parse_context.last_index= 0;
2344 s->bitstream_buffer_size=0;
2355 else if (qscale > 31)
2359 s->chroma_qscale=
s->chroma_qscale_table[qscale];
2361 s->y_dc_scale=
s->y_dc_scale_table[ qscale ];
2362 s->c_dc_scale=
s->c_dc_scale_table[
s->chroma_qscale ];