* Unlike the RGB24 read/restore, which reads in a component at a time, * ARGB read/restore reads in ARGB quads. */
| 87 | * ARGB read/restore reads in ARGB quads. |
| 88 | */ |
| 89 | static int read_argb_line(CLLCContext *ctx, GetBitContext *gb, int *top_left, |
| 90 | VLC *vlc, uint8_t *outbuf) |
| 91 | { |
| 92 | uint8_t *dst; |
| 93 | int pred[4]; |
| 94 | int code; |
| 95 | int i; |
| 96 | |
| 97 | OPEN_READER(bits, gb); |
| 98 | |
| 99 | dst = outbuf; |
| 100 | pred[0] = top_left[0]; |
| 101 | pred[1] = top_left[1]; |
| 102 | pred[2] = top_left[2]; |
| 103 | pred[3] = top_left[3]; |
| 104 | |
| 105 | for (i = 0; i < ctx->avctx->width; i++) { |
| 106 | /* Always get the alpha component */ |
| 107 | UPDATE_CACHE(bits, gb); |
| 108 | GET_VLC(code, bits, gb, vlc[0].table, VLC_BITS, VLC_DEPTH); |
| 109 | |
| 110 | pred[0] += code; |
| 111 | dst[0] = pred[0]; |
| 112 | |
| 113 | /* Skip the components if they are entirely transparent */ |
| 114 | if (dst[0]) { |
| 115 | /* Red */ |
| 116 | UPDATE_CACHE(bits, gb); |
| 117 | GET_VLC(code, bits, gb, vlc[1].table, VLC_BITS, VLC_DEPTH); |
| 118 | |
| 119 | pred[1] += code; |
| 120 | dst[1] = pred[1]; |
| 121 | |
| 122 | /* Green */ |
| 123 | UPDATE_CACHE(bits, gb); |
| 124 | GET_VLC(code, bits, gb, vlc[2].table, VLC_BITS, VLC_DEPTH); |
| 125 | |
| 126 | pred[2] += code; |
| 127 | dst[2] = pred[2]; |
| 128 | |
| 129 | /* Blue */ |
| 130 | UPDATE_CACHE(bits, gb); |
| 131 | GET_VLC(code, bits, gb, vlc[3].table, VLC_BITS, VLC_DEPTH); |
| 132 | |
| 133 | pred[3] += code; |
| 134 | dst[3] = pred[3]; |
| 135 | } else { |
| 136 | dst[1] = 0; |
| 137 | dst[2] = 0; |
| 138 | dst[3] = 0; |
| 139 | } |
| 140 | |
| 141 | dst += 4; |
| 142 | } |
| 143 | |
| 144 | CLOSE_READER(bits, gb); |
| 145 | |
| 146 | top_left[0] = outbuf[0]; |