Skip to content

Commit

Permalink
Merge remote-tracking branch 'qatar/master'
Browse files Browse the repository at this point in the history
* qatar/master:
  ffmpeg: fix some indentation
  ffmpeg: fix operation with --disable-avfilter
  simple_idct: remove disabled code
  motion_est: remove disabled code
  vc1: remove disabled code
  fate: separate lavf-mxf_d10 test from lavf-mxf
  cabac: Move code only used in the cabac test program to cabac.c.
  ffplay: warn that -pix_fmt is no longer working, suggest alternative
  ffplay: warn that -s is no longer working, suggest alternative
  lavf: rename enc variable in utils.c:has_codec_parameters()
  lavf: use designated initialisers for all (de)muxers.
  wav: remove a use of deprecated AV_METADATA_ macro
  rmdec: remove useless ap parameter from rm_read_header_old()
  dct-test: remove write-only variable
  des: fix #if conditional around P_shuffle
  Use LOCAL_ALIGNED in ff_check_alignment()

Conflicts:
	ffmpeg.c
	libavformat/avidec.c
	libavformat/matroskaenc.c
	libavformat/mp3enc.c
	libavformat/oggenc.c
	libavformat/utils.c
	tests/ref/lavf/mxf

Merged-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Jul 17, 2011
2 parents fc096e2 + 08e09ed commit 78accb8
Show file tree
Hide file tree
Showing 150 changed files with 1,488 additions and 2,033 deletions.
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ test_deps _muxer _demuxer \
mmf \
mov \
pcm_mulaw=mulaw \
mxf \
mxf="mxf mxf_d10" \
nut \
ogg \
rawvideo=pixfmt \
Expand Down
7 changes: 4 additions & 3 deletions doc/ffplay.texi
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ Force displayed width.
@item -y @var{height}
Force displayed height.
@item -s @var{size}
Set frame size (WxH or abbreviation), needed for videos which don't
contain a header with the frame size like raw YUV.
This option has been removed. Use private format options for specifying the
input video size.
@item -an
Disable audio.
@item -vn
Expand Down Expand Up @@ -89,7 +89,8 @@ Read @var{input_file}.
@section Advanced options
@table @option
@item -pix_fmt @var{format}
Set pixel format.
This option has been removed. Use private options for specifying the
input pixel format.
@item -stats
Show the stream duration, the codec parameters, the current position in
the stream and the audio/video synchronisation drift.
Expand Down
11 changes: 7 additions & 4 deletions ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2323,16 +2323,19 @@ static int transcode(AVFormatContext **output_files,
fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n");
ffmpeg_exit(1);
}

if (!codec->width || !codec->height) {
codec->width = icodec->width;
codec->height = icodec->height;
}

ost->video_resample = codec->width != icodec->width ||
codec->height != icodec->height ||
codec->pix_fmt != icodec->pix_fmt;
if (ost->video_resample) {
codec->bits_per_raw_sample= frame_bits_per_raw_sample;
}
if (!codec->width || !codec->height) {
codec->width = icodec->width;
codec->height = icodec->height;
}

ost->resample_height = icodec->height;
ost->resample_width = icodec->width;
ost->resample_pix_fmt= icodec->pix_fmt;
Expand Down
20 changes: 6 additions & 14 deletions ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ static int fs_screen_width;
static int fs_screen_height;
static int screen_width = 0;
static int screen_height = 0;
static int frame_width = 0;
static int frame_height = 0;
static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
static int audio_disable;
static int video_disable;
static int wanted_stream[AVMEDIA_TYPE_NB]={
Expand Down Expand Up @@ -2813,15 +2810,9 @@ static void event_loop(void)

static int opt_frame_size(const char *opt, const char *arg)
{
if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) {
fprintf(stderr, "Incorrect frame size\n");
return AVERROR(EINVAL);
}
if ((frame_width % 2) != 0 || (frame_height % 2) != 0) {
fprintf(stderr, "Frame size must be a multiple of 2\n");
return AVERROR(EINVAL);
}
return 0;
av_log(NULL, AV_LOG_ERROR,
"Option '%s' has been removed, use private format options instead\n", opt);
return AVERROR(EINVAL);
}

