Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: source/patched-ffmpeg-mt/libavcodec/mpegvideo.c

Issue 4533003: patched ffmpeg nov 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * The simplest mpeg encoder (well, it was the simplest!) 2 * The simplest mpeg encoder (well, it was the simplest!)
3 * Copyright (c) 2000,2001 Fabrice Bellard 3 * Copyright (c) 2000,2001 Fabrice Bellard
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> 4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5 * 5 *
6 * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at> 6 * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at>
7 * 7 *
8 * This file is part of FFmpeg. 8 * This file is part of FFmpeg.
9 * 9 *
10 * FFmpeg is free software; you can redistribute it and/or 10 * FFmpeg is free software; you can redistribute it and/or
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 if(s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) 577 if(s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
578 s->mb_height = (s->height + 31) / 32 * 2; 578 s->mb_height = (s->height + 31) / 32 * 2;
579 else 579 else
580 s->mb_height = (s->height + 15) / 16; 580 s->mb_height = (s->height + 15) / 16;
581 581
582 if(s->avctx->pix_fmt == PIX_FMT_NONE){ 582 if(s->avctx->pix_fmt == PIX_FMT_NONE){
583 av_log(s->avctx, AV_LOG_ERROR, "decoding to PIX_FMT_NONE is not supporte d.\n"); 583 av_log(s->avctx, AV_LOG_ERROR, "decoding to PIX_FMT_NONE is not supporte d.\n");
584 return -1; 584 return -1;
585 } 585 }
586 586
587 if(s->avctx->active_thread_type&FF_THREAD_SLICE && 587 if(s->avctx->thread_count > MAX_THREADS){
588 (s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_ height && s->mb_height))){
589 av_log(s->avctx, AV_LOG_ERROR, "too many threads\n"); 588 av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
590 return -1; 589 return -1;
591 } 590 }
592 591
593 if((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s- >avctx)) 592 if((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s- >avctx))
594 return -1; 593 return -1;
595 594
596 dsputil_init(&s->dsp, s->avctx); 595 dsputil_init(&s->dsp, s->avctx);
597 ff_dct_common_init(s); 596 ff_dct_common_init(s);
598 597
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 s->visualization_buffer[1] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); 737 s->visualization_buffer[1] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);
739 s->visualization_buffer[2] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); 738 s->visualization_buffer[2] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);
740 } 739 }
741 740
742 s->context_initialized = 1; 741 s->context_initialized = 1;
743 s->thread_context[0]= s; 742 s->thread_context[0]= s;
744 743
745 if (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE) { 744 if (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE) {
746 threads = s->avctx->thread_count; 745 threads = s->avctx->thread_count;
747 746
747 if (s->avctx->thread_count > s->mb_height && s->mb_height) {
748 av_log(s->avctx, AV_LOG_WARNING, "Reducing from %d to %d threads due to height of %d pixels.\n", s->avctx->thread_count, s->mb_height, s->height);
749 threads = s->mb_height;
750 }
751
748 for(i=1; i<threads; i++){ 752 for(i=1; i<threads; i++){
749 s->thread_context[i]= av_malloc(sizeof(MpegEncContext)); 753 s->thread_context[i]= av_malloc(sizeof(MpegEncContext));
750 memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); 754 memcpy(s->thread_context[i], s, sizeof(MpegEncContext));
751 } 755 }
752 756
753 for(i=0; i<threads; i++){ 757 for(i=0; i<threads; i++){
754 if(init_duplicate_context(s->thread_context[i], s) < 0) 758 if(init_duplicate_context(s->thread_context[i], s) < 0)
755 goto fail; 759 goto fail;
756 s->thread_context[i]->start_mb_y= (s->mb_height*(i ) + s->avctx->th read_count/2) / s->avctx->thread_count; 760 s->thread_context[i]->start_mb_y= (s->mb_height*(i ) + s->avctx->th read_count/2) / s->avctx->thread_count;
757 s->thread_context[i]->end_mb_y = (s->mb_height*(i+1) + s->avctx->th read_count/2) / s->avctx->thread_count; 761 s->thread_context[i]->end_mb_y = (s->mb_height*(i+1) + s->avctx->th read_count/2) / s->avctx->thread_count;
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 #endif 2238 #endif
2235 if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0); 2239 if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0);
2236 else MPV_decode_mb_internal(s, block, 0, 0); 2240 else MPV_decode_mb_internal(s, block, 0, 0);
2237 } 2241 }
2238 2242
2239 /** 2243 /**
2240 * 2244 *
2241 * @param h is the normal height, this will be reduced automatically if needed f or the last row 2245 * @param h is the normal height, this will be reduced automatically if needed f or the last row
2242 */ 2246 */
2243 void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ 2247 void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
2244 » const int field_pic= s->picture_structure != PICT_FRAME; 2248 const int field_pic= s->picture_structure != PICT_FRAME;
2245 if(field_pic){ 2249 if(field_pic){
2246 h <<= 1; 2250 h <<= 1;
2247 y <<= 1; 2251 y <<= 1;
2248 } 2252 }
2249 2253
2250 if (!s->avctx->hwaccel 2254 if (!s->avctx->hwaccel
2251 && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) 2255 && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
2252 && s->unrestricted_mv 2256 && s->unrestricted_mv
2253 && s->current_picture.reference 2257 && s->current_picture.reference
2254 && !s->intra_only 2258 && !s->intra_only
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 2594
2591 s->y_dc_scale= s->y_dc_scale_table[ qscale ]; 2595 s->y_dc_scale= s->y_dc_scale_table[ qscale ];
2592 s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ]; 2596 s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ];
2593 } 2597 }
2594 2598
2595 void MPV_report_decode_progress(MpegEncContext *s) 2599 void MPV_report_decode_progress(MpegEncContext *s)
2596 { 2600 {
2597 if (s->pict_type != FF_B_TYPE && !s->partitioned_frame) 2601 if (s->pict_type != FF_B_TYPE && !s->partitioned_frame)
2598 ff_thread_report_progress((AVFrame*)s->current_picture_ptr, s->mb_y, 0); 2602 ff_thread_report_progress((AVFrame*)s->current_picture_ptr, s->mb_y, 0);
2599 } 2603 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698