Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-05-22 Thread Luca Barbato
On 19/05/15 11:13, Vittorio Giovara wrote:
 I'd queue this for end of this week if no objections.

Looks like there are not.

lu


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-05-19 Thread Vittorio Giovara
On Tue, May 12, 2015 at 2:16 AM, Vittorio Giovara
vittorio.giov...@gmail.com wrote:
 On Sun, May 10, 2015 at 11:01 PM, Luca Barbato lu_z...@gentoo.org wrote:
 On 01/05/15 08:39, Anton Khirnov wrote:

 More specific benchmarks. As expected they aren't really different.

  Performance counter stats for './avconv-v12_dev0-1273-g46914ff -nostats
 -v quiet -filter_complex testsrc -t 600 -c:v mpeg2video -f null -' (30
 runs):

   18186.236693  task-clock (msec) #1.271 CPUs
 utilized( +-  1.06% )
 300332  context-switches  #0.017 M/sec
   ( +-  0.00% )
851  cpu-migrations#0.047 K/sec
   ( +-  5.59% )
 153625  page-faults   #0.008 M/sec
   ( +-  0.00% )
47684924907  cycles#2.622 GHz
   ( +-  0.14% )
17169614279  stalled-cycles-frontend   #   36.01% frontend
 cycles idle ( +-  0.38% )
  0  stalled-cycles-backend#0.00% backend
 cycles idle
   103427443643  instructions  #2.17  insns per cycle
   #0.17  stalled
 cycles per insn  ( +-  0.00% )
 9126880556  branches  #  501.856 M/sec
   ( +-  0.00% )
  113808703  branch-misses #1.25% of all
 branches  ( +-  0.13% )

   14.306429475 seconds time elapsed
  ( +-  1.11% )


  Performance counter stats for './avconv-v12_dev0-1276-g9503449 -nostats
 -v quiet -filter_complex testsrc -t 600 -c:v mpeg2video -f null -' (30
 runs):

   18207.403592  task-clock (msec) #1.273 CPUs
 utilized( +-  0.99% )
 300327  context-switches  #0.016 M/sec
   ( +-  0.00% )
860  cpu-migrations#0.047 K/sec
   ( +-  6.30% )
 153626  page-faults   #0.008 M/sec
   ( +-  0.00% )
47685530782  cycles#2.619 GHz
   ( +-  0.15% )
17165731850  stalled-cycles-frontend   #   36.00% frontend
 cycles idle ( +-  0.41% )
  0  stalled-cycles-backend#0.00% backend
 cycles idle
   103428007012  instructions  #2.17  insns per cycle
   #0.17  stalled
 cycles per insn  ( +-  0.00% )
 9127004846  branches  #  501.280 M/sec
   ( +-  0.00% )
  113822534  branch-misses #1.25% of all
 branches  ( +-  0.12% )

   14.305442763 seconds time elapsed
  ( +-  1.01% )


  Performance counter stats for './avconv-v12_dev0-1273-g46914ff -nostats
 -v quiet -i /tmp/test.mkv -f null -' (30 runs):

2364.470888  task-clock (msec) #1.564 CPUs
 utilized( +-  1.49% )
 150459  context-switches  #0.064 M/sec
   ( +-  0.02% )
177  cpu-migrations#0.075 K/sec
   ( +- 12.06% )
773  page-faults   #0.327 K/sec
   ( +-  0.05% )
 6823046093  cycles#2.886 GHz
   ( +-  0.33% )
 3953734628  stalled-cycles-frontend   #   57.95% frontend
 cycles idle ( +-  0.56% )
  0  stalled-cycles-backend#0.00% backend
 cycles idle
 8204593415  instructions  #1.20  insns per cycle
   #0.48  stalled
 cycles per insn  ( +-  0.00% )
 1187962103  branches  #  502.422 M/sec
   ( +-  0.01% )
   20631618  branch-misses #1.74% of all
 branches  ( +-  0.20% )

1.511403840 seconds time elapsed
  ( +-  1.48% )


  Performance counter stats for './avconv-v12_dev0-1276-g9503449 -nostats
 -v quiet -i /tmp/test.mkv -f null -' (30 runs):

2347.891829  task-clock (msec) #1.562 CPUs
 utilized( +-  1.72% )
 150424  context-switches  #0.064 M/sec
   ( +-  0.02% )
138  cpu-migrations#0.059 K/sec
   ( +-  8.35% )
