54 int16_t *
block,
int n,
int qscale)
57 const uint16_t *quant_matrix;
59 nCoeffs=
s->block_last_index[
n];
61 block[0] *=
n < 4 ?
s->y_dc_scale :
s->c_dc_scale;
63 quant_matrix =
s->intra_matrix;
64 for(
i=1;
i<=nCoeffs;
i++) {
65 int j=
s->intra_scantable.permutated[
i];
83 int16_t *
block,
int n,
int qscale)
86 const uint16_t *quant_matrix;
88 nCoeffs=
s->block_last_index[
n];
90 quant_matrix =
s->inter_matrix;
91 for(
i=0;
i<=nCoeffs;
i++) {
92 int j=
s->intra_scantable.permutated[
i];
98 ((
int) (quant_matrix[j]))) >> 4;
103 ((
int) (quant_matrix[j]))) >> 4;
112 int16_t *
block,
int n,
int qscale)
115 const uint16_t *quant_matrix;
120 if(
s->alternate_scan) nCoeffs= 63;
121 else nCoeffs=
s->block_last_index[
n];
123 block[0] *=
n < 4 ?
s->y_dc_scale :
s->c_dc_scale;
124 quant_matrix =
s->intra_matrix;
125 for(
i=1;
i<=nCoeffs;
i++) {
126 int j=
s->intra_scantable.permutated[
i];
142 int16_t *
block,
int n,
int qscale)
145 const uint16_t *quant_matrix;
151 if(
s->alternate_scan) nCoeffs= 63;
152 else nCoeffs=
s->block_last_index[
n];
154 block[0] *=
n < 4 ?
s->y_dc_scale :
s->c_dc_scale;
156 quant_matrix =
s->intra_matrix;
157 for(
i=1;
i<=nCoeffs;
i++) {
158 int j=
s->intra_scantable.permutated[
i];
176 int16_t *
block,
int n,
int qscale)
179 const uint16_t *quant_matrix;
185 if(
s->alternate_scan) nCoeffs= 63;
186 else nCoeffs=
s->block_last_index[
n];
188 quant_matrix =
s->inter_matrix;
189 for(
i=0;
i<=nCoeffs;
i++) {
190 int j=
s->intra_scantable.permutated[
i];
196 ((
int) (quant_matrix[j]))) >> 5;
200 ((
int) (quant_matrix[j]))) >> 5;
210 int16_t *
block,
int n,
int qscale)
220 block[0] *=
n < 4 ?
s->y_dc_scale :
s->c_dc_scale;
221 qadd = (qscale - 1) | 1;
228 nCoeffs=
s->intra_scantable.raster_end[
s->block_last_index[
n] ];
230 for(
i=1;
i<=nCoeffs;
i++) {
244 int16_t *
block,
int n,
int qscale)
251 qadd = (qscale - 1) | 1;
254 nCoeffs=
s->inter_scantable.raster_end[
s->block_last_index[
n] ];
256 for(
i=0;
i<=nCoeffs;
i++) {
293 for (
i=0;
i<4;
i++) {
294 s->hdsp.avg_pixels_tab[0][
i] =
gray16;
295 s->hdsp.put_pixels_tab[0][
i] =
gray16;
296 s->hdsp.put_no_rnd_pixels_tab[0][
i] =
gray16;
298 s->hdsp.avg_pixels_tab[1][
i] =
gray8;
299 s->hdsp.put_pixels_tab[1][
i] =
gray8;
300 s->hdsp.put_no_rnd_pixels_tab[1][
i] =
gray8;
313 if (HAVE_INTRINSICS_NEON)
333 s->idsp.mpeg4_studio_profile =
s->studio_profile;
339 if (
s->alternate_scan) {
353 s->chroma_x_shift,
s->chroma_y_shift,
s->out_format,
354 s->mb_stride,
s->mb_width,
s->mb_height,
s->b8_stride,
355 &
s->linesize, &
s->uvlinesize);
360 int y_size =
s->b8_stride * (2 *
s->mb_height + 1);
361 int c_size =
s->mb_stride * (
s->mb_height + 1);
362 int yc_size = y_size + 2 * c_size;
365 if (
s->mb_height & 1)
366 yc_size += 2*
s->b8_stride + 2*
s->mb_stride;
368 s->sc.edge_emu_buffer =
371 s->sc.rd_scratchpad =
373 s->sc.obmc_scratchpad =
NULL;
380 if (
s->noise_reduction) {
382 2 * 64 *
sizeof(
int),
fail)
386 s->block =
s->blocks[0];
388 for (
i = 0;
i < 12;
i++) {
389 s->pblocks[
i] = &
s->block[
i];
393 s->dpcm_direction = 0;
396 if (
s->avctx->codec_tag ==
AV_RL32(
"VCR2")) {
398 FFSWAP(
void *,
s->pblocks[4],
s->pblocks[5]);
404 yc_size *
sizeof(int16_t) * 16,
fail);
405 s->ac_val[0] =
s->ac_val_base +
s->b8_stride + 1;
406 s->ac_val[1] =
s->ac_val_base + y_size +
s->mb_stride + 1;
407 s->ac_val[2] =
s->ac_val[1] + c_size;
423 s->sc.rd_scratchpad =
425 s->sc.obmc_scratchpad =
NULL;
439 #define COPY(a) bak->a = src->a
440 COPY(sc.edge_emu_buffer);
443 COPY(sc.rd_scratchpad);
444 COPY(sc.b_scratchpad);
445 COPY(sc.obmc_scratchpad);
451 COPY(dpcm_macroblock);
452 COPY(dpcm_direction);
476 for (
i = 0;
i < 12;
i++) {
487 "scratch buffers.\n");
508 if (!
s->context_initialized) {
513 s->bitstream_buffer =
NULL;
514 s->bitstream_buffer_size =
s->allocated_bitstream_buffer_size = 0;
516 if (
s1->context_initialized){
528 if (
s->height !=
s1->height ||
s->width !=
s1->width ||
s->context_reinit) {
529 s->context_reinit = 0;
530 s->height =
s1->height;
531 s->width =
s1->width;
536 s->avctx->coded_height =
s1->avctx->coded_height;
537 s->avctx->coded_width =
s1->avctx->coded_width;
538 s->avctx->width =
s1->avctx->width;
539 s->avctx->height =
s1->avctx->height;
541 s->quarter_sample =
s1->quarter_sample;
543 s->coded_picture_number =
s1->coded_picture_number;
544 s->picture_number =
s1->picture_number;
550 if (
s1->picture &&
s1->picture[
i].f->buf[0] &&
555 #define UPDATE_PICTURE(pic)\
557 ff_mpeg_unref_picture(s->avctx, &s->pic);\
558 if (s1->pic.f && s1->pic.f->buf[0])\
559 ret = ff_mpeg_ref_picture(s->avctx, &s->pic, &s1->pic);\
561 ret = ff_update_picture_tables(&s->pic, &s1->pic);\
570 #define REBASE_PICTURE(pic, new_ctx, old_ctx) \
571 ((pic && pic >= old_ctx->picture && \
572 pic < old_ctx->picture + MAX_PICTURE_COUNT) ? \
573 &new_ctx->picture[pic - old_ctx->picture] : NULL)
580 s->next_p_frame_damaged =
s1->next_p_frame_damaged;
581 s->workaround_bugs =
s1->workaround_bugs;
582 s->padding_bug_score =
s1->padding_bug_score;
585 memcpy(&
s->last_time_base, &
s1->last_time_base,
586 (
char *) &
s1->pb_field_time +
sizeof(
s1->pb_field_time) -
587 (
char *) &
s1->last_time_base);
590 s->max_b_frames =
s1->max_b_frames;
591 s->low_delay =
s1->low_delay;
592 s->droppable =
s1->droppable;
595 s->divx_packed =
s1->divx_packed;
597 if (
s1->bitstream_buffer) {
598 if (
s1->bitstream_buffer_size +
601 &
s->allocated_bitstream_buffer_size,
602 s1->allocated_bitstream_buffer_size);
603 if (!
s->bitstream_buffer) {
604 s->bitstream_buffer_size = 0;
608 s->bitstream_buffer_size =
s1->bitstream_buffer_size;
609 memcpy(
s->bitstream_buffer,
s1->bitstream_buffer,
610 s1->bitstream_buffer_size);
611 memset(
s->bitstream_buffer +
s->bitstream_buffer_size, 0,
616 if (!
s->sc.edge_emu_buffer)
619 &
s->sc,
s1->linesize) < 0) {
621 "scratch buffers.\n");
626 "be allocated due to unknown size.\n");
630 memcpy(&
s->progressive_sequence, &
s1->progressive_sequence,
631 (
char *) &
s1->rtp_mode - (
char *) &
s1->progressive_sequence);
633 if (!
s1->first_field) {
634 s->last_pict_type =
s1->pict_type;
635 if (
s1->current_picture_ptr)
636 s->last_lambda_for[
s1->pict_type] =
s1->current_picture_ptr->f->quality;
650 s->y_dc_scale_table =
653 s->progressive_frame = 1;
654 s->progressive_sequence = 1;
657 s->coded_picture_number = 0;
658 s->picture_number = 0;
663 s->slice_context_count = 1;
693 int y_size, c_size, yc_size,
i, mb_array_size, mv_table_size, x, y;
695 s->mb_width = (
s->width + 15) / 16;
696 s->mb_stride =
s->mb_width + 1;
697 s->b8_stride =
s->mb_width * 2 + 1;
698 mb_array_size =
s->mb_height *
s->mb_stride;
699 mv_table_size = (
s->mb_height + 2) *
s->mb_stride + 1;
703 s->h_edge_pos =
s->mb_width * 16;
704 s->v_edge_pos =
s->mb_height * 16;
706 s->mb_num =
s->mb_width *
s->mb_height;
711 s->block_wrap[3] =
s->b8_stride;
713 s->block_wrap[5] =
s->mb_stride;
715 y_size =
s->b8_stride * (2 *
s->mb_height + 1);
716 c_size =
s->mb_stride * (
s->mb_height + 1);
717 yc_size = y_size + 2 * c_size;
719 if (
s->mb_height & 1)
720 yc_size += 2*
s->b8_stride + 2*
s->mb_stride;
724 for (y = 0; y <
s->mb_height; y++)
725 for (x = 0; x <
s->mb_width; x++)
726 s->mb_index2xy[x + y *
s->mb_width] = x + y *
s->mb_stride;
728 s->mb_index2xy[
s->mb_height *
s->mb_width] = (
s->mb_height - 1) *
s->mb_stride +
s->mb_width;
738 s->p_mv_table =
s->p_mv_table_base +
s->mb_stride + 1;
739 s->b_forw_mv_table =
s->b_forw_mv_table_base +
s->mb_stride + 1;
740 s->b_back_mv_table =
s->b_back_mv_table_base +
s->mb_stride + 1;
741 s->b_bidir_forw_mv_table =
s->b_bidir_forw_mv_table_base +
s->mb_stride + 1;
742 s->b_bidir_back_mv_table =
s->b_bidir_back_mv_table_base +
s->mb_stride + 1;
743 s->b_direct_mv_table =
s->b_direct_mv_table_base +
s->mb_stride + 1;
751 mb_array_size *
sizeof(
float),
fail);
753 mb_array_size *
sizeof(
float),
fail);
760 for (
i = 0;
i < 2;
i++) {
762 for (j = 0; j < 2; j++) {
763 for (k = 0; k < 2; k++) {
765 s->b_field_mv_table_base[
i][j][k],
766 mv_table_size * 2 *
sizeof(int16_t),
768 s->b_field_mv_table[
i][j][k] =
s->b_field_mv_table_base[
i][j][k] +
773 s->p_field_mv_table[
i][j] =
s->p_field_mv_table_base[
i][j] +
s->mb_stride + 1;
781 s->coded_block =
s->coded_block_base +
s->b8_stride + 1;
788 if (
s->h263_pred ||
s->h263_plus || !
s->encoding) {
792 s->dc_val[0] =
s->dc_val_base +
s->b8_stride + 1;
793 s->dc_val[1] =
s->dc_val_base + y_size +
s->mb_stride + 1;
794 s->dc_val[2] =
s->dc_val[1] + c_size;
795 for (
i = 0;
i < yc_size;
i++)
796 s->dc_val_base[
i] = 1024;
801 memset(
s->mbintra_table, 1, mb_array_size);
816 memset(&
s->next_picture, 0,
sizeof(
s->next_picture));
817 memset(&
s->last_picture, 0,
sizeof(
s->last_picture));
818 memset(&
s->current_picture, 0,
sizeof(
s->current_picture));
819 memset(&
s->new_picture, 0,
sizeof(
s->new_picture));
821 memset(
s->thread_context, 0,
sizeof(
s->thread_context));
824 s->me.score_map =
NULL;
825 s->dct_error_sum =
NULL;
829 memset(
s->pblocks, 0,
sizeof(
s->pblocks));
830 s->dpcm_direction = 0;
831 s->dpcm_macroblock =
NULL;
832 s->ac_val_base =
NULL;
836 s->sc.edge_emu_buffer =
NULL;
837 s->me.scratchpad =
NULL;
839 s->sc.rd_scratchpad =
841 s->sc.obmc_scratchpad =
NULL;
844 s->bitstream_buffer =
NULL;
845 s->allocated_bitstream_buffer_size = 0;
848 s->p_mv_table_base =
NULL;
849 s->b_forw_mv_table_base =
NULL;
850 s->b_back_mv_table_base =
NULL;
851 s->b_bidir_forw_mv_table_base =
NULL;
852 s->b_bidir_back_mv_table_base =
NULL;
853 s->b_direct_mv_table_base =
NULL;
854 s->p_mv_table =
NULL;
855 s->b_forw_mv_table =
NULL;
856 s->b_back_mv_table =
NULL;
857 s->b_bidir_forw_mv_table =
NULL;
858 s->b_bidir_back_mv_table =
NULL;
859 s->b_direct_mv_table =
NULL;
860 for (
i = 0;
i < 2;
i++) {
861 for (j = 0; j < 2; j++) {
862 for (k = 0; k < 2; k++) {
863 s->b_field_mv_table_base[
i][j][k] =
NULL;
864 s->b_field_mv_table[
i][j][k] =
NULL;
866 s->b_field_select_table[
i][j] =
NULL;
867 s->p_field_mv_table_base[
i][j] =
NULL;
868 s->p_field_mv_table[
i][j] =
NULL;
870 s->p_field_select_table[
i] =
NULL;
873 s->dc_val_base =
NULL;
874 s->coded_block_base =
NULL;
875 s->mbintra_table =
NULL;
877 s->pred_dir_table =
NULL;
879 s->mbskip_table =
NULL;
881 s->er.error_status_table =
NULL;
882 s->er.er_temp_buffer =
NULL;
883 s->mb_index2xy =
NULL;
884 s->lambda_table =
NULL;
897 int nb_slices = (HAVE_THREADS &&
899 s->avctx->thread_count : 1;
903 if (
s->encoding &&
s->avctx->slices)
904 nb_slices =
s->avctx->slices;
907 s->mb_height = (
s->height + 31) / 32 * 2;
909 s->mb_height = (
s->height + 15) / 16;
913 "decoding to AV_PIX_FMT_NONE is not supported.\n");
917 if (nb_slices >
MAX_THREADS || (nb_slices >
s->mb_height &&
s->mb_height)) {
924 " reducing to %d\n", nb_slices, max_slices);
925 nb_slices = max_slices;
928 if ((
s->width ||
s->height) &&
945 if (!
s->picture[
i].f)
949 if (!
s->next_picture.f)
952 if (!
s->last_picture.f)
955 if (!
s->current_picture.f)
958 if (!
s->new_picture.f)
964 s->parse_context.state = -1;
966 s->context_initialized = 1;
967 memset(
s->thread_context, 0,
sizeof(
s->thread_context));
968 s->thread_context[0] =
s;
972 for (
i = 0;
i < nb_slices;
i++) {
975 if (!
s->thread_context[
i])
980 s->thread_context[
i]->start_mb_y =
981 (
s->mb_height * (
i) + nb_slices / 2) / nb_slices;
982 s->thread_context[
i]->end_mb_y =
983 (
s->mb_height * (
i + 1) + nb_slices / 2) / nb_slices;
989 s->end_mb_y =
s->mb_height;
991 s->slice_context_count = nb_slices;
1013 av_freep(&
s->b_bidir_forw_mv_table_base);
1014 av_freep(&
s->b_bidir_back_mv_table_base);
1016 s->p_mv_table =
NULL;
1017 s->b_forw_mv_table =
NULL;
1018 s->b_back_mv_table =
NULL;
1019 s->b_bidir_forw_mv_table =
NULL;
1020 s->b_bidir_back_mv_table =
NULL;
1021 s->b_direct_mv_table =
NULL;
1022 for (
i = 0;
i < 2;
i++) {
1023 for (j = 0; j < 2; j++) {
1024 for (k = 0; k < 2; k++) {
1025 av_freep(&
s->b_field_mv_table_base[
i][j][k]);
1026 s->b_field_mv_table[
i][j][k] =
NULL;
1030 s->p_field_mv_table[
i][j] =
NULL;
1051 s->linesize =
s->uvlinesize = 0;
1058 if (!
s->context_initialized)
1061 if (
s->slice_context_count > 1) {
1062 for (
i = 0;
i <
s->slice_context_count;
i++) {
1065 for (
i = 1;
i <
s->slice_context_count;
i++) {
1075 s->picture[
i].needs_realloc = 1;
1078 s->last_picture_ptr =
1079 s->next_picture_ptr =
1080 s->current_picture_ptr =
NULL;
1084 s->mb_height = (
s->height + 31) / 32 * 2;
1086 s->mb_height = (
s->height + 15) / 16;
1088 if ((
s->width ||
s->height) &&
1095 &
s->chroma_y_shift);
1102 memset(
s->thread_context, 0,
sizeof(
s->thread_context));
1103 s->thread_context[0] =
s;
1105 if (
s->width &&
s->height) {
1106 int nb_slices =
s->slice_context_count;
1107 if (nb_slices > 1) {
1108 for (
i = 0;
i < nb_slices;
i++) {
1111 if (!
s->thread_context[
i]) {
1118 s->thread_context[
i]->start_mb_y =
1119 (
s->mb_height * (
i) + nb_slices / 2) / nb_slices;
1120 s->thread_context[
i]->end_mb_y =
1121 (
s->mb_height * (
i + 1) + nb_slices / 2) / nb_slices;
1128 s->end_mb_y =
s->mb_height;
1130 s->slice_context_count = nb_slices;
1147 if (
s->slice_context_count > 1) {
1148 for (
i = 0;
i <
s->slice_context_count;
i++) {
1151 for (
i = 1;
i <
s->slice_context_count;
i++) {
1154 s->slice_context_count = 1;
1158 s->parse_context.buffer_size = 0;
1161 s->allocated_bitstream_buffer_size = 0;
1186 s->context_initialized = 0;
1187 s->last_picture_ptr =
1188 s->next_picture_ptr =
1189 s->current_picture_ptr =
NULL;
1190 s->linesize =
s->uvlinesize = 0;
1196 int i, h_chroma_shift, v_chroma_shift;
1227 s->last_picture_ptr !=
s->next_picture_ptr &&
1228 s->last_picture_ptr->f->buf[0]) {
1235 if (&
s->picture[
i] !=
s->last_picture_ptr &&
1236 &
s->picture[
i] !=
s->next_picture_ptr &&
1237 s->picture[
i].reference && !
s->picture[
i].needs_realloc) {
1248 if (!
s->picture[
i].reference)
1252 if (
s->current_picture_ptr && !
s->current_picture_ptr->f->buf[0]) {
1255 pic =
s->current_picture_ptr;
1262 pic = &
s->picture[
i];
1266 if (!
s->droppable) {
1276 s->current_picture_ptr = pic;
1278 s->current_picture_ptr->f->top_field_first =
s->top_field_first;
1282 s->current_picture_ptr->f->top_field_first =
1285 s->current_picture_ptr->f->interlaced_frame = !
s->progressive_frame &&
1286 !
s->progressive_sequence;
1287 s->current_picture_ptr->field_picture =
s->picture_structure !=
PICT_FRAME;
1289 s->current_picture_ptr->f->pict_type =
s->pict_type;
1295 s->current_picture_ptr)) < 0)
1299 s->last_picture_ptr =
s->next_picture_ptr;
1301 s->next_picture_ptr =
s->current_picture_ptr;
1303 ff_dlog(
s->avctx,
"L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
1304 s->last_picture_ptr,
s->next_picture_ptr,
s->current_picture_ptr,
1305 s->last_picture_ptr ?
s->last_picture_ptr->f->data[0] :
NULL,
1306 s->next_picture_ptr ?
s->next_picture_ptr->f->data[0] :
NULL,
1307 s->current_picture_ptr ?
s->current_picture_ptr->f->data[0] :
NULL,
1308 s->pict_type,
s->droppable);
1310 if ((!
s->last_picture_ptr || !
s->last_picture_ptr->f->buf[0]) &&
1312 int h_chroma_shift, v_chroma_shift;
1314 &h_chroma_shift, &v_chroma_shift);
1315 if (
s->pict_type ==
AV_PICTURE_TYPE_B &&
s->next_picture_ptr &&
s->next_picture_ptr->f->buf[0])
1317 "allocating dummy last picture for B frame\n");
1320 "warning: first frame is no keyframe\n");
1328 s->last_picture_ptr = &
s->picture[
i];
1330 s->last_picture_ptr->reference = 3;
1331 s->last_picture_ptr->f->key_frame = 0;
1335 s->last_picture_ptr =
NULL;
1341 memset(
s->last_picture_ptr->f->data[0] +
s->last_picture_ptr->f->linesize[0]*
i,
1342 0x80, avctx->
width);
1343 if (
s->last_picture_ptr->f->data[2]) {
1345 memset(
s->last_picture_ptr->f->data[1] +
s->last_picture_ptr->f->linesize[1]*
i,
1347 memset(
s->last_picture_ptr->f->data[2] +
s->last_picture_ptr->f->linesize[2]*
i,
1354 memset(
s->last_picture_ptr->f->data[0] +
s->last_picture_ptr->f->linesize[0]*
i, 16, avctx->
width);
1361 if ((!
s->next_picture_ptr || !
s->next_picture_ptr->f->buf[0]) &&
1369 s->next_picture_ptr = &
s->picture[
i];
1371 s->next_picture_ptr->reference = 3;
1372 s->next_picture_ptr->f->key_frame = 0;
1376 s->next_picture_ptr =
NULL;
1383 #if 0 // BUFREF-FIXME
1384 memset(
s->last_picture.f->data, 0,
sizeof(
s->last_picture.f->data));
1385 memset(
s->next_picture.f->data, 0,
sizeof(
s->next_picture.f->data));
1387 if (
s->last_picture_ptr) {
1388 if (
s->last_picture_ptr->f->buf[0] &&
1390 s->last_picture_ptr)) < 0)
1393 if (
s->next_picture_ptr) {
1394 if (
s->next_picture_ptr->f->buf[0] &&
1396 s->next_picture_ptr)) < 0)
1401 s->last_picture_ptr->f->buf[0]));
1405 for (
i = 0;
i < 4;
i++) {
1407 s->current_picture.f->data[
i] +=
1408 s->current_picture.f->linesize[
i];
1410 s->current_picture.f->linesize[
i] *= 2;
1411 s->last_picture.f->linesize[
i] *= 2;
1412 s->next_picture.f->linesize[
i] *= 2;
1420 s->dct_unquantize_intra =
s->dct_unquantize_mpeg2_intra;
1421 s->dct_unquantize_inter =
s->dct_unquantize_mpeg2_inter;
1423 s->dct_unquantize_intra =
s->dct_unquantize_h263_intra;
1424 s->dct_unquantize_inter =
s->dct_unquantize_h263_inter;
1426 s->dct_unquantize_intra =
s->dct_unquantize_mpeg1_intra;
1427 s->dct_unquantize_inter =
s->dct_unquantize_mpeg1_inter;
1442 if (
s->current_picture.reference)
1450 s->mb_width,
s->mb_height,
s->mb_stride,
s->quarter_sample);
1456 int offset = 2*
s->mb_stride + 1;
1467 int field_based,
int field_select,
1468 int src_x,
int src_y,
1470 int h_edge_pos,
int v_edge_pos,
1472 int motion_x,
int motion_y)
1474 const int lowres =
s->avctx->lowres;
1476 const int s_mask = (2 <<
lowres) - 1;
1480 if (
s->quarter_sample) {
1485 sx = motion_x & s_mask;
1486 sy = motion_y & s_mask;
1487 src_x += motion_x >>
lowres + 1;
1488 src_y += motion_y >>
lowres + 1;
1492 if ((
unsigned)src_x >
FFMAX( h_edge_pos - (!!sx) -
w, 0) ||
1493 (unsigned)src_y >
FFMAX((v_edge_pos >> field_based) - (!!sy) -
h, 0)) {
1494 s->vdsp.emulated_edge_mc(
s->sc.edge_emu_buffer,
src,
1495 s->linesize,
s->linesize,
1496 w + 1, (
h + 1) << field_based,
1497 src_x, src_y << field_based,
1498 h_edge_pos, v_edge_pos);
1499 src =
s->sc.edge_emu_buffer;
1503 sx = (sx << 2) >>
lowres;
1504 sy = (sy << 2) >>
lowres;
1507 pix_op[op_index](dest,
src,
stride,
h, sx, sy);
1521 int motion_x,
int motion_y,
1524 uint8_t *ptr_y, *ptr_cb, *ptr_cr;
1525 int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, sx, sy, uvsx, uvsy;
1527 const int lowres =
s->avctx->lowres;
1528 const int op_index =
FFMIN(
lowres-1+
s->chroma_x_shift, 3);
1529 const int block_s = 8>>
lowres;
1530 const int s_mask = (2 <<
lowres) - 1;
1531 const int h_edge_pos =
s->h_edge_pos >>
lowres;
1532 const int v_edge_pos =
s->v_edge_pos >>
lowres;
1533 linesize =
s->current_picture.f->linesize[0] << field_based;
1534 uvlinesize =
s->current_picture.f->linesize[1] << field_based;
1537 if (
s->quarter_sample) {
1543 motion_y += (bottom_field - field_select)*((1 <<
lowres)-1);
1546 sx = motion_x & s_mask;
1547 sy = motion_y & s_mask;
1548 src_x =
s->mb_x * 2 * block_s + (motion_x >>
lowres + 1);
1549 src_y = (mb_y * 2 * block_s >> field_based) + (motion_y >>
lowres + 1);
1552 uvsx = ((motion_x >> 1) & s_mask) | (sx & 1);
1553 uvsy = ((motion_y >> 1) & s_mask) | (sy & 1);
1554 uvsrc_x = src_x >> 1;
1555 uvsrc_y = src_y >> 1;
1560 uvsx = (2 * mx) & s_mask;
1561 uvsy = (2 * my) & s_mask;
1562 uvsrc_x =
s->mb_x * block_s + (mx >>
lowres);
1563 uvsrc_y = mb_y * block_s + (my >>
lowres);
1565 if(
s->chroma_y_shift){
1570 uvsrc_x =
s->mb_x * block_s + (mx >>
lowres + 1);
1571 uvsrc_y = (mb_y * block_s >> field_based) + (my >>
lowres + 1);
1573 if(
s->chroma_x_shift){
1577 uvsy = motion_y & s_mask;
1579 uvsrc_x =
s->mb_x*block_s + (mx >> (
lowres+1));
1582 uvsx = motion_x & s_mask;
1583 uvsy = motion_y & s_mask;
1590 ptr_y = ref_picture[0] + src_y *
linesize + src_x;
1591 ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
1592 ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
1594 if ((
unsigned) src_x >
FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 ||
1595 (
unsigned) src_y >
FFMAX((v_edge_pos >> field_based) - (!!sy) -
h, 0)) {
1596 s->vdsp.emulated_edge_mc(
s->sc.edge_emu_buffer, ptr_y,
1598 17, 17 + field_based,
1599 src_x, src_y << field_based, h_edge_pos,
1601 ptr_y =
s->sc.edge_emu_buffer;
1603 uint8_t *ubuf =
s->sc.edge_emu_buffer + 18 *
s->linesize;
1604 uint8_t *vbuf =ubuf + 10 *
s->uvlinesize;
1606 vbuf -=
s->uvlinesize;
1607 s->vdsp.emulated_edge_mc(ubuf, ptr_cb,
1608 uvlinesize >> field_based, uvlinesize >> field_based,
1610 uvsrc_x, uvsrc_y << field_based,
1611 h_edge_pos >> 1, v_edge_pos >> 1);
1612 s->vdsp.emulated_edge_mc(vbuf, ptr_cr,
1613 uvlinesize >> field_based,uvlinesize >> field_based,
1615 uvsrc_x, uvsrc_y << field_based,
1616 h_edge_pos >> 1, v_edge_pos >> 1);
1624 dest_y +=
s->linesize;
1625 dest_cb +=
s->uvlinesize;
1626 dest_cr +=
s->uvlinesize;
1630 ptr_y +=
s->linesize;
1631 ptr_cb +=
s->uvlinesize;
1632 ptr_cr +=
s->uvlinesize;
1635 sx = (sx << 2) >>
lowres;
1636 sy = (sy << 2) >>
lowres;
1640 int hc =
s->chroma_y_shift ? (
h+1-bottom_field)>>1 :
h;
1641 uvsx = (uvsx << 2) >>
lowres;
1642 uvsy = (uvsy << 2) >>
lowres;
1644 pix_op[op_index](dest_cb, ptr_cb, uvlinesize, hc, uvsx, uvsy);
1645 pix_op[op_index](dest_cr, ptr_cr, uvlinesize, hc, uvsx, uvsy);
1657 const int lowres =
s->avctx->lowres;
1659 const int block_s = 8 >>
lowres;
1660 const int s_mask = (2 <<
lowres) - 1;
1661 const int h_edge_pos =
s->h_edge_pos >>
lowres + 1;
1662 const int v_edge_pos =
s->v_edge_pos >>
lowres + 1;
1663 int emu = 0, src_x, src_y, sx, sy;
1667 if (
s->quarter_sample) {
1679 src_x =
s->mb_x * block_s + (mx >>
lowres + 1);
1680 src_y =
s->mb_y * block_s + (my >>
lowres + 1);
1682 offset = src_y *
s->uvlinesize + src_x;
1683 ptr = ref_picture[1] +
offset;
1684 if ((
unsigned) src_x >
FFMAX(h_edge_pos - (!!sx) - block_s, 0) ||
1685 (unsigned) src_y >
FFMAX(v_edge_pos - (!!sy) - block_s, 0)) {
1686 s->vdsp.emulated_edge_mc(
s->sc.edge_emu_buffer, ptr,
1687 s->uvlinesize,
s->uvlinesize,
1689 src_x, src_y, h_edge_pos, v_edge_pos);
1690 ptr =
s->sc.edge_emu_buffer;
1693 sx = (sx << 2) >>
lowres;
1694 sy = (sy << 2) >>
lowres;
1695 pix_op[op_index](dest_cb, ptr,
s->uvlinesize, block_s, sx, sy);
1697 ptr = ref_picture[2] +
offset;
1699 s->vdsp.emulated_edge_mc(
s->sc.edge_emu_buffer, ptr,
1700 s->uvlinesize,
s->uvlinesize,
1702 src_x, src_y, h_edge_pos, v_edge_pos);
1703 ptr =
s->sc.edge_emu_buffer;
1705 pix_op[op_index](dest_cr, ptr,
s->uvlinesize, block_s, sx, sy);
1722 int dir,
uint8_t **ref_picture,
1727 const int lowres =
s->avctx->lowres;
1728 const int block_s = 8 >>
lowres;
1733 switch (
s->mv_type) {
1737 ref_picture, pix_op,
1738 s->mv[dir][0][0],
s->mv[dir][0][1],
1744 for (
i = 0;
i < 4;
i++) {
1746 s->linesize) * block_s,
1747 ref_picture[0], 0, 0,
1748 (2 * mb_x + (
i & 1)) * block_s,
1749 (2 * mb_y + (
i >> 1)) * block_s,
1750 s->width,
s->height,
s->linesize,
1752 block_s, block_s, pix_op,
1753 s->mv[dir][
i][0],
s->mv[dir][
i][1]);
1755 mx +=
s->mv[dir][
i][0];
1756 my +=
s->mv[dir][
i][1];
1767 1, 0,
s->field_select[dir][0],
1768 ref_picture, pix_op,
1769 s->mv[dir][0][0],
s->mv[dir][0][1],
1773 1, 1,
s->field_select[dir][1],
1774 ref_picture, pix_op,
1775 s->mv[dir][1][0],
s->mv[dir][1][1],
1778 if (
s->picture_structure !=
s->field_select[dir][0] + 1 &&
1780 ref_picture =
s->current_picture_ptr->f->data;
1784 0, 0,
s->field_select[dir][0],
1785 ref_picture, pix_op,
1787 s->mv[dir][0][1], 2 * block_s, mb_y >> 1);
1791 for (
i = 0;
i < 2;
i++) {
1794 if (
s->picture_structure ==
s->field_select[dir][
i] + 1 ||
1796 ref2picture = ref_picture;
1798 ref2picture =
s->current_picture_ptr->f->data;
1802 0, 0,
s->field_select[dir][
i],
1803 ref2picture, pix_op,
1804 s->mv[dir][
i][0],
s->mv[dir][
i][1] +
1805 2 * block_s *
i, block_s, mb_y >> 1);
1807 dest_y += 2 * block_s *
s->linesize;
1808 dest_cb += (2 * block_s >>
s->chroma_y_shift) *
s->uvlinesize;
1809 dest_cr += (2 * block_s >>
s->chroma_y_shift) *
s->uvlinesize;
1814 for (
i = 0;
i < 2;
i++) {
1816 for (j = 0; j < 2; j++) {
1819 ref_picture, pix_op,
1820 s->mv[dir][2 *
i + j][0],
1821 s->mv[dir][2 *
i + j][1],
1824 pix_op =
s->h264chroma.avg_h264_chroma_pixels_tab;
1827 for (
i = 0;
i < 2;
i++) {
1829 0, 0,
s->picture_structure !=
i + 1,
1830 ref_picture, pix_op,
1831 s->mv[dir][2 *
i][0],
s->mv[dir][2 *
i][1],
1832 2 * block_s, mb_y >> 1);
1835 pix_op =
s->h264chroma.avg_h264_chroma_pixels_tab;
1839 if (!
s->first_field) {
1840 ref_picture =
s->current_picture_ptr->f->data;
1855 int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !
s->quarter_sample;
1856 int my, off,
i, mvs;
1861 switch (
s->mv_type) {
1875 for (
i = 0;
i < mvs;
i++) {
1876 my =
s->mv[dir][
i][1];
1877 my_max =
FFMAX(my_max, my);
1878 my_min =
FFMIN(my_min, my);
1881 off = ((
FFMAX(-my_min, my_max)<<qpel_shift) + 63) >> 6;
1883 return av_clip(
s->mb_y + off, 0,
s->mb_height - 1);
1885 return s->mb_height-1;
1890 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
1892 s->dct_unquantize_intra(
s,
block,
i, qscale);
1893 s->idsp.idct_put(dest, line_size,
block);
1900 if (
s->block_last_index[
i] >= 0) {
1901 s->idsp.idct_add(dest, line_size,
block);
1906 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
1908 if (
s->block_last_index[
i] >= 0) {
1909 s->dct_unquantize_inter(
s,
block,
i, qscale);
1911 s->idsp.idct_add(dest, line_size,
block);
1920 int wrap =
s->b8_stride;
1921 int xy =
s->block_index[0];
1924 s->dc_val[0][xy + 1 ] =
1925 s->dc_val[0][xy +
wrap] =
1926 s->dc_val[0][xy + 1 +
wrap] = 1024;
1928 memset(
s->ac_val[0][xy ], 0, 32 *
sizeof(int16_t));
1929 memset(
s->ac_val[0][xy +
wrap], 0, 32 *
sizeof(int16_t));
1930 if (
s->msmpeg4_version>=3) {
1931 s->coded_block[xy ] =
1932 s->coded_block[xy + 1 ] =
1933 s->coded_block[xy +
wrap] =
1934 s->coded_block[xy + 1 +
wrap] = 0;
1937 wrap =
s->mb_stride;
1938 xy =
s->mb_x +
s->mb_y *
wrap;
1940 s->dc_val[2][xy] = 1024;
1942 memset(
s->ac_val[1][xy], 0, 16 *
sizeof(int16_t));
1943 memset(
s->ac_val[2][xy], 0, 16 *
sizeof(int16_t));
1945 s->mbintra_table[xy]= 0;
1960 int lowres_flag,
int is_mpeg12)
1962 const int mb_xy =
s->mb_y *
s->mb_stride +
s->mb_x;
1965 s->avctx->hwaccel &&
s->avctx->hwaccel->decode_mb) {
1966 s->avctx->hwaccel->decode_mb(
s);
1975 for(j=0; j<64; j++){
1977 block[
i][
s->idsp.idct_permutation[j]]);
1983 s->current_picture.qscale_table[mb_xy] =
s->qscale;
1987 if (!is_mpeg12 && (
s->h263_pred ||
s->h263_aic)) {
1988 if(
s->mbintra_table[mb_xy])
1993 s->last_dc[2] = 128 <<
s->intra_dc_precision;
1996 else if (!is_mpeg12 && (
s->h263_pred ||
s->h263_aic))
1997 s->mbintra_table[mb_xy]=1;
2002 uint8_t *dest_y, *dest_cb, *dest_cr;
2003 int dct_linesize, dct_offset;
2006 const int linesize =
s->current_picture.f->linesize[0];
2007 const int uvlinesize =
s->current_picture.f->linesize[1];
2008 const int readable=
s->pict_type !=
AV_PICTURE_TYPE_B ||
s->encoding ||
s->avctx->draw_horiz_band || lowres_flag;
2009 const int block_size= lowres_flag ? 8>>
s->avctx->lowres : 8;
2014 uint8_t *mbskip_ptr = &
s->mbskip_table[mb_xy];
2016 if (
s->mb_skipped) {
2020 }
else if(!
s->current_picture.reference) {
2027 dct_linesize =
linesize <<
s->interlaced_dct;
2032 dest_cb=
s->dest[1];
2033 dest_cr=
s->dest[2];
2035 dest_y =
s->sc.b_scratchpad;
2036 dest_cb=
s->sc.b_scratchpad+16*
linesize;
2037 dest_cr=
s->sc.b_scratchpad+32*
linesize;
2063 op_pix =
s->h264chroma.avg_h264_chroma_pixels_tab;
2069 op_qpix =
s->me.qpel_put;
2071 op_pix =
s->hdsp.put_pixels_tab;
2073 op_pix =
s->hdsp.put_no_rnd_pixels_tab;
2076 ff_mpv_motion(
s, dest_y, dest_cb, dest_cr, 0,
s->last_picture.f->data, op_pix, op_qpix);
2077 op_pix =
s->hdsp.avg_pixels_tab;
2078 op_qpix=
s->me.qpel_avg;
2081 ff_mpv_motion(
s, dest_y, dest_cb, dest_cr, 1,
s->next_picture.f->data, op_pix, op_qpix);
2087 if(
s->avctx->skip_idct){
2103 if (
s->chroma_y_shift){
2118 add_dct(
s,
block[2], 2, dest_y + dct_offset , dct_linesize);
2119 add_dct(
s,
block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
2122 if(
s->chroma_y_shift){
2127 dct_linesize = uvlinesize <<
s->interlaced_dct;
2128 dct_offset =
s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
2134 if(!
s->chroma_x_shift){
2137 add_dct(
s,
block[10], 10, dest_cb+block_size+dct_offset, dct_linesize);
2138 add_dct(
s,
block[11], 11, dest_cr+block_size+dct_offset, dct_linesize);
2143 else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) {
2149 if (
s->avctx->bits_per_raw_sample > 8){
2150 const int act_block_size = block_size * 2;
2152 if(
s->dpcm_direction == 0) {
2153 s->idsp.idct_put(dest_y, dct_linesize, (int16_t*)(*
s->block32)[0]);
2154 s->idsp.idct_put(dest_y + act_block_size, dct_linesize, (int16_t*)(*
s->block32)[1]);
2155 s->idsp.idct_put(dest_y + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[2]);
2156 s->idsp.idct_put(dest_y + dct_offset + act_block_size, dct_linesize, (int16_t*)(*
s->block32)[3]);
2158 dct_linesize = uvlinesize <<
s->interlaced_dct;
2159 dct_offset =
s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
2161 s->idsp.idct_put(dest_cb, dct_linesize, (int16_t*)(*
s->block32)[4]);
2162 s->idsp.idct_put(dest_cr, dct_linesize, (int16_t*)(*
s->block32)[5]);
2163 s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[6]);
2164 s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[7]);
2165 if(!
s->chroma_x_shift){
2166 s->idsp.idct_put(dest_cb + act_block_size, dct_linesize, (int16_t*)(*
s->block32)[8]);
2167 s->idsp.idct_put(dest_cr + act_block_size, dct_linesize, (int16_t*)(*
s->block32)[9]);
2168 s->idsp.idct_put(dest_cb + act_block_size + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[10]);
2169 s->idsp.idct_put(dest_cr + act_block_size + dct_offset, dct_linesize, (int16_t*)(*
s->block32)[11]);
2171 }
else if(
s->dpcm_direction == 1) {
2173 uint16_t *dest_pcm[3] = {(uint16_t*)dest_y, (uint16_t*)dest_cb, (uint16_t*)dest_cr};
2174 int linesize[3] = {dct_linesize, uvlinesize, uvlinesize};
2175 for(
i = 0;
i < 3;
i++) {
2177 int vsub =
i ?
s->chroma_y_shift : 0;
2178 int hsub =
i ?
s->chroma_x_shift : 0;
2179 for(
h = 0;
h < (16 >> vsub);
h++){
2180 for(
w = 0;
w < (16 >> hsub);
w++)
2181 dest_pcm[
i][
w] = (*
s->dpcm_macroblock)[
i][idx++];
2185 }
else if(
s->dpcm_direction == -1) {
2187 uint16_t *dest_pcm[3] = {(uint16_t*)dest_y, (uint16_t*)dest_cb, (uint16_t*)dest_cr};
2188 int linesize[3] = {dct_linesize, uvlinesize, uvlinesize};
2189 for(
i = 0;
i < 3;
i++) {
2191 int vsub =
i ?
s->chroma_y_shift : 0;
2192 int hsub =
i ?
s->chroma_x_shift : 0;
2193 dest_pcm[
i] += (
linesize[
i] / 2) * ((16 >> vsub) - 1);
2194 for(
h = (16 >> vsub)-1;
h >= 1;
h--){
2195 for(
w = (16 >> hsub)-1;
w >= 1;
w--)
2196 dest_pcm[
i][
w] = (*
s->dpcm_macroblock)[
i][idx++];
2205 put_dct(
s,
block[1], 1, dest_y + block_size, dct_linesize,
s->qscale);
2206 put_dct(
s,
block[2], 2, dest_y + dct_offset , dct_linesize,
s->qscale);
2207 put_dct(
s,
block[3], 3, dest_y + dct_offset + block_size, dct_linesize,
s->qscale);
2210 if(
s->chroma_y_shift){
2216 put_dct(
s,
block[4], 4, dest_cb, dct_linesize,
s->chroma_qscale);
2217 put_dct(
s,
block[5], 5, dest_cr, dct_linesize,
s->chroma_qscale);
2218 put_dct(
s,
block[6], 6, dest_cb + dct_offset, dct_linesize,
s->chroma_qscale);
2219 put_dct(
s,
block[7], 7, dest_cr + dct_offset, dct_linesize,
s->chroma_qscale);
2223 s->idsp.idct_put(dest_y, dct_linesize,
block[0]);
2224 s->idsp.idct_put(dest_y + block_size, dct_linesize,
block[1]);
2225 s->idsp.idct_put(dest_y + dct_offset, dct_linesize,
block[2]);
2226 s->idsp.idct_put(dest_y + dct_offset + block_size, dct_linesize,
block[3]);
2229 if(
s->chroma_y_shift){
2230 s->idsp.idct_put(dest_cb, uvlinesize,
block[4]);
2231 s->idsp.idct_put(dest_cr, uvlinesize,
block[5]);
2234 dct_linesize = uvlinesize <<
s->interlaced_dct;
2235 dct_offset =
s->interlaced_dct ? uvlinesize : uvlinesize*block_size;
2237 s->idsp.idct_put(dest_cb, dct_linesize,
block[4]);
2238 s->idsp.idct_put(dest_cr, dct_linesize,
block[5]);
2239 s->idsp.idct_put(dest_cb + dct_offset, dct_linesize,
block[6]);
2240 s->idsp.idct_put(dest_cr + dct_offset, dct_linesize,
block[7]);
2241 if(!
s->chroma_x_shift){
2242 s->idsp.idct_put(dest_cb + block_size, dct_linesize,
block[8]);
2243 s->idsp.idct_put(dest_cr + block_size, dct_linesize,
block[9]);
2244 s->idsp.idct_put(dest_cb + block_size + dct_offset, dct_linesize,
block[10]);
2245 s->idsp.idct_put(dest_cr + block_size + dct_offset, dct_linesize,
block[11]);
2253 s->hdsp.put_pixels_tab[0][0](
s->dest[0], dest_y ,
linesize,16);
2255 s->hdsp.put_pixels_tab[
s->chroma_x_shift][0](
s->dest[1], dest_cb, uvlinesize,16 >>
s->chroma_y_shift);
2256 s->hdsp.put_pixels_tab[
s->chroma_x_shift][0](
s->dest[2], dest_cr, uvlinesize,16 >>
s->chroma_y_shift);
2277 s->last_picture_ptr ?
s->last_picture_ptr->f :
NULL, y,
h,
s->picture_structure,
2278 s->first_field,
s->low_delay);
2282 const int linesize =
s->current_picture.f->linesize[0];
2283 const int uvlinesize =
s->current_picture.f->linesize[1];
2284 const int width_of_mb = (4 + (
s->avctx->bits_per_raw_sample > 8)) -
s->avctx->lowres;
2285 const int height_of_mb = 4 -
s->avctx->lowres;
2287 s->block_index[0]=
s->b8_stride*(
s->mb_y*2 ) - 2 +
s->mb_x*2;
2288 s->block_index[1]=
s->b8_stride*(
s->mb_y*2 ) - 1 +
s->mb_x*2;
2289 s->block_index[2]=
s->b8_stride*(
s->mb_y*2 + 1) - 2 +
s->mb_x*2;
2290 s->block_index[3]=
s->b8_stride*(
s->mb_y*2 + 1) - 1 +
s->mb_x*2;
2291 s->block_index[4]=
s->mb_stride*(
s->mb_y + 1) +
s->b8_stride*
s->mb_height*2 +
s->mb_x - 1;
2292 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;
2295 s->dest[0] =
s->current_picture.f->data[0] + (
int)((
s->mb_x - 1
U) << width_of_mb);
2296 s->dest[1] =
s->current_picture.f->data[1] + (
int)((
s->mb_x - 1
U) << (width_of_mb -
s->chroma_x_shift));
2297 s->dest[2] =
s->current_picture.f->data[2] + (
int)((
s->mb_x - 1
U) << (width_of_mb -
s->chroma_x_shift));
2302 s->dest[0] +=
s->mb_y *
linesize << height_of_mb;
2303 s->dest[1] +=
s->mb_y * uvlinesize << (height_of_mb -
s->chroma_y_shift);
2304 s->dest[2] +=
s->mb_y * uvlinesize << (height_of_mb -
s->chroma_y_shift);
2306 s->dest[0] += (
s->mb_y>>1) *
linesize << height_of_mb;
2307 s->dest[1] += (
s->mb_y>>1) * uvlinesize << (height_of_mb -
s->chroma_y_shift);
2308 s->dest[2] += (
s->mb_y>>1) * uvlinesize << (height_of_mb -
s->chroma_y_shift);
2318 if (!
s || !
s->picture)
2323 s->current_picture_ptr =
s->last_picture_ptr =
s->next_picture_ptr =
NULL;
2329 s->mb_x=
s->mb_y= 0;
2332 s->parse_context.state= -1;
2333 s->parse_context.frame_start_found= 0;
2334 s->parse_context.overread= 0;
2335 s->parse_context.overread_index= 0;
2336 s->parse_context.index= 0;
2337 s->parse_context.last_index= 0;
2338 s->bitstream_buffer_size=0;
2349 else if (qscale > 31)
2353 s->chroma_qscale=
s->chroma_qscale_table[qscale];
2355 s->y_dc_scale=
s->y_dc_scale_table[ qscale ];
2356 s->c_dc_scale=
s->c_dc_scale_table[
s->chroma_qscale ];