[cvs] / xvidcore / src / utils / mbtransquant.c Repository:
ViewVC logotype

Diff of /xvidcore/src/utils/mbtransquant.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4, Fri Mar 29 00:38:29 2002 UTC revision 1.11, Wed Sep 4 06:24:37 2002 UTC
# Line 42  Line 42 
42    *                                                                            *    *                                                                            *
43    *  Revision history:                                                         *    *  Revision history:                                                         *
44    *                                                                            *    *                                                                            *
45    *  29.03.2002 interlacing speedup - used transfer strides instead of    *  29.03.2002 interlacing speedup - used transfer strides instead of             *
46    *             manual field-to-frame conversion    *             manual field-to-frame conversion                                                           *
47    *  26.03.2002 interlacing support - moved transfers outside loops    *  26.03.2002 interlacing support - moved transfers outside loops                        *
48    *  22.12.2001 get_dc_scaler() moved to common.h    *  22.12.2001 get_dc_scaler() moved to common.h                                                          *
49    *  19.11.2001 introduced coefficient thresholding (Isibaar)                  *    *  19.11.2001 introduced coefficient thresholding (Isibaar)                  *
50    *  17.11.2001 initial version                                                *    *  17.11.2001 initial version                                                *
51    *                                                                            *    *                                                                            *
# Line 68  Line 68 
68  #define MIN(X, Y) ((X)<(Y)?(X):(Y))  #define MIN(X, Y) ((X)<(Y)?(X):(Y))
69  #define MAX(X, Y) ((X)>(Y)?(X):(Y))  #define MAX(X, Y) ((X)>(Y)?(X):(Y))
70    
71  #define TOOSMALL_LIMIT 1 /* skip blocks having a coefficient sum below this value */  #define TOOSMALL_LIMIT 3                /* skip blocks having a coefficient sum below this value */
72    
73  /* this isnt pretty, but its better than 20 ifdefs */  /* this isnt pretty, but its better than 20 ifdefs */
74    
75  void MBTransQuantIntra(const MBParam *pParam,  void
76    MBTransQuantIntra(const MBParam * pParam,
77                                      FRAMEINFO * frame,
78                         MACROBLOCK * pMB,                         MACROBLOCK * pMB,
79                         const uint32_t x_pos,                         const uint32_t x_pos,
80                         const uint32_t y_pos,                         const uint32_t y_pos,
81                         int16_t data[6*64],                         int16_t data[6*64],
82                         int16_t qcoeff[6*64],                                    int16_t qcoeff[6 * 64])
                        IMAGE * const pCurrent)  
   
83  {  {
84    
85          uint32_t stride = pParam->edged_width;          uint32_t stride = pParam->edged_width;
86          uint32_t stride2 = stride / 2;          uint32_t stride2 = stride / 2;
87          uint32_t next_block = stride * 8;          uint32_t next_block = stride * 8;
88          uint32_t i;          uint32_t i;
89          uint32_t iQuant = pParam->quant;          uint32_t iQuant = frame->quant;
90          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
91            IMAGE *pCurrent = &frame->image;
92    
93          pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);          pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);
94          pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);          pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);
# Line 104  Line 105 
105    
106          start_timer();          start_timer();
107          pMB->field_dct = 0;          pMB->field_dct = 0;
108          if (pParam->global_flags & XVID_INTERLACING)          if ((frame->global_flags & XVID_INTERLACING) &&
109          {                  (x_pos>0) && (x_pos<pParam->mb_width-1) &&
110                    (y_pos>0) && (y_pos<pParam->mb_height-1)) {
111                  pMB->field_dct = MBDecideFieldDCT(data);                  pMB->field_dct = MBDecideFieldDCT(data);
112          }          }
113          stop_interlacing_timer();          stop_interlacing_timer();
114    
115          for(i = 0; i < 6; i++)          for (i = 0; i < 6; i++) {
         {  
116                  uint32_t iDcScaler = get_dc_scaler(iQuant, i < 4);                  uint32_t iDcScaler = get_dc_scaler(iQuant, i < 4);
117    
118                  start_timer();                  start_timer();
119                  fdct(&data[i*64]);                  fdct(&data[i*64]);
120                  stop_dct_timer();                  stop_dct_timer();
121    
122                  if (pParam->quant_type == H263_QUANT)                  if (pParam->m_quant_type == H263_QUANT) {
                 {  
123                          start_timer();                          start_timer();
124                          quant_intra(&qcoeff[i*64], &data[i*64], iQuant, iDcScaler);                          quant_intra(&qcoeff[i*64], &data[i*64], iQuant, iDcScaler);
125                          stop_quant_timer();                          stop_quant_timer();
# Line 127  Line 127 
127                          start_timer();                          start_timer();
128                          dequant_intra(&data[i*64], &qcoeff[i*64], iQuant, iDcScaler);                          dequant_intra(&data[i*64], &qcoeff[i*64], iQuant, iDcScaler);
129                          stop_iquant_timer();                          stop_iquant_timer();
130                  }                  } else {
                 else  
                 {  
131                          start_timer();                          start_timer();
132                          quant4_intra(&qcoeff[i*64], &data[i*64], iQuant, iDcScaler);                          quant4_intra(&qcoeff[i*64], &data[i*64], iQuant, iDcScaler);
133                          stop_quant_timer();                          stop_quant_timer();
# Line 144  Line 142 
142                  stop_idct_timer();                  stop_idct_timer();
143          }          }
144    
145          if (pMB->field_dct)          if (pMB->field_dct) {
         {  
146                  next_block = stride;                  next_block = stride;
147                  stride *= 2;                  stride *= 2;
148          }          }
# Line 162  Line 159 
159  }  }
160    
161    
162  uint8_t MBTransQuantInter(const MBParam *pParam,  uint8_t
163    MBTransQuantInter(const MBParam * pParam,
164                                      FRAMEINFO * frame,
165                            MACROBLOCK * pMB,                            MACROBLOCK * pMB,
166                            const uint32_t x_pos, const uint32_t y_pos,                                    const uint32_t x_pos,
167                                      const uint32_t y_pos,
168                            int16_t data[6*64],                            int16_t data[6*64],
169                            int16_t qcoeff[6*64],                                    int16_t qcoeff[6 * 64])
                           IMAGE * const pCurrent)  
   
