65 |
#include "../quant/quant_h263.h" |
#include "../quant/quant_h263.h" |
66 |
#include "../encoder.h" |
#include "../encoder.h" |
67 |
|
|
68 |
|
MBFIELDTEST_PTR MBFieldTest; |
69 |
|
|
70 |
#define MIN(X, Y) ((X)<(Y)?(X):(Y)) |
#define MIN(X, Y) ((X)<(Y)?(X):(Y)) |
71 |
#define MAX(X, Y) ((X)>(Y)?(X):(Y)) |
#define MAX(X, Y) ((X)>(Y)?(X):(Y)) |
72 |
|
|
73 |
#define TOOSMALL_LIMIT 3 /* skip blocks having a coefficient sum below this value */ |
#define TOOSMALL_LIMIT 2 /* skip blocks having a coefficient sum below this value */ |
74 |
|
|
75 |
/* this isnt pretty, but its better than 20 ifdefs */ |
/* this isnt pretty, but its better than 20 ifdefs */ |
76 |
|
|
578 |
|
|
579 |
|
|
580 |
|
|
581 |
/* if sum(diff between field lines) < sum(diff between frame lines), use field dct */ |
/* permute block and return field dct choice */ |
582 |
|
|
583 |
|
|
584 |
uint32_t |
uint32_t |
585 |
MBDecideFieldDCT(int16_t data[6 * 64]) |
MBDecideFieldDCT(int16_t data[6 * 64]) |
586 |
{ |
{ |
587 |
|
uint32_t field = MBFieldTest(data); |
588 |
|
|
589 |
|
if (field) { |
590 |
|
MBFrameToField(data); |
591 |
|
} |
592 |
|
|
593 |
|
return field; |
594 |
|
} |
595 |
|
|
596 |
|
|
597 |
|
/* if sum(diff between field lines) < sum(diff between frame lines), use field dct */ |
598 |
|
|
599 |
|
uint32_t |
600 |
|
MBFieldTest_c(int16_t data[6 * 64]) |
601 |
|
{ |
602 |
const uint8_t blocks[] = |
const uint8_t blocks[] = |
603 |
{ 0 * 64, 0 * 64, 0 * 64, 0 * 64, 2 * 64, 2 * 64, 2 * 64, 2 * 64 }; |
{ 0 * 64, 0 * 64, 0 * 64, 0 * 64, 2 * 64, 2 * 64, 2 * 64, 2 * 64 }; |
604 |
const uint8_t lines[] = { 0, 16, 32, 48, 0, 16, 32, 48 }; |
const uint8_t lines[] = { 0, 16, 32, 48, 0, 16, 32, 48 }; |
632 |
} |
} |
633 |
} |
} |
634 |
|
|
635 |
if (frame > field) { |
return (frame >= field); |
|
MBFrameToField(data); |
|
|
} |
|
|
|
|
|
return (frame > field); |
|
636 |
} |
} |
637 |
|
|
638 |
|
|