Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
h264: Read crop from SPS and subtract from picture width/height
  • Loading branch information
andoma committed Nov 19, 2013
1 parent 4b3c1dc commit d0af361
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/parsers/parser_h264.c
Expand Up @@ -303,23 +303,28 @@ h264_decode_seq_parameter_set(elementary_stream_t *st, bitstream_t *bs)
width = read_golomb_ue(bs) + 1; /* mb width */
height = read_golomb_ue(bs) + 1; /* mb height */

p->sps[sps_id].width = width * 16;
p->sps[sps_id].height = height * 16;

p->sps[sps_id].mbs_only_flag = read_bits1(bs);
if(!p->sps[sps_id].mbs_only_flag)
p->sps[sps_id].aff = read_bits1(bs);

read_bits1(bs);

int crop_left = 0;
int crop_right = 0;
int crop_top = 0;
int crop_bottom = 0;

/* CROP */
if(read_bits1(bs)){
tmp = read_golomb_ue(bs);
tmp = read_golomb_ue(bs);
tmp = read_golomb_ue(bs);
tmp = read_golomb_ue(bs);
crop_left = read_golomb_ue(bs) * 2;
crop_right = read_golomb_ue(bs) * 2;
crop_top = read_golomb_ue(bs) * 2;
crop_bottom = read_golomb_ue(bs) * 2;
}

p->sps[sps_id].width = width * 16 - crop_left - crop_right;
p->sps[sps_id].height = height * 16 - crop_top - crop_bottom;

if(read_bits1(bs)) {
decode_vui(p, bs, sps_id);
return 0;
Expand Down

0 comments on commit d0af361

Please sign in to comment.