s->last_pict_type= s1->pict_type;
if (s1->current_picture_ptr) s->last_lambda_for[s1->pict_type] = s1->current_picture_ptr->quality;
- if(s1->pict_type!=AV_PICTURE_TYPE_B){
+ if(s1->pict_type!=FF_B_TYPE){
s->last_non_b_pict_type= s1->pict_type;
}
}
return -1;
}
- if(s->avctx->active_thread_type&FF_THREAD_SLICE &&
+ if((s->encoding || (s->avctx->active_thread_type & FF_THREAD_SLICE)) &&
(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height))){
av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
return -1;
s->context_initialized = 1;
s->thread_context[0]= s;
- if (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE) {
+ if (s->encoding || (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE)) {
threads = s->avctx->thread_count;
for(i=1; i<threads; i++){
if(init_duplicate_context(s, s) < 0) goto fail;
s->start_mb_y = 0;
s->end_mb_y = s->mb_height;
+
}
return 0;
{
int i, j, k;
- if (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE) {
+ if (s->encoding || (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE)) {
for(i=0; i<s->avctx->thread_count; i++){
free_duplicate_context(s->thread_context[i]);
}
&& s->current_picture.reference
&& !s->intra_only
&& !(s->flags&CODEC_FLAG_EMU_EDGE)) {
- int edges = EDGE_BOTTOM | EDGE_TOP, h = s->v_edge_pos;
-
- s->dsp.draw_edges(s->current_picture.data[0], s->linesize , s->h_edge_pos , h , EDGE_WIDTH , edges);
- s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, edges);
- s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, edges);
-
+ int hshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_w;
+ int vshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_h;
+ s->dsp.draw_edges(s->current_picture.data[0], s->linesize ,
+ s->h_edge_pos , s->v_edge_pos,
+ EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM);
+ s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize,
+ s->h_edge_pos>>hshift, s->v_edge_pos>>vshift,
+ EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, EDGE_TOP | EDGE_BOTTOM);
+ s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize,
+ s->h_edge_pos>>hshift, s->v_edge_pos>>vshift,
+ EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, EDGE_TOP | EDGE_BOTTOM);
}
emms_c();
if(s->avctx->debug&(FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)){
int x,y;
- av_log(s->avctx,AV_LOG_DEBUG,"New frame, type: ");
- switch (pict->pict_type) {
- case AV_PICTURE_TYPE_I: av_log(s->avctx,AV_LOG_DEBUG,"I\n"); break;
- case AV_PICTURE_TYPE_P: av_log(s->avctx,AV_LOG_DEBUG,"P\n"); break;
- case AV_PICTURE_TYPE_B: av_log(s->avctx,AV_LOG_DEBUG,"B\n"); break;
- case AV_PICTURE_TYPE_S: av_log(s->avctx,AV_LOG_DEBUG,"S\n"); break;
- case AV_PICTURE_TYPE_SI: av_log(s->avctx,AV_LOG_DEBUG,"SI\n"); break;
- case AV_PICTURE_TYPE_SP: av_log(s->avctx,AV_LOG_DEBUG,"SP\n"); break;
- }
+ av_log(s->avctx, AV_LOG_DEBUG, "New frame, type: %c\n",
+ av_get_picture_type_char(pict->pict_type));
for(y=0; y<s->mb_height; y++){
for(x=0; x<s->mb_width; x++){
if(s->avctx->debug&FF_DEBUG_SKIP){
pict->data[i]= s->visualization_buffer[i];
}
pict->type= FF_BUFFER_TYPE_COPY;
+ pict->opaque= NULL;
ptr= pict->data[0];
block_height = 16>>v_chroma_shift;
&& !s->intra_only
&& !(s->flags&CODEC_FLAG_EMU_EDGE)) {
int sides = 0, edge_h;
+ int hshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_w;
+ int vshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_h;
if (y==0) sides |= EDGE_TOP;
if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM;
edge_h= FFMIN(h, s->v_edge_pos - y);
- s->dsp.draw_edges(s->current_picture_ptr->data[0] + y *s->linesize , s->linesize , s->h_edge_pos , edge_h , EDGE_WIDTH , sides);
- s->dsp.draw_edges(s->current_picture_ptr->data[1] + (y>>1)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>1, edge_h>>1, EDGE_WIDTH/2, sides);
- s->dsp.draw_edges(s->current_picture_ptr->data[2] + (y>>1)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>1, edge_h>>1, EDGE_WIDTH/2, sides);
+ s->dsp.draw_edges(s->current_picture_ptr->data[0] + y *s->linesize , s->linesize,
+ s->h_edge_pos , edge_h , EDGE_WIDTH , EDGE_WIDTH , sides);
+ s->dsp.draw_edges(s->current_picture_ptr->data[1] + (y>>vshift)*s->uvlinesize, s->uvlinesize,
+ s->h_edge_pos>>hshift, edge_h>>hshift, EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, sides);
+ s->dsp.draw_edges(s->current_picture_ptr->data[2] + (y>>vshift)*s->uvlinesize, s->uvlinesize,
+ s->h_edge_pos>>hshift, edge_h>>hshift, EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, sides);
}
h= FFMIN(h, s->avctx->height - y);
void MPV_report_decode_progress(MpegEncContext *s)
{
- if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame)
+ if (s->pict_type != FF_B_TYPE && !s->partitioned_frame && !s->error_occurred)
ff_thread_report_progress((AVFrame*)s->current_picture_ptr, s->mb_y, 0);
}