aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-16 19:00:39 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-16 19:00:39 +0100
commitddbbfd95bee4105fcb75f3b7c039b6c08efe36b4 (patch)
tree6b89fa0cc6e1afa4f4e6f5fe8275ef54984bd9da /libavcodec
parent1fad547cefb4d2f3ed3d764b547ee16cf399e477 (diff)
parent1d0feb5d1ac04d187b335f0e8d411c9f40b3a885 (diff)
downloadffmpeg-ddbbfd95bee4105fcb75f3b7c039b6c08efe36b4.tar.gz
Merge commit '1d0feb5d1ac04d187b335f0e8d411c9f40b3a885'
* commit '1d0feb5d1ac04d187b335f0e8d411c9f40b3a885': mpegvideo: split ff_draw_horiz_band(). Conflicts: libavcodec/vc1dec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dxva2.c2
-rw-r--r--libavcodec/h263dec.c4
-rw-r--r--libavcodec/h264.c2
-rw-r--r--libavcodec/intrax8.c2
-rw-r--r--libavcodec/mpeg12.c2
-rw-r--r--libavcodec/mpegvideo.c86
-rw-r--r--libavcodec/mpegvideo.h6
-rw-r--r--libavcodec/mpegvideo_xvmc.c4
-rw-r--r--libavcodec/svq3.c2
-rw-r--r--libavcodec/vaapi.c2
-rw-r--r--libavcodec/vc1dec.c24
-rw-r--r--libavcodec/vdpau.c10
12 files changed, 84 insertions, 62 deletions
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index d8660710d6..148437a5e3 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -147,6 +147,6 @@ end:
}
if (!result)
- ff_draw_horiz_band(s, 0, s->avctx->height);
+ ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
return result;
}
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 898016c885..6b2488013d 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -241,7 +241,7 @@ static int decode_slice(MpegEncContext *s){
if(++s->mb_x >= s->mb_width){
s->mb_x=0;
- ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
+ ff_mpeg_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
ff_MPV_report_decode_progress(s);
s->mb_y++;
}
@@ -262,7 +262,7 @@ static int decode_slice(MpegEncContext *s){
ff_h263_loop_filter(s);
}
- ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
+ ff_mpeg_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
ff_MPV_report_decode_progress(s);
s->mb_x= 0;
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 087e5fcca6..486c47b9f2 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3767,7 +3767,7 @@ static void decode_finish_row(H264Context *h)
top = 0;
}
- ff_draw_horiz_band(s, top, height);
+ ff_mpeg_draw_horiz_band(s, top, height);
if (s->droppable)
return;
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index be524d6be7..5b76942add 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -776,7 +776,7 @@ int ff_intrax8_decode_picture(IntraX8Context * const w, int dquant, int quant_of
s->dest[0]+= 8;
}
if(s->mb_y&1){
- ff_draw_horiz_band(s, (s->mb_y-1)*8, 16);
+ ff_mpeg_draw_horiz_band(s, (s->mb_y-1)*8, 16);
}
}
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 985a956394..6462529107 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1809,7 +1809,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
if (++s->mb_x >= s->mb_width) {
const int mb_size = 16 >> s->avctx->lowres;
- ff_draw_horiz_band(s, mb_size*(s->mb_y >> field_pic), mb_size);
+ ff_mpeg_draw_horiz_band(s, mb_size*(s->mb_y >> field_pic), mb_size);
ff_MPV_report_decode_progress(s);
s->mb_x = 0;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index d03e511608..c031c8411b 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -2842,73 +2842,91 @@ void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64]){
/**
* @param h is the normal height, this will be reduced automatically if needed for the last row
*/
-void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
- const int field_pic= s->picture_structure != PICT_FRAME;
+void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur,
+ Picture *last, int y, int h, int picture_structure,
+ int first_field, int draw_edges, int low_delay,
+ int v_edge_pos, int h_edge_pos)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+ int hshift = desc->log2_chroma_w;
+ int vshift = desc->log2_chroma_h;
+ const int field_pic = picture_structure != PICT_FRAME;
if(field_pic){
h <<= 1;
y <<= 1;
}
- if (!s->avctx->hwaccel
- && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
- && s->unrestricted_mv
- && s->current_picture.f.reference
- && !s->intra_only
- && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
+ if (!avctx->hwaccel &&
+ !(avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
+ draw_edges &&
+ cur->f.reference &&
+ !(avctx->flags & CODEC_FLAG_EMU_EDGE)) {
+ int *linesize = cur->f.linesize;
int sides = 0, edge_h;
- int hshift = desc->log2_chroma_w;
- int vshift = desc->log2_chroma_h;
if (y==0) sides |= EDGE_TOP;
- if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM;
+ if (y + h >= v_edge_pos)
+ sides |= EDGE_BOTTOM;
- edge_h= FFMIN(h, s->v_edge_pos - y);
+ edge_h= FFMIN(h, v_edge_pos - y);
- s->dsp.draw_edges(s->current_picture_ptr->f.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->f.data[1] + (y>>vshift)*s->uvlinesize,
- s->uvlinesize, s->h_edge_pos>>hshift, edge_h>>vshift,
- EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, sides);
- s->dsp.draw_edges(s->current_picture_ptr->f.data[2] + (y>>vshift)*s->uvlinesize,
- s->uvlinesize, s->h_edge_pos>>hshift, edge_h>>vshift,
- EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, sides);
+ dsp->draw_edges(cur->f.data[0] + y * linesize[0],
+ linesize[0], h_edge_pos, edge_h,
+ EDGE_WIDTH, EDGE_WIDTH, sides);
+ dsp->draw_edges(cur->f.data[1] + (y >> vshift) * linesize[1],
+ linesize[1], h_edge_pos >> hshift, edge_h >> vshift,
+ EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides);
+ dsp->draw_edges(cur->f.data[2] + (y >> vshift) * linesize[2],
+ linesize[2], h_edge_pos >> hshift, edge_h >> vshift,
+ EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides);
}
- h= FFMIN(h, s->avctx->height - y);
+ h = FFMIN(h, avctx->height - y);
- if(field_pic && s->first_field && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
+ if(field_pic && first_field && !(avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
- if (s->avctx->draw_horiz_band) {
+ if (avctx->draw_horiz_band) {
AVFrame *src;
int offset[AV_NUM_DATA_POINTERS];
int i;
- if(s->pict_type==AV_PICTURE_TYPE_B || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))
- src = &s->current_picture_ptr->f;
- else if(s->last_picture_ptr)
- src = &s->last_picture_ptr->f;
+ if(cur->f.pict_type == AV_PICTURE_TYPE_B || low_delay ||
+ (avctx->slice_flags & SLICE_FLAG_CODED_ORDER))
+ src = &cur->f;
+ else if (last)
+ src = &last->f;
else
return;
- if(s->pict_type==AV_PICTURE_TYPE_B && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){
+ if (cur->f.pict_type == AV_PICTURE_TYPE_B &&
+ picture_structure == PICT_FRAME &&
+ avctx->codec_id != AV_CODEC_ID_H264 &&
+ avctx->codec_id != AV_CODEC_ID_SVQ3) {
for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
offset[i] = 0;
}else{
- offset[0]= y * s->linesize;
+ offset[0]= y * src->linesize[0];
offset[1]=
- offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize;
+ offset[2]= (y >> vshift) * src->linesize[1];
for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
offset[i] = 0;
}
emms_c();
- s->avctx->draw_horiz_band(s->avctx, src, offset,
- y, s->picture_structure, h);
+ avctx->draw_horiz_band(avctx, src, offset,
+ y, picture_structure, h);
}
}
+void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
+{
+ int draw_edges = s->unrestricted_mv && !s->intra_only;
+ ff_draw_horiz_band(s->avctx, &s->dsp, &s->current_picture,
+ &s->last_picture, y, h, s->picture_structure,
+ s->first_field, draw_edges, s->low_delay,
+ s->v_edge_pos, s->h_edge_pos);
+}
+
void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics
const int uvlinesize = s->current_picture.f.linesize[1];
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 924baccc8a..73c50c9920 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -774,7 +774,11 @@ void ff_MPV_common_init_arm(MpegEncContext *s);
void ff_MPV_common_init_altivec(MpegEncContext *s);
void ff_MPV_common_init_bfin(MpegEncContext *s);
void ff_clean_intra_table_entries(MpegEncContext *s);
-void ff_draw_horiz_band(MpegEncContext *s, int y, int h);
+void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur,
+ Picture *last, int y, int h, int picture_structure,
+ int first_field, int draw_edges, int low_delay,
+ int v_edge_pos, int h_edge_pos);
+void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
void ff_mpeg_flush(AVCodecContext *avctx);
void ff_print_debug_info(MpegEncContext *s, AVFrame *pict);
void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
diff --git a/libavcodec/mpegvideo_xvmc.c b/libavcodec/mpegvideo_xvmc.c
index 30a37e911a..00264ec44c 100644
--- a/libavcodec/mpegvideo_xvmc.c
+++ b/libavcodec/mpegvideo_xvmc.c
@@ -145,7 +145,7 @@ void ff_xvmc_field_end(MpegEncContext *s)
assert(render);
if (render->filled_mv_blocks_num > 0)
- ff_draw_horiz_band(s, 0, 0);
+ ff_mpeg_draw_horiz_band(s, 0, 0);
}
/**
@@ -328,5 +328,5 @@ void ff_xvmc_decode_mb(MpegEncContext *s)
if (render->filled_mv_blocks_num == render->allocated_mv_blocks)
- ff_draw_horiz_band(s, 0, 0);
+ ff_mpeg_draw_horiz_band(s, 0, 0);
}
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 8fa9c168fb..8239cfa98d 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -1144,7 +1144,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
(s->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1;
}
- ff_draw_horiz_band(s, 16 * s->mb_y, 16);
+ ff_mpeg_draw_horiz_band(s, 16 * s->mb_y, 16);
}
left = buf_size*8 - get_bits_count(&s->gb);
diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c
index 774fde840f..1cbb3378cf 100644
--- a/libavcodec/vaapi.c
+++ b/libavcodec/vaapi.c
@@ -187,7 +187,7 @@ int ff_vaapi_common_end_frame(MpegEncContext *s)
if (vactx->n_slice_buf_ids > 0) {
if (render_picture(vactx, ff_vaapi_get_surface_id(s->current_picture_ptr)) < 0)
goto done;
- ff_draw_horiz_band(s, 0, s->avctx->height);
+ ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
}
ret = 0;
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index e0792ed5ef..33f7426762 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -4454,14 +4454,14 @@ static void vc1_decode_i_blocks(VC1Context *v)
}
}
if (!v->s.loop_filter)
- ff_draw_horiz_band(s, s->mb_y * 16, 16);
+ ff_mpeg_draw_horiz_band(s, s->mb_y * 16, 16);
else if (s->mb_y)
- ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16);
+ ff_mpeg_draw_horiz_band(s, (s->mb_y - 1) * 16, 16);
s->first_slice_line = 0;
}
if (v->s.loop_filter)
- ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
+ ff_mpeg_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
/* This is intentionally mb_height and not end_mb_y - unlike in advanced
* profile, these only differ are when decoding MSS2 rectangles. */
@@ -4582,9 +4582,9 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
}
}
if (!v->s.loop_filter)
- ff_draw_horiz_band(s, s->mb_y * 16, 16);
+ ff_mpeg_draw_horiz_band(s, s->mb_y * 16, 16);
else if (s->mb_y)
- ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16);
+ ff_mpeg_draw_horiz_band(s, (s->mb_y-1) * 16, 16);
s->first_slice_line = 0;
}
@@ -4599,7 +4599,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
vc1_loop_filter_iblk_delayed(v, v->pq);
}
if (v->s.loop_filter)
- ff_draw_horiz_band(s, (s->end_mb_y-1)*16, 16);
+ ff_mpeg_draw_horiz_band(s, (s->end_mb_y-1)*16, 16);
ff_er_add_slice(&s->er, 0, s->start_mb_y << v->field_mode, s->mb_width - 1,
(s->end_mb_y << v->field_mode) - 1, ER_MB_END);
}
@@ -4662,7 +4662,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
memmove(v->ttblk_base, v->ttblk, sizeof(v->ttblk_base[0]) * s->mb_stride);
memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride);
memmove(v->luma_mv_base, v->luma_mv, sizeof(v->luma_mv_base[0]) * s->mb_stride);
- if (s->mb_y != s->start_mb_y) ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16);
+ if (s->mb_y != s->start_mb_y) ff_mpeg_draw_horiz_band(s, (s->mb_y - 1) * 16, 16);
s->first_slice_line = 0;
}
if (apply_loop_filter && v->fcm == PROGRESSIVE) {
@@ -4674,7 +4674,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
}
}
if (s->end_mb_y >= s->start_mb_y)
- ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
+ ff_mpeg_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
ff_er_add_slice(&s->er, 0, s->start_mb_y << v->field_mode, s->mb_width - 1,
(s->end_mb_y << v->field_mode) - 1, ER_MB_END);
}
@@ -4729,13 +4729,13 @@ static void vc1_decode_b_blocks(VC1Context *v)
if (v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq);
}
if (!v->s.loop_filter)
- ff_draw_horiz_band(s, s->mb_y * 16, 16);
+ ff_mpeg_draw_horiz_band(s, s->mb_y * 16, 16);
else if (s->mb_y)
- ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16);
+ ff_mpeg_draw_horiz_band(s, (s->mb_y - 1) * 16, 16);
s->first_slice_line = 0;
}
if (v->s.loop_filter)
- ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
+ ff_mpeg_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
ff_er_add_slice(&s->er, 0, s->start_mb_y << v->field_mode, s->mb_width - 1,
(s->end_mb_y << v->field_mode) - 1, ER_MB_END);
}
@@ -4755,7 +4755,7 @@ static void vc1_decode_skip_blocks(VC1Context *v)
memcpy(s->dest[1], s->last_picture.f.data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8);
memcpy(s->dest[2], s->last_picture.f.data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8);
}
- ff_draw_horiz_band(s, s->mb_y * 16, 16);
+ ff_mpeg_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
s->pict_type = AV_PICTURE_TYPE_P;
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 7bf693a90c..0929afda27 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -59,7 +59,7 @@ int ff_vdpau_common_end_frame(AVCodecContext *avctx)
hwctx->render(hwctx->decoder, surf, (void *)&hwctx->info,
hwctx->bitstream_buffers_used, hwctx->bitstream_buffers);
- ff_draw_horiz_band(s, 0, s->avctx->height);
+ ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
hwctx->bitstream_buffers_used = 0;
}
return 0;
@@ -235,7 +235,7 @@ void ff_vdpau_h264_picture_complete(MpegEncContext *s)
memcpy(render->info.h264.scaling_lists_8x8[0], h->pps.scaling_matrix8[0], sizeof(render->info.h264.scaling_lists_8x8[0]));
memcpy(render->info.h264.scaling_lists_8x8[1], h->pps.scaling_matrix8[3], sizeof(render->info.h264.scaling_lists_8x8[0]));
- ff_draw_horiz_band(s, 0, s->avctx->height);
+ ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
render->bitstream_buffers_used = 0;
}
@@ -292,7 +292,7 @@ void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
render->info.mpeg.slice_count = slice_count;
if (slice_count)
- ff_draw_horiz_band(s, 0, s->avctx->height);
+ ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
render->bitstream_buffers_used = 0;
}
@@ -361,7 +361,7 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
render->info.vc1.slice_count = 1;
- ff_draw_horiz_band(s, 0, s->avctx->height);
+ ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
render->bitstream_buffers_used = 0;
}
@@ -415,7 +415,7 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
ff_vdpau_add_data_chunk(s, buf, buf_size);
- ff_draw_horiz_band(s, 0, s->avctx->height);
+ ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
render->bitstream_buffers_used = 0;
}