static int opt_width(const char *opt, const char *arg)
Expand All @@ -2848,8 +2839,9 @@ static int opt_format(const char *opt, const char *arg)

static int opt_frame_pix_fmt(const char *opt, const char *arg)
{
frame_pix_fmt = av_get_pix_fmt(arg);
return 0;
av_log(NULL, AV_LOG_ERROR,
"Option '%s' has been removed, use private format options instead\n", opt);
return AVERROR(EINVAL);
}

static int opt_sync(const char *opt, const char *arg)
Expand Down
134 changes: 134 additions & 0 deletions libavcodec/cabac.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,140 @@ void ff_init_cabac_states(CABACContext *c){
#include "avcodec.h"
#include "cabac.h"

static void put_cabac(CABACContext *c, uint8_t * const state, int bit){
int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + *state];

if(bit == ((*state)&1)){
c->range -= RangeLPS;
*state= ff_h264_mps_state[*state];
}else{
c->low += c->range - RangeLPS;
c->range = RangeLPS;
*state= ff_h264_lps_state[*state];
}

renorm_cabac_encoder(c);

#ifdef STRICT_LIMITS
c->symCount++;
#endif
}

/**
* @param bit 0 -> write zero bit, !=0 write one bit
*/
static void put_cabac_bypass(CABACContext *c, int bit){
c->low += c->low;

if(bit){
c->low += c->range;
}
//FIXME optimize
if(c->low<0x200){
put_cabac_bit(c, 0);
}else if(c->low<0x400){
c->outstanding_count++;
c->low -= 0x200;
}else{
put_cabac_bit(c, 1);
c->low -= 0x400;
}

#ifdef STRICT_LIMITS
c->symCount++;
#endif
}

/**
*
* @return the number of bytes written
*/
static int put_cabac_terminate(CABACContext *c, int bit){
c->range -= 2;

if(!bit){
renorm_cabac_encoder(c);
}else{
c->low += c->range;
c->range= 2;

renorm_cabac_encoder(c);

assert(c->low <= 0x1FF);
put_cabac_bit(c, c->low>>9);
put_bits(&c->pb, 2, ((c->low>>7)&3)|1);

flush_put_bits(&c->pb); //FIXME FIXME FIXME XXX wrong
}

#ifdef STRICT_LIMITS
c->symCount++;
#endif

return (put_bits_count(&c->pb)+7)>>3;
}

/**
* put (truncated) unary binarization.
*/
static void put_cabac_u(CABACContext *c, uint8_t * state, int v, int max, int max_index, int truncated){
int i;

assert(v <= max);

for(i=0; i<v; i++){
put_cabac(c, state, 1);
if(i < max_index) state++;
}
if(truncated==0 || v<max)
put_cabac(c, state, 0);
}

/**
* put unary exp golomb k-th order binarization.
*/
static void put_cabac_ueg(CABACContext *c, uint8_t * state, int v, int max, int is_signed, int k, int max_index){
int i;

if(v==0)
put_cabac(c, state, 0);
else{
const int sign= v < 0;

if(is_signed) v= FFABS(v);

if(v<max){
for(i=0; i<v; i++){
put_cabac(c, state, 1);
if(i < max_index) state++;
}

put_cabac(c, state, 0);
}else{
int m= 1<<k;

for(i=0; i<max; i++){
put_cabac(c, state, 1);
if(i < max_index) state++;
}

v -= max;
while(v >= m){ //FIXME optimize
put_cabac_bypass(c, 1);
v-= m;
m+= m;
}
put_cabac_bypass(c, 0);
while(m>>=1){
put_cabac_bypass(c, v&m);
}
}

if(is_signed)
put_cabac_bypass(c, sign);
}
}

int main(void){
CABACContext c;
uint8_t b[9*SIZE];
Expand Down
Loading

0 comments on commit 78accb8

Please sign in to comment.