170  {  {
171    
172          uint32_t stride = pParam->edged_width;          uint32_t stride = pParam->edged_width;
173          uint32_t stride2 = stride / 2;          uint32_t stride2 = stride / 2;
174          uint32_t next_block = stride * 8;          uint32_t next_block = stride * 8;
175          uint32_t i;          uint32_t i;
176          uint32_t iQuant = pParam->quant;          uint32_t iQuant = frame->quant;
177          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;          uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
178          uint8_t cbp = 0;          uint8_t cbp = 0;
179          uint32_t sum;          uint32_t sum;
180            IMAGE *pCurrent = &frame->image;
181    
182          pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);          pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);
183          pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);          pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);
# Line 186  Line 185 
185    
186          start_timer();          start_timer();
187          pMB->field_dct = 0;          pMB->field_dct = 0;
188          if (pParam->global_flags & XVID_INTERLACING)          if ((frame->global_flags & XVID_INTERLACING) &&
189          {                  (x_pos>0) && (x_pos<pParam->mb_width-1) &&
190                    (y_pos>0) && (y_pos<pParam->mb_height-1)) {
191                  pMB->field_dct = MBDecideFieldDCT(data);                  pMB->field_dct = MBDecideFieldDCT(data);
192          }          }
193          stop_interlacing_timer();          stop_interlacing_timer();
194    
195          for(i = 0; i < 6; i++)          for (i = 0; i < 6; i++) {
         {  
196                  /*                  /*
197                   *  no need to transfer 8->16-bit                   *  no need to transfer 8->16-bit
198                   * (this is performed already in motion compensation)                   * (this is performed already in motion compensation)
# Line 202  Line 201 
201                  fdct(&data[i*64]);                  fdct(&data[i*64]);
202                  stop_dct_timer();                  stop_dct_timer();
203    
204                  if (pParam->quant_type == 0)                  if (pParam->m_quant_type == 0) {
                 {  
205                          start_timer();                          start_timer();
206                          sum = quant_inter(&qcoeff[i*64], &data[i*64], iQuant);                          sum = quant_inter(&qcoeff[i*64], &data[i*64], iQuant);
207                          stop_quant_timer();                          stop_quant_timer();
208                    } else {
209                            start_timer();
210                            sum = quant4_inter(&qcoeff[i * 64], &data[i * 64], iQuant);
211                            stop_quant_timer();
212                    }
213    
214                    if ((sum >= TOOSMALL_LIMIT) || (qcoeff[i*64] != 0) ||
215                            (qcoeff[i*64+1] != 0) || (qcoeff[i*64+8] != 0)) {
216    
217                            if (pParam->m_quant_type == H263_QUANT) {
218                                    start_timer();
219                                    dequant_inter(&data[i * 64], &qcoeff[i * 64], iQuant);
220                                    stop_iquant_timer();
221                            } else {
222                                    start_timer();
223                                    dequant4_inter(&data[i * 64], &qcoeff[i * 64], iQuant);
224                                    stop_iquant_timer();
225                            }
226    
227                            cbp |= 1 << (5 - i);
228    
229                            start_timer();
230                            idct(&data[i * 64]);
231                            stop_idct_timer();
232                    }
233            }
234    
235            if (pMB->field_dct) {
236                    next_block = stride;
237                    stride *= 2;
238            }
239    
240            start_timer();
241            if (cbp & 32)
242                    transfer_16to8add(pY_Cur, &data[0 * 64], stride);
243            if (cbp & 16)
244                    transfer_16to8add(pY_Cur + 8, &data[1 * 64], stride);
245            if (cbp & 8)
246                    transfer_16to8add(pY_Cur + next_block, &data[2 * 64], stride);
247            if (cbp & 4)
248                    transfer_16to8add(pY_Cur + next_block + 8, &data[3 * 64], stride);
249            if (cbp & 2)
250                    transfer_16to8add(pU_Cur, &data[4 * 64], stride2);
251            if (cbp & 1)
252                    transfer_16to8add(pV_Cur, &data[5 * 64], stride2);
253            stop_transfer_timer();
254    
255            return cbp;
256    
257    }
258    
259    void
260    MBTransQuantIntra2(const MBParam * pParam,
261                                      FRAMEINFO * frame,
262                                      MACROBLOCK * pMB,
263                                      const uint32_t x_pos,
264                                      const uint32_t y_pos,
265                                      int16_t data[6 * 64],
266                                      int16_t qcoeff[6 * 64])
267    {
268            MBTrans(pParam,frame,pMB,x_pos,y_pos,data);
269            MBfDCT(pParam,frame,pMB,data);
270            MBQuantIntra(pParam,frame,pMB,data,qcoeff);
271            MBDeQuantIntra(pParam,frame->quant,data,qcoeff);
272            MBiDCT(data,0x3F);
273            MBTransAdd(pParam,frame,pMB,x_pos,y_pos,data,0x3F);
274    }
275    
276    
277    uint8_t
278    MBTransQuantInter2(const MBParam * pParam,
279                                      FRAMEINFO * frame,
280                                      MACROBLOCK * pMB,
281                                      const uint32_t x_pos,
282                                      const uint32_t y_pos,
283                                      int16_t data[6 * 64],
284                                      int16_t qcoeff[6 * 64])
285    {
286            uint8_t cbp;
287    
288    /* there is no MBTrans for Inter block, that's done in motion compensation already */
289    
290            MBfDCT(pParam,frame,pMB,data);
291            cbp = MBQuantInter(pParam,frame->quant,data,qcoeff);
292            MBDeQuantInter(pParam,frame->quant,data,qcoeff,cbp);
293            MBiDCT(data,cbp);
294            MBTransAdd(pParam,frame,pMB,x_pos,y_pos,data,cbp);
295    
296            return cbp;
297    }
298    
299    uint8_t
300    MBTransQuantInterBVOP(const MBParam * pParam,
301                                      FRAMEINFO * frame,
302                                      MACROBLOCK * pMB,
303                                      int16_t data[6 * 64],
304                                      int16_t qcoeff[6 * 64])
305    {
306            uint8_t cbp;
307    
308    /* there is no MBTrans for Inter block, that's done in motion compensation already */
309    
310            MBfDCT(pParam,frame,pMB,data);
311            cbp = MBQuantInter(pParam,frame->quant,data,qcoeff);
312    
313    /* we don't have to DeQuant, iDCT and Transfer back data for B-frames */
314    
315            return cbp;
316    }
317    
318    
319    void
320    MBfDCT(const MBParam * pParam,
321                                      FRAMEINFO * frame,
322                                      MACROBLOCK * pMB,
323                                      int16_t data[6 * 64])
324    {
325            int i;
326    
327            start_timer();
328            pMB->field_dct = 0;
329            if ((frame->global_flags & XVID_INTERLACING)) {
330                    pMB->field_dct = MBDecideFieldDCT(data);
331            }
332            stop_interlacing_timer();
333    
334            for (i = 0; i < 6; i++) {
335                    start_timer();
336                    fdct(&data[i * 64]);
337                    stop_dct_timer();
338            }
339    }
340    
341    void
342    MBQuantDeQuantIntra(const MBParam * pParam,
343                                            FRAMEINFO * frame,
344                                            MACROBLOCK * pMB,
345                                            int16_t qcoeff[6 * 64],
346                                            int16_t data[6*64])
347    {
348            int i;
349            int iQuant = frame->quant;
350    
351            start_timer();
352            pMB->field_dct = 0;
353            if ((frame->global_flags & XVID_INTERLACING)) {
354                    pMB->field_dct = MBDecideFieldDCT(data);
355            }
356            stop_interlacing_timer();
357    
358            for (i = 0; i < 6; i++) {
359                    uint32_t iDcScaler = get_dc_scaler(iQuant, i < 4);
360    
361                    if (pParam->m_quant_type == H263_QUANT) {
362                            start_timer();
363                            quant_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);
364                            stop_quant_timer();
365    
366                            start_timer();
367                            dequant_intra(&data[i * 64], &qcoeff[i * 64], iQuant, iDcScaler);
368                            stop_iquant_timer();
369                    } else {
370                            start_timer();
371                            quant4_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);
372                            stop_quant_timer();
373    
374                            start_timer();
375                            dequant4_intra(&data[i * 64], &qcoeff[i * 64], iQuant, iDcScaler);
376                            stop_iquant_timer();
377                    }
378            }
379                  }                  }
380                  else  
381    void
382    MBQuantIntra(const MBParam * pParam,
383                             FRAMEINFO * frame,
384                             MACROBLOCK *pMB,
385                         int16_t qcoeff[6 * 64],
386                             int16_t data[6*64])
387                  {                  {
388            int i;
389            int iQuant = frame->quant;
390    
391            start_timer();
392            pMB->field_dct = 0;
393            if ((frame->global_flags & XVID_INTERLACING)) {
394                    pMB->field_dct = MBDecideFieldDCT(data);
395            }
396            stop_interlacing_timer();
397    
398            for (i = 0; i < 6; i++) {
399                    uint32_t iDcScaler = get_dc_scaler(iQuant, i < 4);
400    
401                    if (pParam->m_quant_type == H263_QUANT) {
402                            start_timer();
403                            quant_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);
404                            stop_quant_timer();
405                    } else {
406                            start_timer();
407                            quant4_intra(&qcoeff[i * 64], &data[i * 64], iQuant, iDcScaler);
408                            stop_quant_timer();
409                    }
410            }
411    }
412    
413    void
414    MBDeQuantIntra(const MBParam * pParam,
415                               const int iQuant,
416                                      int16_t qcoeff[6 * 64],
417                                      int16_t data[6*64])
418    {
419            int i;
420    
421            for (i = 0; i < 6; i++) {
422                    uint32_t iDcScaler = get_dc_scaler(iQuant, i < 4);
423    
424                    if (pParam->m_quant_type == H263_QUANT) {
425                            start_timer();
426                            dequant_intra(&data[i * 64], &qcoeff[i * 64], iQuant, iDcScaler);
427                            stop_iquant_timer();
428                    } else {
429                            start_timer();
430                            dequant4_intra(&data[i * 64], &qcoeff[i * 64], iQuant, iDcScaler);
431                            stop_iquant_timer();
432                    }
433            }
434    }
435    
436    uint8_t
437    MBQuantInter(const MBParam * pParam,
438                             const int iQuant,
439                                      int16_t data[6 * 64],
440                                      int16_t qcoeff[6 * 64])
441    {
442    
443            int i;
444            uint8_t cbp = 0;
445            int sum;
446    
447            for (i = 0; i < 6; i++) {
448    
449                    if (pParam->m_quant_type == 0) {
450                            start_timer();
451                            sum = quant_inter(&qcoeff[i * 64], &data[i * 64], iQuant);
452                            stop_quant_timer();
453                    } else {
454                          start_timer();                          start_timer();
455                          sum = quant4_inter(&qcoeff[i*64], &data[i*64], iQuant);                          sum = quant4_inter(&qcoeff[i*64], &data[i*64], iQuant);
456                          stop_quant_timer();                          stop_quant_timer();
457                  }                  }
458    
459                  if(sum >= TOOSMALL_LIMIT) { // skip block ?                  if(sum >= TOOSMALL_LIMIT) { // skip block ?
460                            cbp |= 1 << (5 - i);
461                    }
462            }
463            return cbp;
464    }
465    
466    void
467    MBDeQuantInter( const MBParam * pParam,
468                                    const int iQuant,
469                                      int16_t data[6 * 64],
470                                      int16_t qcoeff[6 * 64],
471                                      const uint8_t cbp)
472    {
473            int i;
474    
475                          if (pParam->quant_type == H263_QUANT)          for (i = 0; i < 6; i++) {
476                    if (cbp & (1 << (5 - i)))
477                          {                          {
478                            if (pParam->m_quant_type == H263_QUANT) {
479                                  start_timer();                                  start_timer();
480                                  dequant_inter(&data[i*64], &qcoeff[i*64], iQuant);                                  dequant_inter(&data[i*64], &qcoeff[i*64], iQuant);
481                                  stop_iquant_timer();                                  stop_iquant_timer();
482                          }                          } else {
                         else  
                         {  
483                                  start_timer();                                  start_timer();
484                                  dequant4_inter(&data[i*64], &qcoeff[i*64], iQuant);                                  dequant4_inter(&data[i*64], &qcoeff[i*64], iQuant);
485                                  stop_iquant_timer();                                  stop_iquant_timer();
486                          }                          }
487                    }
488            }
489    }
490    
491                          cbp |= 1 << (5 - i);  void
492    MBiDCT( int16_t data[6 * 64],
493                    const uint8_t cbp)
494    {
495            int i;
496    
497            for (i = 0; i < 6; i++) {
498                    if (cbp & (1 << (5 - i)))
499                    {
500                          start_timer();                          start_timer();
501                          idct(&data[i*64]);                          idct(&data[i*64]);
502                          stop_idct_timer();                          stop_idct_timer();
503    
504                  }                  }
505          }          }
506    }
507    
508    
509    void
510    MBTrans(const MBParam * pParam,
511                                      FRAMEINFO * frame,
512                                      MACROBLOCK * pMB,
513                                      const uint32_t x_pos,
514                                      const uint32_t y_pos,
515                                      int16_t data[6 * 64])
516    {
517            uint32_t stride = pParam->edged_width;
518            uint32_t stride2 = stride / 2;
519            uint32_t next_block = stride * 8;
520            uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
521            IMAGE *pCurrent = &frame->image;
522    
523            pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);
524            pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);
525            pV_Cur = pCurrent->v + (y_pos << 3) * stride2 + (x_pos << 3);
526    
527            start_timer();
528            transfer_8to16copy(&data[0 * 64], pY_Cur, stride);
529            transfer_8to16copy(&data[1 * 64], pY_Cur + 8, stride);
530            transfer_8to16copy(&data[2 * 64], pY_Cur + next_block, stride);
531            transfer_8to16copy(&data[3 * 64], pY_Cur + next_block + 8, stride);
532            transfer_8to16copy(&data[4 * 64], pU_Cur, stride2);
533            transfer_8to16copy(&data[5 * 64], pV_Cur, stride2);
534            stop_transfer_timer();
535    }
536    
537          if (pMB->field_dct)  void
538    MBTransAdd(const MBParam * pParam,
539                                      FRAMEINFO * frame,
540                                      MACROBLOCK * pMB,
541                                      const uint32_t x_pos,
542                                      const uint32_t y_pos,
543                                      int16_t data[6 * 64],
544                                      const uint8_t cbp)
545          {          {
546            uint8_t *pY_Cur, *pU_Cur, *pV_Cur;
547            uint32_t stride = pParam->edged_width;
548            uint32_t stride2 = stride / 2;
549            uint32_t next_block = stride * 8;
550            IMAGE *pCurrent = &frame->image;
551    
552            pY_Cur = pCurrent->y + (y_pos << 4) * stride + (x_pos << 4);
553            pU_Cur = pCurrent->u + (y_pos << 3) * stride2 + (x_pos << 3);
554            pV_Cur = pCurrent->v + (y_pos << 3) * stride2 + (x_pos << 3);
555    
556            if (pMB->field_dct) {
557                  next_block = stride;                  next_block = stride;
558                  stride *= 2;                  stride *= 2;
559          }          }
# Line 258  Line 572 
572          if (cbp & 1)          if (cbp & 1)
573                  transfer_16to8add(pV_Cur,                  &data[5*64], stride2);                  transfer_16to8add(pV_Cur,                  &data[5*64], stride2);
574          stop_transfer_timer();          stop_transfer_timer();
   
         return cbp;  
   
575  }  }
576    
577    
578    
579  /* if sum(diff between field lines) < sum(diff between frame lines), use field dct */  /* if sum(diff between field lines) < sum(diff between frame lines), use field dct */
580    
 #define ABS(X) (X)<0 ? -(X) : (X)  