773  page-faults   #0.329 K/sec
   ( +-  0.05% )
 6809473884  cycles#2.900 GHz
   ( +-  0.33% )
 3941879048  stalled-cycles-frontend   #   57.89% frontend
 cycles idle ( +-  0.59% )
  0  stalled-cycles-backend#0.00% backend
 cycles idle
 8204107450  instructions  #1.20  insns per cycle
   #

Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-05-11 Thread Vittorio Giovara
On Sun, May 10, 2015 at 11:01 PM, Luca Barbato lu_z...@gentoo.org wrote:
 On 01/05/15 08:39, Anton Khirnov wrote:

 More specific benchmarks. As expected they aren't really different.

  Performance counter stats for './avconv-v12_dev0-1273-g46914ff -nostats
 -v quiet -filter_complex testsrc -t 600 -c:v mpeg2video -f null -' (30
 runs):

   18186.236693  task-clock (msec) #1.271 CPUs
 utilized( +-  1.06% )
 300332  context-switches  #0.017 M/sec
   ( +-  0.00% )
851  cpu-migrations#0.047 K/sec
   ( +-  5.59% )
 153625  page-faults   #0.008 M/sec
   ( +-  0.00% )
47684924907  cycles#2.622 GHz
   ( +-  0.14% )
17169614279  stalled-cycles-frontend   #   36.01% frontend
 cycles idle ( +-  0.38% )
  0  stalled-cycles-backend#0.00% backend
 cycles idle
   103427443643  instructions  #2.17  insns per cycle
   #0.17  stalled
 cycles per insn  ( +-  0.00% )
 9126880556  branches  #  501.856 M/sec
   ( +-  0.00% )
  113808703  branch-misses #1.25% of all
 branches  ( +-  0.13% )

   14.306429475 seconds time elapsed
  ( +-  1.11% )


  Performance counter stats for './avconv-v12_dev0-1276-g9503449 -nostats
 -v quiet -filter_complex testsrc -t 600 -c:v mpeg2video -f null -' (30
 runs):

   18207.403592  task-clock (msec) #1.273 CPUs
 utilized( +-  0.99% )
 300327  context-switches  #0.016 M/sec
   ( +-  0.00% )
860  cpu-migrations#0.047 K/sec
   ( +-  6.30% )
 153626  page-faults   #0.008 M/sec
   ( +-  0.00% )
47685530782  cycles#2.619 GHz
   ( +-  0.15% )
17165731850  stalled-cycles-frontend   #   36.00% frontend
 cycles idle ( +-  0.41% )
  0  stalled-cycles-backend#0.00% backend
 cycles idle
   103428007012  instructions  #2.17  insns per cycle
   #0.17  stalled
 cycles per insn  ( +-  0.00% )
 9127004846  branches  #  501.280 M/sec
   ( +-  0.00% )
  113822534  branch-misses #1.25% of all
 branches  ( +-  0.12% )

   14.305442763 seconds time elapsed
  ( +-  1.01% )


  Performance counter stats for './avconv-v12_dev0-1273-g46914ff -nostats
 -v quiet -i /tmp/test.mkv -f null -' (30 runs):

2364.470888  task-clock (msec) #1.564 CPUs
 utilized( +-  1.49% )
 150459  context-switches  #0.064 M/sec
   ( +-  0.02% )
177  cpu-migrations#0.075 K/sec
   ( +- 12.06% )
773  page-faults   #0.327 K/sec
   ( +-  0.05% )
 6823046093  cycles#2.886 GHz
   ( +-  0.33% )
 3953734628  stalled-cycles-frontend   #   57.95% frontend
 cycles idle ( +-  0.56% )
  0  stalled-cycles-backend#0.00% backend
 cycles idle
 8204593415  instructions  #1.20  insns per cycle
   #0.48  stalled
 cycles per insn  ( +-  0.00% )
 1187962103  branches  #  502.422 M/sec
   ( +-  0.01% )
   20631618  branch-misses #1.74% of all
 branches  ( +-  0.20% )

1.511403840 seconds time elapsed
  ( +-  1.48% )


  Performance counter stats for './avconv-v12_dev0-1276-g9503449 -nostats
 -v quiet -i /tmp/test.mkv -f null -' (30 runs):

2347.891829  task-clock (msec) #1.562 CPUs
 utilized( +-  1.72% )
 150424  context-switches  #0.064 M/sec
   ( +-  0.02% )
138  cpu-migrations#0.059 K/sec
   ( +-  8.35% )
