#include "libavutil/display.h"
#include "libavutil/imgutils.h"
#include "libavutil/stereo3d.h"
-#include "libavutil/timer.h"
#include "internal.h"
#include "cabac.h"
#include "cabac_functions.h"
H264Picture *pic;
int i, ret;
const int pixel_shift = h->pixel_shift;
- int c[4] = {
- 1<<(h->ps.sps->bit_depth_luma-1),
- 1<<(h->ps.sps->bit_depth_chroma-1),
- 1<<(h->ps.sps->bit_depth_chroma-1),
- -1
- };
if (!ff_thread_can_start_frame(h->avctx)) {
av_log(h->avctx, AV_LOG_ERROR, "Attempt to start a frame outside SETUP state\n");
if ((ret = alloc_picture(h, pic)) < 0)
return ret;
- if(!h->frame_recovered && !h->avctx->hwaccel)
- ff_color_frame(pic->f, c);
h->cur_pic_ptr = pic;
ff_h264_unref_picture(h, &h->cur_pic);
}
/* export coded and cropped frame dimensions to AVCodecContext */
-static int init_dimensions(H264Context *h)
+static void init_dimensions(H264Context *h)
{
const SPS *sps = (const SPS*)h->ps.sps;
int cr = sps->crop_right;
h->crop_left = cl;
h->crop_top = ct;
h->crop_bottom = cb;
-
- return 0;
}
static int h264_slice_header_init(H264Context *h)
h->width = 16 * h->mb_width;
h->height = 16 * h->mb_height;
- ret = init_dimensions(h);
- if (ret < 0)
- return ret;
+ init_dimensions(h);
if (sps->video_signal_type_present_flag) {
h->avctx->color_range = sps->full_range > 0 ? AVCOL_RANGE_JPEG
h->avctx->colorspace = sps->colorspace;
}
}
+
+ if (h->sei.alternative_transfer.present &&
+ av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics) &&
+ h->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) {
+ h->avctx->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics;
+ }
}
+ h->avctx->chroma_sample_location = sps->chroma_location;
if (!h->context_initialized || must_reinit || needs_reinit) {
int flush_changes = h->context_initialized;
h->sei.picture_timing.timecode_cnt = 0;
}
- if (h->sei.alternative_transfer.present &&
- av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics) &&
- h->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) {
- h->avctx->color_trc = cur->f->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics;
- }
-
return 0;
}
* vectors. Given we are concealing a lost frame, this probably
* is not noticeable by comparison, but it should be fixed. */
if (h->short_ref_count) {
+ int c[4] = {
+ 1<<(h->ps.sps->bit_depth_luma-1),
+ 1<<(h->ps.sps->bit_depth_chroma-1),
+ 1<<(h->ps.sps->bit_depth_chroma-1),
+ -1
+ };
+
if (prev &&
h->short_ref[0]->f->width == prev->f->width &&
h->short_ref[0]->f->height == prev->f->height &&
prev->f->width,
prev->f->height);
h->short_ref[0]->poc = prev->poc + 2;
- }
+ } else if (!h->frame_recovered && !h->avctx->hwaccel)
+ ff_color_frame(h->short_ref[0]->f, c);
h->short_ref[0]->frame_num = h->poc.prev_frame_num;
}
}
ff_h264_init_cabac_states(h, sl);
for (;;) {
- // START_TIMER
int ret, eos;
if (sl->mb_x + sl->mb_y * h->mb_width >= sl->next_slice_idx) {
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps with next at %d\n",
}
ret = ff_h264_decode_mb_cabac(h, sl);
- // STOP_TIMER("decode_mb_cabac")
if (ret >= 0)
ff_h264_hl_decode_mb(h, sl);