581    
582  uint32_t MBDecideFieldDCT(int16_t data[6*64])  uint32_t
583    MBDecideFieldDCT(int16_t data[6 * 64])
584  {  {
585    
586          const uint8_t blocks[] = {0*64, 0*64, 0*64, 0*64, 2*64, 2*64, 2*64, 2*64};          const uint8_t blocks[] =
587                    { 0 * 64, 0 * 64, 0 * 64, 0 * 64, 2 * 64, 2 * 64, 2 * 64, 2 * 64 };
588          const uint8_t lines[]  = {0, 16, 32, 48, 0, 16, 32, 48};          const uint8_t lines[]  = {0, 16, 32, 48, 0, 16, 32, 48};
589    
590          int frame = 0, field = 0;          int frame = 0, field = 0;
591          int i, j;          int i, j;
592    
593          for (i=0 ; i<7 ; ++i)          for (i = 0; i < 7; ++i) {
594          {                  for (j = 0; j < 8; ++j) {
595                  for (j=0 ; j<8 ; ++j)                          frame +=
596                  {                                  ABS(data[0 * 64 + (i + 1) * 8 + j] - data[0 * 64 + i * 8 + j]);
597                          frame += ABS(data[0*64 + (i+1)*8 + j] - data[0*64 + i*8 + j]);                          frame +=
598                          frame += ABS(data[1*64 + (i+1)*8 + j] - data[1*64 + i*8 + j]);                                  ABS(data[1 * 64 + (i + 1) * 8 + j] - data[1 * 64 + i * 8 + j]);
599                          frame += ABS(data[2*64 + (i+1)*8 + j] - data[2*64 + i*8 + j]);                          frame +=
600                          frame += ABS(data[3*64 + (i+1)*8 + j] - data[3*64 + i*8 + j]);                                  ABS(data[2 * 64 + (i + 1) * 8 + j] - data[2 * 64 + i * 8 + j]);
601                            frame +=
602                                    ABS(data[3 * 64 + (i + 1) * 8 + j] - data[3 * 64 + i * 8 + j]);
603    
604                          field += ABS(data[blocks[i+1] + lines[i+1] + j] -\                          field +=
605                                    ABS(data[blocks[i + 1] + lines[i + 1] + j] -
606                                       data[blocks[i  ] + lines[i  ] + j]);                                       data[blocks[i  ] + lines[i  ] + j]);
607                          field += ABS(data[blocks[i+1] + lines[i+1] + 8 + j] -\                          field +=
608                                    ABS(data[blocks[i + 1] + lines[i + 1] + 8 + j] -
609                                       data[blocks[i  ] + lines[i  ] + 8 + j]);                                       data[blocks[i  ] + lines[i  ] + 8 + j]);
610                          field += ABS(data[blocks[i+1] + 64 + lines[i+1] + j] -\                          field +=
611                                    ABS(data[blocks[i + 1] + 64 + lines[i + 1] + j] -
612                                       data[blocks[i  ] + 64 + lines[i  ] + j]);                                       data[blocks[i  ] + 64 + lines[i  ] + j]);
613                          field += ABS(data[blocks[i+1] + 64 + lines[i+1] + 8 + j] -\                          field +=
614                                    ABS(data[blocks[i + 1] + 64 + lines[i + 1] + 8 + j] -
615                                       data[blocks[i  ] + 64 + lines[i  ] + 8 + j]);                                       data[blocks[i  ] + 64 + lines[i  ] + 8 + j]);
616                  }                  }
617          }          }
618    
619          if (frame > field)          if (frame > field) {
         {  
620                  MBFrameToField(data);                  MBFrameToField(data);
621          }          }
622    
# Line 311  Line 629 
629  #define MOVLINE(X,Y) memcpy(X, Y, sizeof(tmp))  #define MOVLINE(X,Y) memcpy(X, Y, sizeof(tmp))
630  #define LINE(X,Y)    &data[X*64 + Y*8]  #define LINE(X,Y)    &data[X*64 + Y*8]
631    
632  void MBFrameToField(int16_t data[6*64])  void
633    MBFrameToField(int16_t data[6 * 64])
634  {  {
635          int16_t tmp[8];          int16_t tmp[8];
636    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.11

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4