[mythtv] [patch] xvmcvideo.c cleanup 3
Daniel Thor Kristjansson
danielk at cat.nyu.edu
Wed Aug 18 13:29:41 EDT 2004
Another part of the xvmc-efficiency patch. This rewrites pack_pblock to
both be easier to read and to run a little faster. This one is on the
critical path, but this provides a marginal speedup.
-- Daniel
-------------- next part --------------
Index: libs/libavcodec/xvmcvideo.c
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libavcodec/xvmcvideo.c,v
retrieving revision 1.6
diff -u -r1.6 xvmcvideo.c
--- libs/libavcodec/xvmcvideo.c 28 Mar 2004 17:17:13 -0000 1.6
+++ libs/libavcodec/xvmcvideo.c 18 Aug 2004 17:18:12 -0000
@@ -55,36 +55,30 @@
s->block =(DCTELEM *)(render->data_blocks+(render->next_free_data_block_num)*64);
}
-void XVMC_pack_pblocks(MpegEncContext *s, int cbp){
-int i,j;
-
- j=0;
- for(i=0;i<6;i++){
- if(cbp & (1<<(5-i)) ){
- s->pblocks[i] = (short *)(&s->block[(j++)]);
- }else{
- s->pblocks[i] = NULL;
- }
-// printf("s->pblocks[%d]=%p ,s->block=%p cbp=%d\n",i,s->pblocks[i],s->block,cbp);
- }
- if (s->chroma_format >= 2){
- if (s->chroma_format == 2){//CHROMA_422
- for(i=6;i<8;i++){
- if(cbp & (1<<(6+7-i)) ){
- s->pblocks[i] = (short *)(&s->block[(j++)]);
- }else{
- s->pblocks[i] = NULL;
- }
- }
- }else{//CHROMA_444
- for(i=6; i<12; i++){
- if(cbp & (1<<(6+11-i)) ){
- s->pblocks[i] = (short *)(&s->block[(j++)]);
- }else{
- s->pblocks[i] = NULL;
- }
- }
- }
+void XVMC_pack_pblocks(MpegEncContext *s, int cbp)
+{
+ int i, j=0;
+ for (i=0; i<6; i++)
+ {
+ if (cbp & (1<<(5-i)))
+ s->pblocks[i] = (short *)(&s->block[(j++)]);
+ else s->pblocks[i] = NULL;
+ }
+ if (s->chroma_format < 2)
+ return;
+
+ if (s->chroma_format == 2)
+ { // CHROMA_422
+ s->pblocks[6] = NULL;
+ if (cbp & (1<<(6+1))) s->pblocks[6] = (short*)(&s->block[(j++)]);
+ s->pblocks[7] = (cbp & (1<<(6+0))) ? (short*)(&s->block[j]) : NULL;
+ }
+ else
+ { // CHROMA_444
+ for (i=6; i<12; i++)
+ if(cbp & (1<<(6+11-i)) )
+ s->pblocks[i] = (short *)(&s->block[(j++)]);
+ else s->pblocks[i] = NULL;
}
}
More information about the mythtv-dev
mailing list