773  page-faults   #0.329 K/sec
   ( +-  0.05% )
 6809473884  cycles#2.900 GHz
   ( +-  0.33% )
 3941879048  stalled-cycles-frontend   #   57.89% frontend
 cycles idle ( +-  0.59% )
  0  stalled-cycles-backend#0.00% backend
 cycles idle
 8204107450  instructions  #1.20  insns per cycle
   #0.48  stalled
 cycles per insn  ( +-  0.01% )
 1187871561  branches  

Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-05-10 Thread Luca Barbato
On 01/05/15 08:39, Anton Khirnov wrote:

More specific benchmarks. As expected they aren't really different.

 Performance counter stats for './avconv-v12_dev0-1273-g46914ff -nostats
-v quiet -filter_complex testsrc -t 600 -c:v mpeg2video -f null -' (30
runs):

  18186.236693  task-clock (msec) #1.271 CPUs
utilized( +-  1.06% )
300332  context-switches  #0.017 M/sec
  ( +-  0.00% )
   851  cpu-migrations#0.047 K/sec
  ( +-  5.59% )
153625  page-faults   #0.008 M/sec
  ( +-  0.00% )
   47684924907  cycles#2.622 GHz
  ( +-  0.14% )
   17169614279  stalled-cycles-frontend   #   36.01% frontend
cycles idle ( +-  0.38% )
 0  stalled-cycles-backend#0.00% backend
cycles idle
  103427443643  instructions  #2.17  insns per cycle
  #0.17  stalled
cycles per insn  ( +-  0.00% )
9126880556  branches  #  501.856 M/sec
  ( +-  0.00% )
 113808703  branch-misses #1.25% of all
branches  ( +-  0.13% )

  14.306429475 seconds time elapsed
 ( +-  1.11% )


 Performance counter stats for './avconv-v12_dev0-1276-g9503449 -nostats
-v quiet -filter_complex testsrc -t 600 -c:v mpeg2video -f null -' (30
runs):

  18207.403592  task-clock (msec) #1.273 CPUs
utilized( +-  0.99% )
300327  context-switches  #0.016 M/sec
  ( +-  0.00% )
   860  cpu-migrations#0.047 K/sec
  ( +-  6.30% )
153626  page-faults   #0.008 M/sec
  ( +-  0.00% )
   47685530782  cycles#2.619 GHz
  ( +-  0.15% )
   17165731850  stalled-cycles-frontend   #   36.00% frontend
cycles idle ( +-  0.41% )
 0  stalled-cycles-backend#0.00% backend
cycles idle
  103428007012  instructions  #2.17  insns per cycle
  #0.17  stalled
cycles per insn  ( +-  0.00% )
9127004846  branches  #  501.280 M/sec
  ( +-  0.00% )
 113822534  branch-misses #1.25% of all
branches  ( +-  0.12% )

  14.305442763 seconds time elapsed
 ( +-  1.01% )


 Performance counter stats for './avconv-v12_dev0-1273-g46914ff -nostats
-v quiet -i /tmp/test.mkv -f null -' (30 runs):

   2364.470888  task-clock (msec) #1.564 CPUs
utilized( +-  1.49% )
150459  context-switches  #0.064 M/sec
  ( +-  0.02% )
   177  cpu-migrations#0.075 K/sec
  ( +- 12.06% )
   773  page-faults   #0.327 K/sec
  ( +-  0.05% )
6823046093  cycles#2.886 GHz
  ( +-  0.33% )
3953734628  stalled-cycles-frontend   #   57.95% frontend
cycles idle ( +-  0.56% )
 0  stalled-cycles-backend#0.00% backend
cycles idle
8204593415  instructions  #1.20  insns per cycle
  #0.48  stalled
cycles per insn  ( +-  0.00% )
1187962103  branches  #  502.422 M/sec
  ( +-  0.01% )
  20631618  branch-misses #1.74% of all
branches  ( +-  0.20% )

   1.511403840 seconds time elapsed
 ( +-  1.48% )


 Performance counter stats for './avconv-v12_dev0-1276-g9503449 -nostats
-v quiet -i /tmp/test.mkv -f null -' (30 runs):

   2347.891829  task-clock (msec) #1.562 CPUs
utilized( +-  1.72% )
150424  context-switches  #0.064 M/sec
  ( +-  0.02% )
   138  cpu-migrations#0.059 K/sec
  ( +-  8.35% )
   773  page-faults   #0.329 K/sec
  ( +-  0.05% )
6809473884  cycles#2.900 GHz
  ( +-  0.33% )
