MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_13

Function decode_13

libavcodec/dxa.c:50–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48static const int shift2[6] = { 0, 0, 8, 4, 0, 4 };
49
50static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint8_t *src, uint8_t *ref)
51{
52 uint8_t *code, *data, *mv, *msk, *tmp, *tmp2;
53 int i, j, k;
54 int type, x, y, d, d2;
55 int stride = c->pic.linesize[0];
56 uint32_t mask;
57
58 code = src + 12;
59 data = code + ((avctx->width * avctx->height) >> 4);
60 mv = data + AV_RB32(src + 0);
61 msk = mv + AV_RB32(src + 4);
62
63 for(j = 0; j < avctx->height; j += 4){
64 for(i = 0; i < avctx->width; i += 4){
65 tmp = dst + i;
66 tmp2 = ref + i;
67 type = *code++;
68 switch(type){
69 case 4: // motion compensation
70 x = (*mv) >> 4; if(x & 8) x = 8 - x;
71 y = (*mv++) & 0xF; if(y & 8) y = 8 - y;
72 tmp2 += x + y*stride;
73 case 0: // skip
74 case 5: // skip in method 12
75 for(y = 0; y < 4; y++){
76 memcpy(tmp, tmp2, 4);
77 tmp += stride;
78 tmp2 += stride;
79 }
80 break;
81 case 1: // masked change
82 case 10: // masked change with only half of pixels changed
83 case 11: // cases 10-15 are for method 12 only
84 case 12:
85 case 13:
86 case 14:
87 case 15:
88 if(type == 1){
89 mask = AV_RB16(msk);
90 msk += 2;
91 }else{
92 type -= 10;
93 mask = ((msk[0] & 0xF0) << shift1[type]) | ((msk[0] & 0xF) << shift2[type]);
94 msk++;
95 }
96 for(y = 0; y < 4; y++){
97 for(x = 0; x < 4; x++){
98 tmp[x] = (mask & 0x8000) ? *data++ : tmp2[x];
99 mask <<= 1;
100 }
101 tmp += stride;
102 tmp2 += stride;
103 }
104 break;
105 case 2: // fill block
106 for(y = 0; y < 4; y++){
107 memset(tmp, data[0], 4);

Callers 1

decode_frameFunction · 0.85

Calls 3

av_logFunction · 0.85
AV_RB32Function · 0.50
AV_RB16Function · 0.50

Tested by

no test coverage detected