summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-03-21 12:43:32 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-21 12:43:32 +0100
commite168b508163d7dc05176d81e6b5ea73ac23eb38b (patch)
treed6fc72152fcc1e94a4b101380bdf62a28432d564 /libavcodec/h264.c
parent137df692fc28710aa1a21856b1f5b9e157896fef (diff)
parentda6be8fcec16a94d8084bda8bb8a0a411a96bcf7 (diff)
Merge commit 'da6be8fcec16a94d8084bda8bb8a0a411a96bcf7'
* commit 'da6be8fcec16a94d8084bda8bb8a0a411a96bcf7': h264: add a parameter to the MB_FIELD macro. h264: add a parameter to the MB_MBAFF macro. Conflicts: libavcodec/h264.c libavcodec/h264_cabac.c libavcodec/h264_cavlc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 02053b56c1..dd36e64ad7 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -667,7 +667,7 @@ static inline void get_lowest_part_y(H264Context *h, int refs[2][48], int n,
{
int my;
- y_offset += 16 * (h->mb_y >> MB_FIELD);
+ y_offset += 16 * (h->mb_y >> MB_FIELD(h));
if (list0) {
int ref_n = h->ref_cache[0][scan8[n]];
@@ -783,7 +783,7 @@ static void await_references(H264Context *h)
int ref_field_picture = ref_pic->field_picture;
int pic_height = 16 * h->mb_height >> ref_field_picture;
- row <<= MB_MBAFF;
+ row <<= MB_MBAFF(h);
nrefs[list]--;
if (!FIELD_PICTURE && ref_field_picture) { // frame referencing two fields
@@ -834,7 +834,7 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic,
const int full_mx = mx >> 2;
const int full_my = my >> 2;
const int pic_width = 16 * h->mb_width;
- const int pic_height = 16 * h->mb_height >> MB_FIELD;
+ const int pic_height = 16 * h->mb_height >> MB_FIELD(h);
int ysh;
if (mx & 7)
@@ -894,7 +894,7 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic,
}
ysh = 3 - (chroma_idc == 2 /* yuv422 */);
- if (chroma_idc == 1 /* yuv420 */ && MB_FIELD) {
+ if (chroma_idc == 1 /* yuv420 */ && MB_FIELD(h)) {
// chroma offset when predicting from a field of opposite parity
my += 2 * ((h->mb_y & 1) - (pic->reference - 1));
emu |= (my >> 3) < 0 || (my >> 3) + 8 >= (pic_height >> 1);
@@ -952,7 +952,7 @@ static av_always_inline void mc_part_std(H264Context *h, int n, int square,
dest_cr += (x_offset << pixel_shift) + y_offset * h->mb_uvlinesize;
}
x_offset += 8 * h->mb_x;
- y_offset += 8 * (h->mb_y >> MB_FIELD);
+ y_offset += 8 * (h->mb_y >> MB_FIELD(h));
if (list0) {
Picture *ref = &h->ref_list[0][h->ref_cache[0][scan8[n]]];
@@ -1005,7 +1005,7 @@ static av_always_inline void mc_part_weighted(H264Context *h, int n, int square,
dest_cr += (x_offset << pixel_shift) + y_offset * h->mb_uvlinesize;
}
x_offset += 8 * h->mb_x;
- y_offset += 8 * (h->mb_y >> MB_FIELD);
+ y_offset += 8 * (h->mb_y >> MB_FIELD(h));
if (list0 && list1) {
/* don't optimize for luma-only case, since B-frames usually
@@ -2098,7 +2098,7 @@ static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y,
if (!simple && FRAME_MBAFF) {
if (h->mb_y & 1) {
- if (!MB_MBAFF) {
+ if (!MB_MBAFF(h)) {
top_border = h->top_borders[0][h->mb_x];
AV_COPY128(top_border, src_y + 15 * linesize);
if (pixel_shift)
@@ -2133,7 +2133,7 @@ static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y,
}
}
}
- } else if (MB_MBAFF) {
+ } else if (MB_MBAFF(h)) {
top_idx = 0;
} else
return;
@@ -2191,10 +2191,10 @@ static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
if (!simple && FRAME_MBAFF) {
if (h->mb_y & 1) {
- if (!MB_MBAFF)
+ if (!MB_MBAFF(h))
return;
} else {
- top_idx = MB_MBAFF ? 0 : 1;
+ top_idx = MB_MBAFF(h) ? 0 : 1;
}
}
@@ -2203,7 +2203,7 @@ static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
deblock_top = h->top_type;
} else {
deblock_topleft = (h->mb_x > 0);
- deblock_top = (h->mb_y > !!MB_FIELD);
+ deblock_top = (h->mb_y > !!MB_FIELD(h));
}
src_y -= linesize + 1 + pixel_shift;
@@ -3905,7 +3905,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h,
if (USES_LIST(top_type, list)) {
const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride;
const int b8_xy = 4 * top_xy + 2;
- int (*ref2frm)[64] = (void*)(h->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2));
+ int (*ref2frm)[64] = (void*)(h->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(h) ? 20 : 2));
AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]);
ref_cache[0 - 1 * 8] =
ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]];
@@ -3920,7 +3920,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h,
if (USES_LIST(left_type[LTOP], list)) {
const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3;
const int b8_xy = 4 * left_xy[LTOP] + 1;
- int (*ref2frm)[64] =(void*)( h->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2));
+ int (*ref2frm)[64] =(void*)( h->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(h) ? 20 : 2));
AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]);
AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]);
AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]);
@@ -3953,7 +3953,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h,
{
int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy];
- int (*ref2frm)[64] = (void*)(h->ref2frm[h->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2));
+ int (*ref2frm)[64] = (void*)(h->ref2frm[h->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(h) ? 20 : 2));
uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101;
AV_WN32A(&ref_cache[0 * 8], ref01);
@@ -3983,7 +3983,7 @@ static int fill_filter_caches(H264Context *h, int mb_type)
uint8_t *nnz;
uint8_t *nnz_cache;
- top_xy = mb_xy - (h->mb_stride << MB_FIELD);
+ top_xy = mb_xy - (h->mb_stride << MB_FIELD(h));
/* Wow, what a mess, why didn't they simplify the interlacing & intra
* stuff, I can't imagine that these complex rules are worth it. */
@@ -4154,7 +4154,7 @@ static void loop_filter(H264Context *h, int start_x, int end_x)
mb_y * h->uvlinesize * block_h;
// FIXME simplify above
- if (MB_FIELD) {
+ if (MB_FIELD(h)) {
linesize = h->mb_linesize = h->linesize * 2;
uvlinesize = h->mb_uvlinesize = h->uvlinesize * 2;
if (mb_y & 1) { // FIXME move out of this function?