3941879048  stalled-cycles-frontend   #   57.89% frontend
cycles idle ( +-  0.59% )
 0  stalled-cycles-backend#0.00% backend
cycles idle
8204107450  instructions  #1.20  insns per cycle
  #0.48  stalled
cycles per insn  ( +-  0.01% )
1187871561  branches  #  505.931 M/sec
  ( +-  0.01% )
  20597974  branch-misses #1.73% of all
branches  ( +-  0.15% )

   

Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-05-08 Thread Luca Barbato
On 01/05/15 08:39, Anton Khirnov wrote:
 FATE tests so many things that it's not really a good benchmark of any
 specific codec.

Actually it can be useful to see the global impact of a patch assuming
somebody has the time and the will to benchmark.

I'm mostly done with the first POC of the concept:

- it takes measurement per-test (30 times to have a meaninful avg and std)
- all the data is then stored to be further processed in sqlite since
I'm too lazy to feed it to pandas or R.
- I check if the difference per-test between different commits is
meaningful, expecting to have the test testing unchanged code to show
nothing meaningful.

The main problem I'm seeing in this approach is that it takes hours to
execute on a xeon (since it is a fate -j 1) so it is not really usable
per-commit in practice until fate doesn't learn to run only the tests
impacted by the code.

lu






___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-05-01 Thread Anton Khirnov
Quoting Vittorio Giovara (2015-05-01 03:44:30)
 On Thu, Apr 30, 2015 at 2:03 PM, Anton Khirnov an...@khirnov.net wrote:
  Quoting Vittorio Giovara (2015-04-27 20:13:25)
  They are just duplicates of AVCodecContext members so use them directly.
 
  Have you benchmarked this?
 
  The reason there are copies of those fields is probably more efficient
  cache usage. I am not sure it actually matters anywhere, but it should
  be tested.
 
 Well I did a rough check with make -j fate on the currently published
 set (6 patches) under a few configurations, but didn't find a huge
 impact on performance (as expected).
 
 * clean master
   (+debug -opt +asm)
 real0m59.735s
 user6m26.844s
 sys0m9.752s
   (+debug -opt -asm)
 real1m41.182s
 user9m54.168s
 sys0m10.552s
   (-debug +opt +asm)
 real0m24.618s
 user2m29.692s
 sys0m9.124s
   (-debug +opt -asm)
 real0m37.459s
 user3m18.604s
 sys0m9.376s
 
 * my set
   (+debug -opt +asm)
 real0m59.714s
 user6m24.404s
 sys0m9.648s
   (+debug -opt -asm)
 real1m40.503s
 user9m57.104s
 sys0m9.880s
   (-debug +opt +asm)
 real0m24.618s
 user2m31.316s
 sys0m9.080s
   (-debug +opt -asm)
 real0m33.260s
 user3m15.884s
 sys0m9.304s
 
 Thanks to Luca for lending me the test machine.

FATE tests so many things that it's not really a good benchmark of any
specific codec.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-05-01 Thread Luca Barbato
On 01/05/15 03:44, Vittorio Giovara wrote:
 On Thu, Apr 30, 2015 at 2:03 PM, Anton Khirnov an...@khirnov.net wrote:
 Quoting Vittorio Giovara (2015-04-27 20:13:25)
 They are just duplicates of AVCodecContext members so use them directly.

 Have you benchmarked this?

 The reason there are copies of those fields is probably more efficient
 cache usage. I am not sure it actually matters anywhere, but it should
 be tested.
 
 Well I did a rough check with make -j fate on the currently published
 set (6 patches) under a few configurations, but didn't find a huge
 impact on performance (as expected).
 

I guess is `-j 1`.

I guess measuring the single tests should give some meaningful result.

the host has perf installed now to do that easily...

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-04-30 Thread Anton Khirnov
Quoting Vittorio Giovara (2015-04-27 20:13:25)
 They are just duplicates of AVCodecContext members so use them directly.

Have you benchmarked this?

The reason there are copies of those fields is probably more efficient
cache usage. I am not sure it actually matters anywhere, but it should
be tested.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-04-30 Thread Vittorio Giovara
On Thu, Apr 30, 2015 at 2:03 PM, Anton Khirnov an...@khirnov.net wrote:
 Quoting Vittorio Giovara (2015-04-27 20:13:25)
 They are just duplicates of AVCodecContext members so use them directly.

 Have you benchmarked this?

 The reason there are copies of those fields is probably more efficient
 cache usage. I am not sure it actually matters anywhere, but it should
 be tested.

