| 1202 | static const QString yadif_setup = |
| 1203 | "TEMP a,b,c,e,f,g,h,j,k,l;\n" |
| 1204 | "TEMP a1,b1,f1,g1,h1,i1,j1,l1,m1,n1;\n" |
| 1205 | "ALIAS d1 = f;\n" |
| 1206 | "ALIAS k1 = g;\n" |
| 1207 | "ALIAS c1 = prev;\n" |
| 1208 | "ALIAS e1 = mov;\n" |
| 1209 | "ALIAS p0 = res;\n" |
| 1210 | "ALIAS p1 = c;\n" |
| 1211 | "ALIAS p3 = h;\n" |
| 1212 | "ALIAS spred1 = a;\n" |
| 1213 | "ALIAS spred2 = b;\n" |
| 1214 | "ALIAS spred3 = c;\n" |
| 1215 | "ALIAS spred4 = e;\n" |
| 1216 | "ALIAS spred5 = f;\n" |
| 1217 | "ALIAS sscore = g;\n" |
| 1218 | "ALIAS score1 = h;\n" |
| 1219 | "ALIAS score2 = j;\n" |
| 1220 | "ALIAS score3 = k;\n" |
| 1221 | "ALIAS score4 = l;\n" |
| 1222 | "ALIAS if1 = a1;\n" |
| 1223 | "ALIAS if2 = b1;\n" |
| 1224 | "TEMP p2, p4;\n" |
| 1225 | "ALIAS diff1 = a;\n" |
| 1226 | "ALIAS diff2 = b;\n" |
| 1227 | "TEMP diff0;\n"; |
| 1228 | |
| 1229 | static const QString yadif_spatial_sample = |
| 1230 | "ADD tmp, tex, {%5, %3, 0.0, 0.0};\n" |
| 1231 | "TEX e1, tmp, texture[1], %1;\n" |
| 1232 | "ADD tmp, tmp, {%5, 0.0, 0.0, 0.0};\n" |
| 1233 | "TEX f1, tmp, texture[1], %1;\n" |
| 1234 | "ADD tmp, tmp, {%5, 0.0, 0.0, 0.0};\n" |
| 1235 | "TEX g1, tmp, texture[1], %1;\n" |
| 1236 | "SUB tmp, tmp, {0.0, %4, 0.0, 0.0};\n" |
| 1237 | "TEX n1, tmp, texture[1], %1;\n" |
| 1238 | "SUB tmp, tmp, {%5, 0.0, 0.0, 0.0};\n" |
| 1239 | "TEX m1, tmp, texture[1], %1;\n" |
| 1240 | "SUB tmp, tmp, {%5, 0.0, 0.0, 0.0};\n" |
| 1241 | "TEX l1, tmp, texture[1], %1;\n" |
| 1242 | |
| 1243 | "SUB tmp, tex, {%5, %3, 0.0, 0.0};\n" |
| 1244 | "TEX j1, tmp, texture[1], %1;\n" |
| 1245 | "SUB tmp, tmp, {%5, 0.0, 0.0, 0.0};\n" |
| 1246 | "TEX i1, tmp, texture[1], %1;\n" |
| 1247 | "SUB tmp, tmp, {%5, 0.0, 0.0, 0.0};\n" |
| 1248 | "TEX h1, tmp, texture[1], %1;\n" |
| 1249 | "ADD tmp, tmp, {0.0, %4, 0.0, 0.0};\n" |
| 1250 | "TEX a1, tmp, texture[1], %1;\n" |
| 1251 | "ADD tmp, tmp, {%5, 0.0, 0.0, 0.0};\n" |
| 1252 | "TEX b1, tmp, texture[1], %1;\n" |
| 1253 | "ADD tmp, tmp, {%5, 0.0, 0.0, 0.0};\n" |
| 1254 | "TEX c1, tmp, texture[1], %1;\n"; |
| 1255 | |
| 1256 | static const QString yadif_calc = |
| 1257 | "LRP p0, 0.5, c, h;\n" |
| 1258 | "MOV p1, f;\n" |
| 1259 | "LRP p2, 0.5, d, i;\n" |
| 1260 | "MOV p3, g;\n" |
| 1261 | "LRP p4, 0.5, e, j;\n" |
| 1262 | |
| 1263 | "SUB diff0, d, i;\n" |
| 1264 | "ABS diff0, diff0;\n" |
| 1265 | "SUB tmp, a, f;\n" |
| 1266 | "ABS tmp, tmp;\n" |
| 1267 | "SUB diff1, b, g;\n" |
| 1268 | "ABS diff1, diff1;\n" |
| 1269 | "LRP diff1, 0.5, diff1, tmp;\n" |
| 1270 | "SUB tmp, k, f;\n" |
| 1271 | "ABS tmp, tmp;\n" |
| 1272 | "SUB diff2, g, l;\n" |
| 1273 | "ABS diff2, diff2;\n" |
| 1274 | "LRP diff2, 0.5, diff2, tmp;\n" |
| 1275 | "MAX diff0, diff0, diff1;\n" |
| 1276 | "MAX diff0, diff0, diff2;\n" |
| 1277 | |
| 1278 | // mode < 2 |
| 1279 | "SUB tmp, p0, p1;\n" |
| 1280 | "SUB other, p4, p3;\n" |
| 1281 | "MIN spred1, tmp, other;\n" |
| 1282 | "MAX spred2, tmp, other;\n" |
| 1283 | "SUB tmp, p2, p1;\n" |
| 1284 | "SUB other, p2, p3;\n" |
| 1285 | "MAX spred1, spred1, tmp;\n" |
| 1286 | "MAX spred1, spred1, other;\n" |
| 1287 | "MIN spred2, spred2, tmp;\n" |
| 1288 | "MIN spred2, spred2, other;\n" |
| 1289 | "MAX spred1, spred2, -spred1;\n" |
| 1290 | "MAX diff0, diff0, spred1;\n" |
| 1291 | |
| 1292 | // spatial prediction |
| 1293 | "LRP spred1, 0.5, d1, k1;\n" |
| 1294 | "LRP spred2, 0.5, c1, l1;\n" |
| 1295 | "LRP spred3, 0.5, b1, m1;\n" |
| 1296 | "LRP spred4, 0.5, e1, j1;\n" |
| 1297 | "LRP spred5, 0.5, f1, i1;\n" |
| 1298 | |
| 1299 | "SUB sscore, c1, j1;\n" |
| 1300 | "ABS sscore, sscore;\n" |
| 1301 | "SUB tmp, d1, k1;\n" |
| 1302 | "ABS tmp, tmp;\n" |
| 1303 | "ADD sscore, sscore, tmp;\n" |
| 1304 | "SUB tmp, e1, l1;\n" |
| 1305 | "ABS tmp, tmp;\n" |
| 1306 | "ADD sscore, sscore, tmp;\n" |
| 1307 | "SUB sscore, sscore, 1.0;\n" |
| 1308 | |
| 1309 | "SUB score1, b1, k1;\n" |
| 1310 | "ABS score1, score1;\n" |
| 1311 | "SUB tmp, c1, l1;\n" |
| 1312 | "ABS tmp, tmp;\n" |
| 1313 | "ADD score1, score1, tmp;\n" |
| 1314 | "SUB tmp, d1, m1;\n" |
| 1315 | "ABS tmp, tmp;\n" |
| 1316 | "ADD score1, score1, tmp;\n" |
| 1317 | |
| 1318 | "SUB score2, a1, l1;\n" |
| 1319 | "ABS score2, score2;\n" |
| 1320 | "SUB tmp, b1, m1;\n" |
| 1321 | "ABS tmp, tmp;\n" |
| 1322 | "ADD score2, score2, tmp;\n" |
| 1323 | "SUB tmp, c1, n1;\n" |
| 1324 | "ABS tmp, tmp;\n" |
| 1325 | "ADD score2, score2, tmp;\n" |
| 1326 | |
| 1327 | "SUB score3, d1, i1;\n" |
| 1328 | "ABS score3, score3;\n" |
| 1329 | "SUB tmp, e1, j1;\n" |
| 1330 | "ABS tmp, tmp;\n" |
| 1331 | "ADD score3, score3, tmp;\n" |
| 1332 | "SUB tmp, f1, k1;\n" |
| 1333 | "ABS tmp, tmp;\n" |
| 1334 | "ADD score3, score3, tmp;\n" |
| 1335 | |
| 1336 | "SUB score4, e1, h1;\n" |
| 1337 | "ABS score4, score4;\n" |
| 1338 | "SUB tmp, f1, i1;\n" |
| 1339 | "ABS tmp, tmp;\n" |
| 1340 | "ADD score4, score4, tmp;\n" |
| 1341 | "SUB tmp, g1, j1;\n" |
| 1342 | "ABS tmp, tmp;\n" |
| 1343 | "ADD score4, score4, tmp;\n" |
| 1344 | "SUB if1, sscore, score1;\n" |
| 1345 | "SUB if2, score1, score2;\n" |
| 1346 | "CMP if2, if1, -1.0, if2;\n" |
| 1347 | "CMP spred1, if1, spred1, spred2;\n" |
| 1348 | "CMP spred1, if2, spred1, spred3;\n" |
| 1349 | "CMP sscore, if1, sscore, score1;\n" |
| 1350 | "CMP sscore, if2, sscore, score2;\n" |
| 1351 | "SUB if1, sscore, score3;\n" |
| 1352 | "SUB if2, score3, score4;\n" |
| 1353 | "CMP if2, if1, -1.0, if2;\n" |
| 1354 | "CMP spred1, if1, spred1, spred4;\n" |
| 1355 | "CMP spred1, if2, spred1, spred5;\n" |
| 1356 | "ADD spred4, p2, diff0;\n" |
| 1357 | "SUB spred5, p2, diff0;\n" |
| 1358 | "SUB if1, spred4, spred1;\n" |
| 1359 | "SUB if2, spred1, spred5;\n" |
| 1360 | "CMP spred1, if1, spred4, spred1;\n" |
| 1361 | "CMP spred1, if2, spred5, spred1;\n"; |
| 1362 | |
| 1363 | static const QString yadif[2] = { |
| 1364 | yadif_setup + |
| 1365 | "TEMP d;\n" |
| 1366 | "ALIAS i = current;\n" |
| 1367 | "TEX current, tex, texture[1], %1;\n" |
| 1368 | "TEX d, tex, texture[2], %1;\n" |
| 1369 | "ADD tmp, tex, {0.0, %3, 0.0, 0.0};\n" |
| 1370 | "TEX a, tmp, texture[2], %1;\n" |
| 1371 | "TEX f, tmp, texture[1], %1;\n" |
| 1372 | "TEX k, tmp, texture[0], %1;\n" |
| 1373 | "ADD tmp, tex, {0.0, %4, 0.0, 0.0};\n" |
| 1374 | "TEX c, tmp, texture[2], %1;\n" |
| 1375 | "TEX h, tmp, texture[1], %1;\n" |
| 1376 | "SUB tmp, tex, {0.0, %3, 0.0, 0.0};\n" |
| 1377 | "TEX b, tmp, texture[2], %1;\n" |
| 1378 | "TEX g, tmp, texture[1], %1;\n" |
| 1379 | "TEX l, tmp, texture[0], %1;\n" |
| 1380 | "SUB tmp, tex, {0.0, %4, 0.0, 0.0};\n" |
| 1381 | "TEX e, tmp, texture[2], %1;\n" |
| 1382 | "TEX j, tmp, texture[1], %1;\n" |
| 1383 | + yadif_spatial_sample |
| 1384 | + yadif_calc |
| 1385 | + field_calc + |
| 1386 | "CMP res, prev, current, spred1;\n" |
| 1387 | , |
| 1388 | yadif_setup + |
| 1389 | "TEMP i;\n" |
| 1390 | "ALIAS d = current;\n" |
| 1391 | "TEX current, tex, texture[1], %1;\n" |
| 1392 | "TEX i, tex, texture[0], %1;\n" |
| 1393 | "ADD tmp, tex, {0.0, %3, 0.0, 0.0};\n" |
| 1394 | "TEX a, tmp, texture[2], %1;\n" |
| 1395 | "TEX f, tmp, texture[1], %1;\n" |
| 1396 | "TEX k, tmp, texture[0], %1;\n" |
| 1397 | "ADD tmp, tex, {0.0, %4, 0.0, 0.0};\n" |
| 1398 | "TEX c, tmp, texture[1], %1;\n" |
| 1399 | "TEX h, tmp, texture[0], %1;\n" |
| 1400 | "SUB tmp, tex, {0.0, %3, 0.0, 0.0};\n" |
| 1401 | "TEX b, tmp, texture[2], %1;\n" |
| 1402 | "TEX g, tmp, texture[1], %1;\n" |
| 1403 | "TEX l, tmp, texture[0], %1;\n" |
| 1404 | "SUB tmp, tex, {0.0, %4, 0.0, 0.0};\n" |
| 1405 | "TEX e, tmp, texture[1], %1;\n" |
| 1406 | "TEX j, tmp, texture[0], %1;\n" |
| 1407 | + yadif_spatial_sample |
| 1408 | + yadif_calc |
| 1409 | + field_calc + |
| 1410 | "CMP res, prev, spred1, current;\n" |
| 1411 | }; |
| 1412 | |