Well I did a rough check with make -j fate on the currently published
set (6 patches) under a few configurations, but didn't find a huge
impact on performance (as expected).

* clean master
  (+debug -opt +asm)
real0m59.735s
user6m26.844s
sys0m9.752s
  (+debug -opt -asm)
real1m41.182s
user9m54.168s
sys0m10.552s
  (-debug +opt +asm)
real0m24.618s
user2m29.692s
sys0m9.124s
  (-debug +opt -asm)
real0m37.459s
user3m18.604s
sys0m9.376s

* my set
  (+debug -opt +asm)
real0m59.714s
user6m24.404s
sys0m9.648s
  (+debug -opt -asm)
real1m40.503s
user9m57.104s
sys0m9.880s
  (-debug +opt +asm)
real0m24.618s
user2m31.316s
sys0m9.080s
  (-debug +opt -asm)
real0m33.260s
user3m15.884s
sys0m9.304s

Thanks to Luca for lending me the test machine.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-04-28 Thread Diego Biurrun
On Mon, Apr 27, 2015 at 07:13:25PM +0100, Vittorio Giovara wrote:
 They are just duplicates of AVCodecContext members so use them directly.

They are just duplicates of AVCodecContext members so use those instead.

 --- a/libavcodec/ituh263enc.c
 +++ b/libavcodec/ituh263enc.c
 @@ -459,7 +459,7 @@ void ff_h263_encode_mb(MpegEncContext * s,
  int16_t pred_dc;
  int16_t rec_intradc[6];
  int16_t *dc_ptr[6];
 -const int interleaved_stats= (s-flagsCODEC_FLAG_PASS1);
 +const int interleaved_stats = (s-avctx-flags  CODEC_FLAG_PASS1);

nit: drop pointless ()

 --- a/libavcodec/mpegvideo.c
 +++ b/libavcodec/mpegvideo.c
 @@ -2158,7 +2155,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
  
 -if ((s-flagsCODEC_FLAG_PSNR) || !(s-encoding  (s-intra_only || 
 s-pict_type==AV_PICTURE_TYPE_B)  s-avctx-mb_decision != 
 FF_MB_DECISION_RD)) { //FIXME precalc
 +if ((s-avctx-flags  CODEC_FLAG_PSNR) ||
 +!(s-encoding  (s-intra_only || s-pict_type==AV_PICTURE_TYPE_B) 
 
 +  s-avctx-mb_decision != FF_MB_DECISION_RD)) { //FIXME precalc

nit: spaces around == and after //

 --- a/libavcodec/mpegvideo_enc.c
 +++ b/libavcodec/mpegvideo_enc.c
 @@ -3396,7 +3394,9 @@ static int encode_picture(MpegEncContext *s, int 
 picture_number)
  
 -if(s-qscale  3  s-max_qcoeff=128  
 s-pict_type==AV_PICTURE_TYPE_I  !(s-flags  CODEC_FLAG_QSCALE))
 +if (s-qscale  3  s-max_qcoeff=128 
 +s-pict_type==AV_PICTURE_TYPE_I 
 +!(s-avctx-flags  CODEC_FLAG_QSCALE))
  s-qscale= 3; //reduce clipping problems

nit: spaces around ==

OK

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-04-27 Thread Luca Barbato

On 27/04/15 20:13, Vittorio Giovara wrote:


The set looks fine.

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/4] mpegvideo: Drop flags and flags2

2015-04-27 Thread Vittorio Giovara
They are just duplicates of AVCodecContext members so use them directly.
---
 libavcodec/h261dec.c  |  2 --
 libavcodec/h263.h |  2 +-
 libavcodec/h263dec.c  |  7 ++
 libavcodec/ituh263enc.c   |  2 +-
 libavcodec/motion_est.c   | 14 +--
 libavcodec/mpeg12dec.c| 14 +--
 libavcodec/mpeg12enc.c|  2 +-
 libavcodec/mpeg4videodec.c|  4 ++--
 libavcodec/mpeg4videoenc.c| 16 ++---
 libavcodec/mpegvideo.c| 21 
 libavcodec/mpegvideo.h|  2 --
 libavcodec/mpegvideo_enc.c| 56 +--
 libavcodec/mpegvideo_motion.c | 16 ++---
 libavcodec/mpegvideo_xvmc.c   |  2 +-
 libavcodec/ratecontrol.c  | 14 +--
 libavcodec/svq1enc.c  |  1 -
 libavcodec/vc1_block.c| 37 ++--
 libavcodec/vc1_loopfilter.c   |  6 ++---
 libavcodec/vc1_mc.c   | 14 ++-
 libavcodec/vc1dec.c   |  4 ++--
 libavcodec/wmv2.c |  4 ++--
 libavcodec/x86/mpegvideo.c|  2 +-
 22 files changed, 117 insertions(+), 125 deletions(-)

diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 2fddc50..8e97309 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -573,8 +573,6 @@ static int h261_decode_frame(AVCodecContext *avctx, void 
*data,
 
 ff_dlog(avctx, *frame %d size=%d\n, avctx-frame_number, buf_size);
 ff_dlog(avctx, bytes=%x %x %x %x\n, buf[0], buf[1], buf[2], buf[3]);
-s-flags  = avctx-flags;
-s-flags2 = avctx-flags2;
 
 h-gob_start_code_skipped = 0;
 
diff --git a/libavcodec/h263.h b/libavcodec/h263.h
index c5e3020..5e6ae32 100644
--- a/libavcodec/h263.h
+++ b/libavcodec/h263.h
@@ -144,7 +144,7 @@ static inline int h263_get_motion_length(MpegEncContext * 
s, int val, int f_code
 }
 
 static inline void ff_h263_encode_motion_vector(MpegEncContext * s, int x, int 
y, int f_code){
-if(s-flags2  CODEC_FLAG2_NO_OUTPUT){
+if (s-avctx-flags2  CODEC_FLAG2_NO_OUTPUT) {
 skip_put_bits(s-pb,
 h263_get_motion_length(s, x, f_code)
+h263_get_motion_length(s, y, f_code));
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index a04db5c..93d9c55 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -150,7 +150,7 @@ static int get_consumed_bytes(MpegEncContext *s, int 
buf_size)
 /* We would have to scan through the whole buf to handle the weird
  * reordering ... */
 return buf_size;
-} else if (s-flags  CODEC_FLAG_TRUNCATED) {
+} else if (s-avctx-flags  CODEC_FLAG_TRUNCATED) {
 pos -= s-parse_context.last_index;
 // padding is not really read so this might be -1
 if (pos  0)
@@ -377,9 +377,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 int ret;
 AVFrame *pict = data;
 
-s-flags  = avctx-flags;
-s-flags2 = avctx-flags2;
-
 /* no supplementary picture */
 if (buf_size == 0) {
 /* special case for last picture */
@@ -394,7 +391,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 return 0;
 }
 
-if (s-flags  CODEC_FLAG_TRUNCATED) {
+if (s-avctx-flags  CODEC_FLAG_TRUNCATED) {
 int next;
 
 if (CONFIG_MPEG4_DECODER  s-codec_id == AV_CODEC_ID_MPEG4) {
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 5f15b2f..a37e744 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -459,7 +459,7 @@ void ff_h263_encode_mb(MpegEncContext * s,
 int16_t pred_dc;
 int16_t rec_intradc[6];
 int16_t *dc_ptr[6];
-const int interleaved_stats= (s-flagsCODEC_FLAG_PASS1);
+const int interleaved_stats = (s-avctx-flags  CODEC_FLAG_PASS1);
 
 if (!s-mb_intra) {
 /* compute cbp */
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 3f4faa4..c51be8d 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -331,7 +331,7 @@ int ff_init_me(MpegEncContext *s){
 c-mb_flags = get_flags(c, 0, c-avctx-mb_cmpFF_CMP_CHROMA);
 
 /*FIXME s-no_rounding b_type*/
-if(s-flagsCODEC_FLAG_QPEL){
+if (s-avctx-flags  CODEC_FLAG_QPEL) {
 c-sub_motion_search= qpel_motion_search;
 c-qpel_avg = s-qdsp.avg_qpel_pixels_tab;
 if (s-no_rounding)
@@ -968,7 +968,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
 mx =shift;
 my =shift;
 }
-if((s-flagsCODEC_FLAG_4MV)
+if ((s-avctx-flags  CODEC_FLAG_4MV)
 !c-skip  varc508  vard108){
 if(h263_mv4_search(s, mx, my, shift)  INT_MAX)
 mb_type|=CANDIDATE_MB_TYPE_INTER4V;
@@ -976,7 +976,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
 set_p_mv_tables(s, mx, my, 0);
 }else
 set_p_mv_tables(s, mx, my, 1);
-if((s-flagsCODEC_FLAG_INTERLACED_ME)
+if ((s-avctx-flags